mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-15 01:35:08 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ad9c979d6 | ||
|
|
cd82361a39 | ||
|
|
a502020e47 | ||
|
|
a9a2db67f4 | ||
|
|
5b1250ce8a | ||
|
|
6668392bd7 | ||
|
|
d3a93abb25 | ||
|
|
8a2f686264 | ||
|
|
2eca542f87 | ||
|
|
4421d2ce44 | ||
|
|
78b98f07db | ||
|
|
ad20fa2ffc | ||
|
|
b18c195aa9 | ||
|
|
e2a49158f3 | ||
|
|
235dfca751 | ||
|
|
cb81d0ead4 | ||
|
|
21728bcab1 | ||
|
|
dbdb5478c2 | ||
|
|
46c5b95d82 | ||
|
|
e6547caacc | ||
|
|
f7b1805e95 | ||
|
|
123b47f038 | ||
|
|
c96ab68f19 | ||
|
|
35d6304a96 | ||
|
|
8f69af62f8 | ||
|
|
d2b14b6320 | ||
|
|
65431e73d4 | ||
|
|
fa4a5b0a17 | ||
|
|
714ba830d7 | ||
|
|
ed3cfe12a1 | ||
|
|
d2a9e62cb2 | ||
|
|
cbfb25647a | ||
|
|
6587200dd3 | ||
|
|
b488570a5f | ||
|
|
40a1c94a86 | ||
|
|
79c303b12d | ||
|
|
065d795622 | ||
|
|
2b54db9342 | ||
|
|
8f8e497f58 | ||
|
|
34fda5ddd1 | ||
|
|
ab1a2eeb89 | ||
|
|
5c40de2eba | ||
|
|
b0503fe523 | ||
|
|
3e3c9c30a4 | ||
|
|
1b338efca9 | ||
|
|
ddc9764a23 | ||
|
|
f23e28deaf | ||
|
|
afb9a62686 | ||
|
|
79a49341e9 | ||
|
|
5a93a3d0a9 | ||
|
|
2afb3c52f3 | ||
|
|
cbe86e814f | ||
|
|
c5f2368e1d | ||
|
|
7e4e518d7b | ||
|
|
21aa0c43a6 | ||
|
|
724c3d1fbd | ||
|
|
6c3d7d3bb0 | ||
|
|
afb9460ff9 | ||
|
|
687c440c69 | ||
|
|
1b722df37a | ||
|
|
dcdf4b1cac | ||
|
|
705581b9ac | ||
|
|
2a451bc72e | ||
|
|
faf2b88ed8 | ||
|
|
fcef87b3da | ||
|
|
fcbbd06c63 | ||
|
|
1b3b452900 | ||
|
|
0726954433 | ||
|
|
6ff11f4eea | ||
|
|
03eaa2510c | ||
|
|
a3103bce5e | ||
|
|
a9030ef60b | ||
|
|
4062adee6c | ||
|
|
2ca2cef6a2 | ||
|
|
95dca83465 | ||
|
|
f977a29ad6 | ||
|
|
68ed8a1511 | ||
|
|
c9d3001b47 | ||
|
|
75c875868a | ||
|
|
c51a9273f9 | ||
|
|
4edd2e9d5d | ||
|
|
bc310023df |
No files matched your search
+6
-22
@@ -1,28 +1,12 @@
|
||||
# everything
|
||||
/*
|
||||
|
||||
.gradle
|
||||
# IntelliJ
|
||||
/build
|
||||
/run
|
||||
/out
|
||||
.idea
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
classes/
|
||||
|
||||
|
||||
# folders
|
||||
!/gradle/wrapper
|
||||
!/src
|
||||
|
||||
# files
|
||||
!/.gitignore
|
||||
!/LICENSE.txt
|
||||
!/license-header.txt
|
||||
!/README.md
|
||||
!/gradle.properties
|
||||
!/build.gradle
|
||||
!/gradlew
|
||||
!/gradlew.bat
|
||||
.gradle/
|
||||
classes/
|
||||
build/
|
||||
run/
|
||||
out/
|
||||
@@ -1,4 +1,43 @@
|
||||
## Binnie mods
|
||||
[Binnie mods](https://minecraft.curseforge.com/projects/binnies-mods/files)
|
||||
====================================
|
||||
|
||||
### What is it?
|
||||
Binnie’s Mods is a suite of mods designed to expand the [Forestry](https://github.com/ForestryMC/ForestryMC) mod.
|
||||
It both extends the bee and tree breeding aspect by adding many new species with varied products,
|
||||
along with new features such as fully breedable flowers and genetic manipulation.
|
||||
|
||||
### Homepage
|
||||
|
||||
[Wiki](https://binnie.mods.wiki/wiki/Main_Page)
|
||||
|
||||
[Latest Builds for 1.11 / 1.11.2](http://jenkins.ic2.player.to/job/Binnie's%201.11.2/)
|
||||
|
||||
### Mods
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Extra_Bees)
|
||||
|
||||
Extra Bees expands upon the bee breeding of Forestry by adding 107 new bee species to forestry. These bees cover a large spectrum of different effects and products, giving you the ability to produce everything from dyes to rare metal dusts purely from bees. It also adds the Apiarist Database, a tool to keep track of discovered species, mutations and traits. There are also new alveary components which help improve and streamline bee production.
|
||||
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Extra_Trees)
|
||||
|
||||
Extra Trees both increases the number of tree species and adds many new aesthetic uses. There are 96 new tree species, such as Banana, Brazil nut and Douglas-fir. This comes with many new fruits as well as 35 new wooden planks. Extra Trees allows these, as well as Forestry and vanilla planks, to be combined to give doors, gates and various designs of fences. The woodworker allows planks to be combined to give patterned tiles, allowing you to build beautiful wooden floors, and the same can be done with stained glass. A group of machines such as the brewery and distillery allow you to use the fruits you grow to make a variety of wines, ciders and spirits.
|
||||
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Botany)
|
||||
|
||||
Botany adds an entirely new breeding system to Forestry: flowers. There are 46 different species that can be bred, including both vanilla flowers and new ones such as Fuschia and Lilies. The colour of the flowers can be transferred and selectively bred, meaning that each flower can be one of a possible 80 different colours. These new flowers can be bred manually in small gardens using a trowel and fertiliser, with careful care taken to maintain the desired pH or moisture, or grown on the large scale in Forestry farms.
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Genetics)
|
||||
|
||||
Genetics is for those who want to eschew conventional breeding, and want to enter the realm of genetic manipulation. Here, genes can be isolated, sequenced and then inoculated back into different species, making it easier to obtain the perfect genome. Bees, trees, butterflies and flowers can all be manipulated in this way. They can also be acclimatised to different environments to build tolerance to hostile climates.
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Binnie_Core)
|
||||
|
||||
Binnie Core is a mod which contains a lot of the core functionality such as networking and GUI's for the other mods. The only in game features it currently contains are the Compartments
|
||||
|
||||
|
||||
### Building
|
||||
|
||||
The master branch will always contain the latest released version with possibly some bug fixes for that version that will eventually be released.
|
||||
New versions will be created in branched named like {mc_version}-{mod_version}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
archivesBaseName = 'all-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":botany")
|
||||
compile project(":core")
|
||||
compile project(":extrabees")
|
||||
compile project(":extratrees")
|
||||
compile project(":genetics")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
archivesBaseName = 'api-' + mcversion
|
||||
+5
-1
@@ -1,6 +1,10 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public class FlowerManager {
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlowerFactory;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
|
||||
public class BotanyAPI {
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")
|
||||
*/
|
||||
+14
-5
@@ -1,11 +1,10 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumAcidity implements IStringSerializable {
|
||||
ACID(TextFormatting.RED),
|
||||
@@ -25,10 +24,20 @@ public enum EnumAcidity implements IStringSerializable {
|
||||
}
|
||||
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18N.localise("botany.ph." + getName());
|
||||
String localisedName = I18n.translateToLocal("botany.ph." + getName());
|
||||
if (withColor && color != null) {
|
||||
localisedName += color;
|
||||
localisedName = color + localisedName;
|
||||
}
|
||||
return localisedName;
|
||||
}
|
||||
|
||||
public static EnumAcidity getFromValue(float rawAcidity) {
|
||||
if(rawAcidity <= -1.0f){
|
||||
return EnumAcidity.ACID;
|
||||
}else if(rawAcidity >= 1.0f){
|
||||
return EnumAcidity.ALKALINE;
|
||||
}else{
|
||||
return EnumAcidity.NEUTRAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
public enum EnumFertiliserType {
|
||||
ACID, ALKALINE, NUTRIENT
|
||||
}
|
||||
+14
-4
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumMoisture implements IStringSerializable {
|
||||
DRY(TextFormatting.YELLOW),
|
||||
@@ -25,10 +25,20 @@ public enum EnumMoisture implements IStringSerializable {
|
||||
}
|
||||
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18N.localise("botany.moisture." + getName());
|
||||
String localisedName = I18n.translateToLocal("botany.moisture." + getName());
|
||||
if (withColor && color != null) {
|
||||
localisedName += color;
|
||||
localisedName = color + localisedName + TextFormatting.GRAY;
|
||||
}
|
||||
return localisedName;
|
||||
}
|
||||
|
||||
public static EnumMoisture getFromValue(float rawMoisture) {
|
||||
if(rawMoisture <= -1.0f){
|
||||
return EnumMoisture.DRY;
|
||||
}else if(rawMoisture >= 1.0f){
|
||||
return EnumMoisture.DAMP;
|
||||
}else{
|
||||
return EnumMoisture.NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumSoilType implements IStringSerializable {
|
||||
SOIL(TextFormatting.DARK_GRAY),
|
||||
@@ -24,6 +24,6 @@ public enum EnumSoilType implements IStringSerializable {
|
||||
}
|
||||
|
||||
public String getTranslated() {
|
||||
return color + I18N.localise("botany.soil." + getName());
|
||||
return color + I18n.translateToLocal("botany.soil." + getName());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
+14
-15
@@ -1,9 +1,12 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -11,6 +14,8 @@ import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
|
||||
public interface IGardeningManager {
|
||||
default boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
@@ -28,25 +33,17 @@ public interface IGardeningManager {
|
||||
|
||||
float getBiomePH(World world, BlockPos pos);
|
||||
|
||||
IBlockState getSoil(EnumSoilType soil, boolean weedKill, EnumMoisture moisture, EnumAcidity acidity);
|
||||
|
||||
void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity);
|
||||
|
||||
Collection<ItemStack> getAcidFertilisers();
|
||||
Collection<ItemStack> getFertilisers(EnumFertiliserType type);
|
||||
|
||||
Collection<ItemStack> getAlkalineFertilisers();
|
||||
Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers();
|
||||
|
||||
Collection<ItemStack> getNutrientFertilisers();
|
||||
void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength);
|
||||
|
||||
void registerAcidFertiliser(ItemStack stack, int strength);
|
||||
|
||||
void registerAlkalineFertiliser(ItemStack stack, int strength);
|
||||
|
||||
void registerNutrientFertiliser(ItemStack stack, int strength);
|
||||
|
||||
boolean isAcidFertiliser(ItemStack stack);
|
||||
|
||||
boolean isAlkalineFertiliser(ItemStack stack);
|
||||
|
||||
boolean isNutrientFertiliser(ItemStack stack);
|
||||
boolean isFertiliser(EnumFertiliserType type, ItemStack stack);
|
||||
|
||||
int getFertiliserStrength(ItemStack stack);
|
||||
|
||||
@@ -65,4 +62,6 @@ public interface IGardeningManager {
|
||||
boolean isWeedkiller(ItemStack heldItem);
|
||||
|
||||
boolean addWeedKiller(World world, BlockPos pos);
|
||||
|
||||
boolean onFertiliseSoil(ItemStack heldItem, IBlockSoil soil, World world, BlockPos pos, EntityPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
+11
-7
@@ -1,11 +1,10 @@
|
||||
package binnie.botany.genetics;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class FlowerColorAllele implements IFlowerColor, IAlleleInteger {
|
||||
// TODO: move out of API
|
||||
public class AlleleFlowerColor implements IAlleleFlowerColor {
|
||||
private int color;
|
||||
private String uid;
|
||||
private boolean isDominant;
|
||||
@@ -14,7 +13,7 @@ public class FlowerColorAllele implements IFlowerColor, IAlleleInteger {
|
||||
private int colorDis;
|
||||
private int id;
|
||||
|
||||
public FlowerColorAllele(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
|
||||
public AlleleFlowerColor(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.isDominant = isDominant;
|
||||
@@ -44,6 +43,11 @@ public class FlowerColorAllele implements IFlowerColor, IAlleleInteger {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
@@ -66,6 +70,6 @@ public class FlowerColorAllele implements IFlowerColor, IAlleleInteger {
|
||||
|
||||
@Override
|
||||
public String getColorName() {
|
||||
return I18N.localise("botany.color." + getName());
|
||||
return I18n.translateToLocal("botany.color." + getAlleleName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public final class ColorMix implements IColorMix {
|
||||
private final IFlowerColor colorFirst;
|
||||
private final IFlowerColor colorSecond;
|
||||
private final IFlowerColor result;
|
||||
private final int chance;
|
||||
|
||||
public ColorMix(IFlowerColor colorFirst, IFlowerColor colorSecond, IFlowerColor result, int chance) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorFirst() {
|
||||
return colorFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorSecond() {
|
||||
return colorSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond) {
|
||||
return (colorFirst == this.colorFirst && colorSecond == this.colorSecond) || (colorFirst == this.colorSecond && colorSecond == this.colorFirst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+2
-4
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
@@ -19,9 +19,7 @@ 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() {
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IAlleleFlowerColor extends IFlowerColor, IAlleleInteger {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -10,6 +10,9 @@ import forestry.api.core.IModelManager;
|
||||
import forestry.api.genetics.IAlleleProperty;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleFlowerSpecies> {
|
||||
IFlowerType getType();
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IAlleleFlowerSpeciesBuilder extends IAlleleSpeciesBuilder {
|
||||
@Override
|
||||
IAlleleFlowerSpecies build();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public interface IColorMix {
|
||||
IFlowerColor getColorFirst();
|
||||
@@ -0,0 +1,76 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IFlower extends IIndividual {
|
||||
/**
|
||||
* @return Flowers's genetic information.
|
||||
*/
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
/**
|
||||
* @return Genetic information of the flower's mate, null if unmated.
|
||||
*/
|
||||
@Nullable
|
||||
IFlowerGenome getMate();
|
||||
|
||||
/**
|
||||
* Mate with the given flower.
|
||||
*
|
||||
* @param flower the {@link IFlower} to mate this one with.
|
||||
*/
|
||||
void mate(IFlower flower);
|
||||
|
||||
/**
|
||||
* Remove the mate of the flower.
|
||||
*/
|
||||
void removeMate();
|
||||
|
||||
IFlower getOffspring(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return The current age of the flower.
|
||||
*/
|
||||
int getAge();
|
||||
|
||||
/**
|
||||
* Set the current age of the flower.
|
||||
*/
|
||||
void setAge(int age);
|
||||
|
||||
/**
|
||||
* Age the flower.
|
||||
*/
|
||||
void age();
|
||||
|
||||
/**
|
||||
* @return Maximum age of the flower.
|
||||
*/
|
||||
int getMaxAge();
|
||||
|
||||
/**
|
||||
* @return true if the flower is wilted.
|
||||
*/
|
||||
boolean isWilted();
|
||||
|
||||
/**
|
||||
* Set that the flower is wilted.
|
||||
*/
|
||||
void setWilted(boolean wilted);
|
||||
|
||||
/**
|
||||
* @return true if the flower has flowered.
|
||||
*/
|
||||
boolean hasFlowered();
|
||||
|
||||
/**
|
||||
* Set that the flower has flowered.
|
||||
*/
|
||||
void setFlowered(boolean flowered);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
+4
-1
@@ -1,9 +1,12 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IFlowerGenome extends IGenome {
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
+1
-3
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.api;
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -17,8 +17,6 @@ public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||
|
||||
String getName();
|
||||
|
||||
int getID();
|
||||
|
||||
int getSections();
|
||||
|
||||
int ordinal();
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
File renamed without changes.
@@ -0,0 +1,10 @@
|
||||
package binnie.core.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IBinnieRecipe {
|
||||
|
||||
Collection<Object> getInputs();
|
||||
|
||||
Collection<Object> getOutputs();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package binnie.core.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface ICraftingManager<T extends IBinnieRecipe> {
|
||||
/**
|
||||
* Add a new recipe to the crafting provider.
|
||||
*
|
||||
* @return <tt>true</tt> if this collection changed as a result of the call
|
||||
*/
|
||||
boolean addRecipe(T recipe);
|
||||
|
||||
/**
|
||||
* Remove a specific recipe from the crafting provider.
|
||||
*
|
||||
* @return <tt>true</tt> if an element was removed as a result of this call
|
||||
*/
|
||||
boolean removeRecipe(T recipe);
|
||||
|
||||
/**
|
||||
* @return an unmodifiable collection of all recipes registered to the crafting provider.
|
||||
*/
|
||||
Collection<T> recipes();
|
||||
}
|
||||
+7
-12
@@ -1,4 +1,4 @@
|
||||
package binnie.core.block;
|
||||
package binnie.core.api.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -18,11 +18,8 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
|
||||
// TODO: move out of API
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
static int temporyMeta = -1;
|
||||
|
||||
public BlockMetadata(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
@@ -36,13 +33,11 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public static NonNullList<ItemStack> getBlockDroppedAsList(IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
public static void getDrops(NonNullList<ItemStack> drops, IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
ItemStack drop = getBlockDropped(block, world, pos);
|
||||
NonNullList<ItemStack> list = NonNullList.create();
|
||||
if (!drop.isEmpty()) {
|
||||
list.add(drop);
|
||||
drops.add(drop);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean breakBlock(IBlockMetadata blockMetadata, @Nullable EntityPlayer player, World world, BlockPos pos) {
|
||||
@@ -53,7 +48,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
drops = block.getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
@@ -70,8 +65,8 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return getBlockDroppedAsList(this, world, pos);
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
getDrops(drops, this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.core.block;
|
||||
package binnie.core.api.block;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO: move out of API
|
||||
public interface IBlockMetadata extends ITileEntityProvider {
|
||||
int getPlacedMeta(ItemStack itemStack, World world, BlockPos pos, EnumFacing facing);
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.core.block;
|
||||
package binnie.core.api.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
// TODO: move out of API
|
||||
public class TileEntityMetadata extends TileEntity {
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
@@ -0,0 +1,148 @@
|
||||
package binnie.core.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IBreedingSystem {
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
Collection<IAlleleSpecies> getAllSpecies();
|
||||
|
||||
Collection<IAlleleSpecies> getDiscoveredSpecies(World world, GameProfile player);
|
||||
|
||||
List<IClassification> getAllBranches();
|
||||
|
||||
Collection<IClassification> getDiscoveredBranches(World world, GameProfile player);
|
||||
|
||||
List<IMutation> getDiscoveredMutations(World world, GameProfile player);
|
||||
|
||||
List<IMutation> getResultantMutations(final IAlleleSpecies species);
|
||||
|
||||
List<IMutation> getFurtherMutations(final IAlleleSpecies species);
|
||||
|
||||
boolean isMutationDiscovered(IMutation mutation, World world, GameProfile name);
|
||||
|
||||
float getChance(IMutation mutation, EntityPlayer player, IAlleleSpecies firstSpecies, IAlleleSpecies secondSpecies);
|
||||
|
||||
String getAlleleName(final IChromosomeType chromosome, final IAllele allele);
|
||||
|
||||
String getChromosomeName(final IChromosomeType chromo);
|
||||
|
||||
String getChromosomeShortName(final IChromosomeType chromo);
|
||||
|
||||
@Nullable
|
||||
IIndividual getConversion(final ItemStack stack);
|
||||
|
||||
ItemStack getConversionStack(final ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
IIndividual getIndividual(String uid);
|
||||
|
||||
void calculateArrays();
|
||||
|
||||
void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
|
||||
String getDescriptor();
|
||||
|
||||
String getIdent();
|
||||
|
||||
ItemStack getItemStackRepresentitive();
|
||||
|
||||
int getColour();
|
||||
|
||||
int getDiscoveredSpeciesCount();
|
||||
|
||||
int getTotalSpeciesCount();
|
||||
|
||||
float getDiscoveredSpeciesPercentage();
|
||||
|
||||
int getTotalSecretCount();
|
||||
|
||||
int getDiscoveredSecretCount();
|
||||
|
||||
float getDiscoveredBranchPercentage();
|
||||
|
||||
int getTotalBranchCount();
|
||||
|
||||
int getDiscoveredBranchCount();
|
||||
|
||||
String getEpitome();
|
||||
|
||||
String getEpitome(float discoveredPercentage);
|
||||
|
||||
Collection<IMutation> getAllMutations();
|
||||
|
||||
void calculateAlleles(ISpeciesRoot speciesRoot);
|
||||
|
||||
void calculateBranches(ISpeciesRoot speciesRoot);
|
||||
|
||||
void calculateMutations(ISpeciesRoot speciesRoot);
|
||||
|
||||
boolean isBlacklisted(IAllele allele);
|
||||
|
||||
boolean isMutationDiscovered(IMutation mutation, IBreedingTracker tracker);
|
||||
|
||||
boolean isSpeciesDiscovered(IAlleleSpecies species, World world, GameProfile name);
|
||||
|
||||
boolean isSpeciesDiscovered(IAlleleSpecies species, IBreedingTracker tracker);
|
||||
|
||||
boolean isSecret(IAlleleSpecies species);
|
||||
|
||||
boolean isSecret(IClassification branch);
|
||||
|
||||
Collection<IClassification> getDiscoveredBranches(IBreedingTracker tracker);
|
||||
|
||||
Collection<IAlleleSpecies> getDiscoveredSpecies(IBreedingTracker tracker);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getUndiscoveredIcon();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getDiscoveredIcon();
|
||||
|
||||
Class<? extends IBreedingTracker> getTrackerClass();
|
||||
|
||||
@SubscribeEvent
|
||||
void onSyncBreedingTracker(ForestryEvent.SyncedBreedingTracker event);
|
||||
|
||||
void syncTracker(IBreedingTracker tracker);
|
||||
|
||||
void onSyncBreedingTracker(IBreedingTracker tracker);
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isDNAManipulable(ItemStack stack);
|
||||
|
||||
boolean isDNAManipulable(ISpeciesType type);
|
||||
|
||||
IIndividual getDefaultIndividual();
|
||||
|
||||
ISpeciesType getDefaultType();
|
||||
|
||||
ISpeciesType[] getActiveTypes();
|
||||
|
||||
Collection<IChromosomeType> getActiveKaryotype();
|
||||
|
||||
ItemStack getDefaultMember(String uid);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.core.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,7 @@
|
||||
package binnie.extrabees.api;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
|
||||
public class ExtraBeesAPI {
|
||||
public static IBreedingSystem beeBreedingSystem;
|
||||
}
|
||||
File renamed without changes.
-4
@@ -19,15 +19,11 @@ public interface ICarpentryInterface {
|
||||
|
||||
IDesign getDesign(final int p0);
|
||||
|
||||
ILayout getLayout(final IPattern p0, final boolean p1);
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getWoodMaterial(final ItemStack stack);
|
||||
|
||||
boolean registerDesignCategory(final IDesignCategory p0);
|
||||
|
||||
IDesignCategory getDesignCategory(final String p0);
|
||||
|
||||
Collection<IDesignCategory> getAllDesignCategories();
|
||||
|
||||
List<IDesign> getSortedDesigns();
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
@@ -17,4 +17,6 @@ public interface IPattern extends ISpriteRegister {
|
||||
ILayout getRotation();
|
||||
|
||||
ILayout getHorizontalFlip();
|
||||
|
||||
int getIndex();
|
||||
}
|
||||
File renamed without changes.
+5
-5
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.carpentry;
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -6,12 +6,12 @@ import java.util.List;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public class DesignerManager {
|
||||
public final class DesignerManager {
|
||||
public static DesignerManager instance = new DesignerManager();
|
||||
|
||||
List<IDesignSystem> systems;
|
||||
private final List<IDesignSystem> systems;
|
||||
|
||||
public DesignerManager() {
|
||||
private DesignerManager() {
|
||||
this.systems = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class DesignerManager {
|
||||
return this.systems;
|
||||
}
|
||||
|
||||
public void addDesignSystem(final DesignSystem system) {
|
||||
public void addDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.carpentry;
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
@@ -11,6 +11,7 @@ import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
// TODO: move out of API
|
||||
public enum EnumPattern implements IPattern {
|
||||
Blank,
|
||||
Octagon,
|
||||
@@ -391,6 +392,11 @@ public enum EnumPattern implements IPattern {
|
||||
return this.horizontalFlip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
protected void setLeftRotation(final EnumPattern pattern, final boolean inverted) {
|
||||
this.leftRotation = Layout.get(pattern, inverted);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public interface IBlockDesign {
|
||||
IDesignSystem getDesignSystem();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
public interface IBlockDesignProperties {
|
||||
}
|
||||
+1
-5
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.carpentry;
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
@@ -18,10 +18,6 @@ public class Layout implements ILayout {
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
private Layout(final IPattern pattern) {
|
||||
this(pattern, false);
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern, final boolean inverted) {
|
||||
return new Layout(pattern, inverted);
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,15 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ExtraTreesRecipeManager {
|
||||
|
||||
@Nullable
|
||||
public static IBreweryManager breweryManager;
|
||||
@Nullable
|
||||
public static ILumbermillManager lumbermillManager;
|
||||
@Nullable
|
||||
public static IFruitPressManager fruitPressManager;
|
||||
@Nullable
|
||||
public static IDistilleryManager distilleryManager;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IBreweryCrafting {
|
||||
|
||||
@Nullable
|
||||
FluidStack getInputFluid();
|
||||
|
||||
@Nullable
|
||||
ItemStack[] getInputGrains();
|
||||
|
||||
ItemStack getIngredient();
|
||||
|
||||
ItemStack getYeast();
|
||||
|
||||
boolean hasInputGrainsEmpty();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IBreweryManager extends ICraftingManager<IBreweryRecipe> {
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output);
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output, ItemStack yeast);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output, String ingredientOreName);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output, @Nullable String ingredientOreName, ItemStack yeast);
|
||||
}
|
||||
+6
-4
@@ -1,4 +1,4 @@
|
||||
package binnie.extratrees.machines.brewery;
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
@@ -7,15 +7,17 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IBreweryRecipe {
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IBreweryRecipe extends IBinnieRecipe {
|
||||
@Nullable
|
||||
FluidStack getOutput(final BreweryCrafting crafting);
|
||||
FluidStack getOutput(IBreweryCrafting crafting);
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
|
||||
boolean isIngredient(ItemStack itemstack);
|
||||
boolean isIngredient(ItemStack itemStack);
|
||||
|
||||
List<ItemStack> getIngredients();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IDistilleryManager extends ICraftingManager<IDistilleryRecipe> {
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output, int level);
|
||||
|
||||
Collection<IDistilleryRecipe> recipes(int level);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IDistilleryRecipe extends IBinnieRecipe {
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
|
||||
int getLevel();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IFruitPressManager extends ICraftingManager<IFruitPressRecipe> {
|
||||
|
||||
void addRecipe(ItemStack input, FluidStack output);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IFruitPressRecipe extends IBinnieRecipe {
|
||||
|
||||
ItemStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface ILumbermillManager extends ICraftingManager<ILumbermillRecipe> {
|
||||
|
||||
void addRecipe(ItemStack input, ItemStack output);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface ILumbermillRecipe extends IBinnieRecipe {
|
||||
|
||||
ItemStack getOutput();
|
||||
|
||||
ItemStack getInput();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
archivesBaseName = 'botany-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":core")
|
||||
|
||||
// TODO: remove
|
||||
compile project(":extratrees")
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package binnie.botany;
|
||||
|
||||
import binnie.botany.genetics.FlowerBreedingSystem;
|
||||
import binnie.core.Binnie;
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.proxy.Proxy;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.core.modules.BlankModuleContainer;
|
||||
|
||||
@Mod(
|
||||
modid = Constants.BOTANY_MOD_ID,
|
||||
name = "Binnie's Botany",
|
||||
dependencies = "required-after:" + Constants.CORE_MOD_ID
|
||||
)
|
||||
public class Botany extends BlankModuleContainer {
|
||||
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;
|
||||
public static IBreedingSystem flowerBreedingSystem;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
super.preInit(evt);
|
||||
flowerBreedingSystem = new FlowerBreedingSystem();
|
||||
Binnie.GENETICS.registerBreedingSystem(flowerBreedingSystem);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
super.init(evt);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
super.postInit(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerModules() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BotanyGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return PacketID.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Botany.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BOT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return Constants.BOTANY_MOD_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-6
@@ -16,11 +16,6 @@ public class CreativeTabBotany extends CreativeTabs {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTranslatedTabLabel() {
|
||||
@@ -36,6 +31,6 @@ public class CreativeTabBotany extends CreativeTabs {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(Blocks.YELLOW_FLOWER);
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package binnie.botany;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumFertiliserType;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.blocks.BlockPlant;
|
||||
import binnie.botany.blocks.BlockSoil;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.util.OreDictionaryUtil;
|
||||
|
||||
public class GardeningManager implements IGardeningManager {
|
||||
private final Map<EnumFertiliserType, Map<ItemStack, Integer>> fertilisers = new LinkedHashMap<>();
|
||||
|
||||
public GardeningManager() {
|
||||
for(EnumFertiliserType type : EnumFertiliserType.values()){
|
||||
fertilisers.put(type, new LinkedHashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getNaturalMoisture(World world, BlockPos pos) {
|
||||
float moisture = getBiomeMoisture(world, pos);
|
||||
|
||||
for (int offsetX = -1; offsetX < 2; ++offsetX) {
|
||||
for (int offsetY = -1; offsetY < 2; ++offsetY) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
Block block = world.getBlockState(pos.add(offsetX, 0, offsetY)).getBlock();
|
||||
if (block == Blocks.SAND) {
|
||||
moisture -= 1.5;
|
||||
} else if (block == Blocks.WATER) {
|
||||
moisture += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isRainingAt(pos.up())) {
|
||||
moisture += 1.5;
|
||||
}
|
||||
|
||||
for (int offsetX = -1; offsetX < 2; ++offsetX) {
|
||||
for (int offsetY = -1; offsetY < 2; ++offsetY) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
Block block = world.getBlockState(pos.add(offsetX, 0, offsetY)).getBlock();
|
||||
if (block == Blocks.GRAVEL && moisture > 0.0f) {
|
||||
moisture *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnumMoisture.getFromValue(moisture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getNaturalPH(World world, BlockPos pos) {
|
||||
float acidity = getBiomePH(world, pos);
|
||||
return EnumAcidity.getFromValue(acidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomeMoisture(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
double moisture = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64);
|
||||
return (float) ((moisture == 0.0) ? moisture : ((moisture < 0.0) ? (-Math.sqrt(moisture * moisture)) : Math.sqrt(moisture * moisture)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomePH(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getSoil(EnumSoilType soil, boolean weedKill, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
IBlockState blockState = getSoilBlock(soil, weedKill).getDefaultState();
|
||||
return blockState.withProperty(BlockSoil.MOISTURE, moisture).withProperty(BlockSoil.ACIDITY, acidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
IBlockState blockState = getSoil(soil, false, moisture, acidity);
|
||||
world.setBlockState(pos, blockState, 2);
|
||||
}
|
||||
|
||||
public Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers() {
|
||||
return fertilisers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getFertilisers(EnumFertiliserType type) {
|
||||
Set<ItemStack> items = fertilisers.get(type).keySet();
|
||||
return Collections.unmodifiableSet(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertiliser(EnumFertiliserType type, ItemStack stack) {
|
||||
Collection<ItemStack> fertilisers = getFertilisers(type);
|
||||
for (ItemStack fertiliser : fertilisers) {
|
||||
if (!fertiliser.isEmpty() && fertiliser.isItemEqual(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength) {
|
||||
fertilisers.get(type).put(stack, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertiliserStrength(ItemStack stack) {
|
||||
for(EnumFertiliserType type : EnumFertiliserType.values()) {
|
||||
for (Map.Entry<ItemStack, Integer> entry : fertilisers.get(type).entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFertiliseSoil(ItemStack heldItem, IBlockSoil soil, World world, BlockPos pos, EntityPlayer player) {
|
||||
int fertiliserStrength = getFertiliserStrength(heldItem);
|
||||
if (isFertiliser(EnumFertiliserType.NUTRIENT, 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])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFertiliser(EnumFertiliserType.ACID, 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])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFertiliser(EnumFertiliserType.ALKALINE, 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])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) {
|
||||
if (flower == null) {
|
||||
return false;
|
||||
}
|
||||
IBlockState soil = world.getBlockState(pos.down());
|
||||
Biome biome = world.getBiome(pos);
|
||||
EnumAcidity acidity = soil.getValue(BlockSoil.ACIDITY);
|
||||
EnumMoisture moisture = soil.getValue(BlockSoil.MOISTURE);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getTemperature());
|
||||
return canTolerate(flower, acidity, moisture, temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getSoilType(World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
if (blockState.getBlock() instanceof IBlockSoil) {
|
||||
IBlockSoil soil = ((IBlockSoil) blockState.getBlock());
|
||||
return soil.getType(world, pos);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type, boolean weedKill) {
|
||||
switch (type) {
|
||||
case FLOWERBED:
|
||||
return weedKill ? ModuleGardening.flowerbedNoWeed : ModuleGardening.flowerbed;
|
||||
|
||||
case LOAM:
|
||||
return weedKill ? ModuleGardening.loamNoWeed : ModuleGardening.loam;
|
||||
default:
|
||||
return weedKill ? ModuleGardening.soilNoWeed : ModuleGardening.soil;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) {
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
return genome.canTolerate(acidity) && genome.canTolerate(moisture) && genome.canTolerate(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeedkiller(ItemStack heldItem) {
|
||||
return OreDictionaryUtil.hasOreName(heldItem, "weedkiller");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addWeedKiller(World world, BlockPos pos) {
|
||||
IBlockState oldState = world.getBlockState(pos);
|
||||
if (!(oldState.getBlock() instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumSoilType type = getSoilType(world, pos);
|
||||
IBlockState newState = getSoil(type, true, oldState.getValue(BlockSoil.MOISTURE), oldState.getValue(BlockSoil.ACIDITY));
|
||||
boolean done = world.setBlockState(pos, newState, 2);
|
||||
if (done && BlockPlant.isWeed(world, pos.up())) {
|
||||
world.setBlockToAir(pos.up());
|
||||
}
|
||||
return done;
|
||||
}
|
||||
}
|
||||
+8
-9
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -28,8 +28,8 @@ import forestry.api.core.IModelManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.tile.TileCeramic;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegister {
|
||||
@@ -50,8 +50,8 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,7 +62,7 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
@@ -89,10 +89,9 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(new ItemStack(item, 1, c.getFlowerColorAllele().getID()));
|
||||
itemList.add(new ItemStack(this, 1, c.getFlowerColorAllele().getID()));
|
||||
}
|
||||
}
|
||||
|
||||
+17
-14
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.ceramic.brick;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -50,11 +50,13 @@ import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.models.BlockModelEntry;
|
||||
|
||||
import binnie.Constants;
|
||||
import binnie.core.Constants;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.ceramic.TileCeramic;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickPair;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickType;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.tile.TileCeramic;
|
||||
import binnie.botany.tile.TileCeramicBrick;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.models.DefaultStateMapper;
|
||||
import binnie.core.models.ModelManager;
|
||||
@@ -73,8 +75,8 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +87,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
@@ -103,9 +105,8 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
itemList.add(new CeramicBrickPair(color, color, CeramicBrickType.TILE).getStack(1));
|
||||
}
|
||||
@@ -167,15 +168,17 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
return getDefaultState().withProperty(TYPE, CeramicBrickType.get(meta >> 16 & 0xFF));
|
||||
ItemStack stack = placer.getHeldItem(hand);
|
||||
CeramicBrickPair pair = new CeramicBrickPair(stack);
|
||||
return getDefaultState().withProperty(TYPE, pair.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(worldIn, pos, TileCeramicBrick.class);
|
||||
if (ceramic != null) {
|
||||
int damage = stack.getItemDamage();
|
||||
ceramic.setColors(EnumFlowerColor.get(damage & 0xFF), EnumFlowerColor.get(damage >> 8 & 0xFF));
|
||||
CeramicBrickPair pair = new CeramicBrickPair(stack);
|
||||
ceramic.setColors(pair.colorFirst, pair.colorSecond);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +235,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
if (ceramic != null) {
|
||||
return ceramic.pair();
|
||||
}
|
||||
return null;
|
||||
return CeramicBrickPair.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
+4
-4
@@ -1,10 +1,11 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.ceramic.CeramicColor;
|
||||
import binnie.botany.ceramic.CeramicDesignSystem;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
@@ -16,7 +17,6 @@ public class BlockCeramicPatterned extends BlockDesign {
|
||||
super(CeramicDesignSystem.instance, Material.ROCK);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName("ceramicPattern");
|
||||
}
|
||||
|
||||
+310
-320
@@ -1,320 +1,310 @@
|
||||
package binnie.botany.flower;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.FlowerDefinition;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
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);
|
||||
/* PROPERTIES */
|
||||
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
|
||||
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
|
||||
public static final PropertyBool SEED = PropertyBool.create("seed");
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.PLANTS);
|
||||
setTickRandomly(true);
|
||||
setRegistryName("flower");
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
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();
|
||||
if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||
heldItem.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
TileEntity tile = source.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB.offset(pos);
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB.offset(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
TileEntity flower = world.getTileEntity(pos);
|
||||
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = flowerRoot.getMember(stack);
|
||||
if (f != null) {
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity below = world.getTileEntity(pos.down());
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
flowerRoot.tryGrowSection(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (tintIndex == 0) {
|
||||
return flower.getStemColour();
|
||||
} else if (tintIndex == 1) {
|
||||
return flower.getPrimaryColour();
|
||||
}
|
||||
return flower.getSecondaryColour();
|
||||
}
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
IBlockState downState = world.getBlockState(pos.down());
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return downState.getBlock() == Botany.flower;
|
||||
}
|
||||
return canPlaceBlockOn(downState.getBlock());
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.GRASS
|
||||
|| block == Blocks.DIRT
|
||||
|| block == Blocks.FARMLAND
|
||||
|| BotanyCore.getGardening().isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityFlower flower = TileUtil.getTile(world, pos, TileEntityFlower.class);
|
||||
if (flower != null && flower.getType() != null) {
|
||||
state = state.withProperty(FLOWER, flower.getType());
|
||||
state = state.withProperty(FLOWERED, flower.isFlowered());
|
||||
state = state.withProperty(SECTION, flower.getRenderSection());
|
||||
state = state.withProperty(SEED, flower.getAge() == 0);
|
||||
} else {
|
||||
state = state.withProperty(FLOWER, FlowerDefinition.Dandelion.getSpecies().getType());
|
||||
state = state.withProperty(FLOWERED, false);
|
||||
state = state.withProperty(SEED, false);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, FLOWER, FLOWERED, SECTION, SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
checkAndDropBlock(worldIn, pos);
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) {
|
||||
dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, pos);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, BlockPos pos) {
|
||||
if (!canBlockStay(world, pos)) {
|
||||
dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (!flower.isEmpty()) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
}
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
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;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.blocks.properties.PropertyFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.FlowerDefinition;
|
||||
import binnie.botany.models.StateMapperFlower;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
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);
|
||||
/* PROPERTIES */
|
||||
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
|
||||
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
|
||||
public static final PropertyBool SEED = PropertyBool.create("seed");
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.PLANTS);
|
||||
setTickRandomly(true);
|
||||
setRegistryName("flower");
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
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();
|
||||
if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||
heldItem.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
TileEntity tile = source.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB.offset(getOffset(state, source, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
TileEntity flower = world.getTileEntity(pos);
|
||||
if (!!world.isRemote) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = flowerRoot.getMember(stack);
|
||||
if (f != null) {
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity below = world.getTileEntity(pos.down());
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
flowerRoot.tryGrowSection(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (tintIndex == 0) {
|
||||
return flower.getStemColour();
|
||||
} else if (tintIndex == 1) {
|
||||
return flower.getPrimaryColour();
|
||||
}
|
||||
return flower.getSecondaryColour();
|
||||
}
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
IBlockState downState = world.getBlockState(pos.down());
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return downState.getBlock() == ModuleFlowers.flower;
|
||||
}
|
||||
return canPlaceBlockOn(downState.getBlock());
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.GRASS
|
||||
|| block == Blocks.DIRT
|
||||
|| block == Blocks.FARMLAND
|
||||
|| BotanyCore.getGardening().isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityFlower flower = TileUtil.getTile(world, pos, TileEntityFlower.class);
|
||||
if (flower != null && flower.getType() != null) {
|
||||
state = state.withProperty(FLOWER, flower.getType());
|
||||
state = state.withProperty(FLOWERED, flower.isFlowered());
|
||||
state = state.withProperty(SECTION, flower.getRenderSection());
|
||||
state = state.withProperty(SEED, flower.getAge() == 0);
|
||||
} else {
|
||||
state = state.withProperty(FLOWER, FlowerDefinition.Dandelion.getSpecies().getType());
|
||||
state = state.withProperty(FLOWERED, false);
|
||||
state = state.withProperty(SEED, false);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, FLOWER, FLOWERED, SECTION, SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
checkAndDropBlock(worldIn, pos);
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != ModuleFlowers.flower) {
|
||||
dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, pos);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, BlockPos pos) {
|
||||
if (!canBlockStay(world, pos)) {
|
||||
dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (!flower.isEmpty()) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
}
|
||||
+10
-14
@@ -1,7 +1,5 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -25,8 +23,8 @@ import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
@@ -52,10 +50,9 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
int index = 0;
|
||||
for (PlantType type : PlantType.values()) {
|
||||
manager.registerItemModel(item, index, type.getName());
|
||||
index++;
|
||||
for (int i = 0;i < PlantType.values().length;i++) {
|
||||
PlantType type = PlantType.getType(i);
|
||||
manager.registerItemModel(item, i, type.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,12 +68,12 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(PLANT_TYPE, PlantType.values()[meta]);
|
||||
return getDefaultState().withProperty(PLANT_TYPE, PlantType.getType(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return new ArrayList<>();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,8 +87,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, NonNullList<ItemStack> subBlocks) {
|
||||
public void getSubBlocks(CreativeTabs p_149666_2_, NonNullList<ItemStack> subBlocks) {
|
||||
for (PlantType type : PlantType.values()) {
|
||||
subBlocks.add(type.get());
|
||||
}
|
||||
+21
-14
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
@@ -29,14 +29,18 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.Constants;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IBlockSoil;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.modules.BotanyModuleUIDs;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.core.modules.ModuleManager;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
|
||||
@@ -135,8 +139,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
@@ -223,7 +226,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
if (!world.isAirBlock(pos)) {
|
||||
return;
|
||||
}
|
||||
world.setBlockState(pos, Botany.plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
|
||||
world.setBlockState(pos, ModuleGardening.plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +261,8 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
return false;
|
||||
}
|
||||
IBlockState old = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(maxLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||
IBlockState newState = BotanyCore.getGardening().getSoil(maxLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
|
||||
return world.setBlockState(pos, newState, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -268,7 +272,8 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
return false;
|
||||
}
|
||||
IBlockState old = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(minLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||
IBlockState newState = BotanyCore.getGardening().getSoil(minLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
|
||||
return world.setBlockState(pos, newState, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,11 +299,13 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
|
||||
IBlockState plant = plantable.getPlant(world, pos.up());
|
||||
if (plant.getBlock() == Botany.flower) {
|
||||
return true;
|
||||
if(ModuleManager.isModuleEnabled(Constants.BOTANY_MOD_ID, BotanyModuleUIDs.FLOWERS)) {
|
||||
if (plant.getBlock() == ModuleFlowers.flower) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (plant.getBlock() == Botany.plant) {
|
||||
if (plant.getBlock() == ModuleGardening.plant) {
|
||||
return !weedKilled || !BlockPlant.isWeed(world, pos);
|
||||
}
|
||||
return world instanceof World && Blocks.DIRT.canSustainPlant(state, world, pos, direction, plantable);
|
||||
+8
-9
@@ -1,8 +1,7 @@
|
||||
package binnie.botany.ceramic;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -36,10 +35,10 @@ import forestry.api.core.IModelManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.api.block.BlockMetadata;
|
||||
import binnie.core.api.block.IBlockMetadata;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister {
|
||||
@@ -106,8 +105,8 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return Collections.emptyList();
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -143,7 +142,7 @@ public class BlockStainedGlass extends Block implements IBlockMetadata, IColored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, color.ordinal()));
|
||||
}
|
||||
+8
-5
@@ -1,9 +1,9 @@
|
||||
package binnie.botany.gardening;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
|
||||
public enum PlantType implements IStringSerializable {
|
||||
WEEDS("weeds", true),
|
||||
@@ -24,12 +24,15 @@ public enum PlantType implements IStringSerializable {
|
||||
this.isWeed = isWeed;
|
||||
}
|
||||
|
||||
public static PlantType get(int id) {
|
||||
return values()[id % values().length];
|
||||
public static PlantType getType(int meta){
|
||||
if(meta >= values().length){
|
||||
meta = values().length-1;
|
||||
}
|
||||
return values()[meta];
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, ordinal());
|
||||
return new ItemStack(ModuleGardening.plant, 1, ordinal());
|
||||
}
|
||||
|
||||
public boolean isWeed() {
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.flower;
|
||||
package binnie.botany.blocks.properties;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
@@ -11,8 +11,8 @@ import net.minecraft.block.properties.PropertyHelper;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
|
||||
public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I> {
|
||||
public PropertyFlower(String name, Class<I> flowerTypeClass) {
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.blocks.properties;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
+4
-4
@@ -5,9 +5,9 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial {
|
||||
@@ -31,7 +31,7 @@ public class CeramicColor implements IDesignMaterial {
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal());
|
||||
return TileEntityMetadata.getItemStack(ModuleCeramic.ceramic, color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
+15
-12
@@ -4,6 +4,8 @@ import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.extratrees.api.carpentry.DesignerManager;
|
||||
import binnie.extratrees.api.carpentry.EnumPattern;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -15,14 +17,13 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.extratrees.carpentry.DesignerManager;
|
||||
import binnie.extratrees.carpentry.EnumPattern;
|
||||
|
||||
public class CeramicDesignSystem implements IDesignSystem {
|
||||
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||
@@ -63,8 +64,9 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getPrimarySprite(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return primary.get(((EnumPattern) pattern).ordinal());
|
||||
int index = pattern.getIndex();
|
||||
if (index > 0 && index < primary.size()) {
|
||||
return primary.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -73,8 +75,9 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSecondarySprite(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return secondary.get(((EnumPattern) pattern).ordinal());
|
||||
int index = pattern.getIndex();
|
||||
if (index > 0 && index < secondary.size()) {
|
||||
return secondary.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -86,8 +89,8 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
for (EnumPattern pattern : EnumPattern.values()) {
|
||||
ResourceLocation primaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0");
|
||||
ResourceLocation secondaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1");
|
||||
primary.put(pattern.ordinal(), textureMap.registerSprite(primaryLocation));
|
||||
secondary.put(pattern.ordinal(), textureMap.registerSprite(secondaryLocation));
|
||||
primary.put(pattern.getIndex(), textureMap.registerSprite(primaryLocation));
|
||||
secondary.put(pattern.getIndex(), textureMap.registerSprite(secondaryLocation));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,13 +100,13 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.MORTAR.get(1);
|
||||
return CeramicItems.MORTAR.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IDesignMaterial getMaterial(ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic))
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(ModuleCeramic.ceramic))
|
||||
? getMaterial(itemStack.getItemDamage())
|
||||
: null;
|
||||
}
|
||||
+21
-8
@@ -4,23 +4,26 @@ import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CeramicBrickPair {
|
||||
public static final CeramicBrickPair EMPTY = new CeramicBrickPair(EnumFlowerColor.DarkSeaGreen, EnumFlowerColor.DarkSeaGreen, CeramicBrickType.TILE);
|
||||
|
||||
public final EnumFlowerColor colorFirst;
|
||||
public final EnumFlowerColor colorSecond;
|
||||
|
||||
public CeramicBrickType type;
|
||||
public int ordinal;
|
||||
|
||||
CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
public CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.type = type;
|
||||
@@ -28,7 +31,7 @@ public class CeramicBrickPair {
|
||||
}
|
||||
|
||||
public CeramicBrickPair(ItemStack stack) {
|
||||
this(TileEntityMetadata.getItemDamage(stack));
|
||||
this(getId(stack));
|
||||
}
|
||||
|
||||
public CeramicBrickPair(int id) {
|
||||
@@ -41,8 +44,18 @@ public class CeramicBrickPair {
|
||||
return type.canDouble() && colorSecond != colorFirst;
|
||||
}
|
||||
|
||||
public static int getId(ItemStack stack){
|
||||
if(!stack.hasTagCompound()){
|
||||
return EMPTY.ordinal();
|
||||
}
|
||||
NBTTagCompound nbtTagCompound = stack.getTagCompound();
|
||||
return nbtTagCompound.getInteger("id");
|
||||
}
|
||||
|
||||
public ItemStack getStack(int i) {
|
||||
return new ItemStack(Botany.ceramicBrick, i, ordinal());
|
||||
ItemStack stack = new ItemStack(ModuleCeramic.ceramicBrick, i);
|
||||
stack.setTagInfo("id", new NBTTagInt(ordinal()));
|
||||
return stack;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@@ -66,12 +79,12 @@ public class CeramicBrickPair {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Integer.hashCode(ordinal());
|
||||
return Integer.hashCode(type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof CeramicBrickPair
|
||||
&& ((CeramicBrickPair) obj).ordinal() == ordinal();
|
||||
&& ((CeramicBrickPair) obj).type == type;
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -11,10 +11,10 @@ import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
|
||||
public enum CeramicBrickType implements IStringSerializable {
|
||||
TILE("tile") {
|
||||
@@ -30,7 +30,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
if (isMortar(stack)) {
|
||||
++mortars;
|
||||
} else {
|
||||
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
||||
if (stack.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramic)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
++blocks;
|
||||
@@ -82,7 +82,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
for (ItemStack stack4 : stacks) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||
@@ -122,7 +122,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
int altCounter = 0;
|
||||
for (ItemStack stack2 : stacks) {
|
||||
int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack2);
|
||||
@@ -148,7 +148,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
for (ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
@@ -177,7 +177,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
for (ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
@@ -233,7 +233,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
TextureAtlasSprite[] sprites;
|
||||
public TextureAtlasSprite[] sprites;
|
||||
|
||||
CeramicBrickType(String id) {
|
||||
this.id = id;
|
||||
@@ -290,7 +290,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
int[] colors = {-1, -1};
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
|
||||
protected boolean isMortar(ItemStack stack) {
|
||||
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.MORTAR.ordinal();
|
||||
return stack.getItem() == ModuleCeramic.misc && stack.getItemDamage() == CeramicItems.MORTAR.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,25 @@
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.GardeningManager;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.genetics.FlowerRoot;
|
||||
|
||||
public class BotanyCore {
|
||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
if (BotanyAPI.flowerRoot == null) {
|
||||
BotanyAPI.flowerRoot = new FlowerRoot();
|
||||
}
|
||||
return BotanyAPI.flowerRoot;
|
||||
}
|
||||
|
||||
public static IGardeningManager getGardening() {
|
||||
if (BotanyAPI.gardening == null) {
|
||||
BotanyAPI.gardening = new GardeningManager();
|
||||
}
|
||||
return BotanyAPI.gardening;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+6
-6
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
@@ -12,8 +12,8 @@ import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.core.circuits.BinnieCircuit;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
@@ -25,12 +25,12 @@ public class CircuitGarden extends BinnieCircuit {
|
||||
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
|
||||
isManual = manual;
|
||||
logic = new GardenLogic(moisture, ph, isManual, fertilised, icon, I18N.localise(getUnlocalizedName()));
|
||||
String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true);
|
||||
String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true) + TextFormatting.GRAY + ", ";
|
||||
if (ph != null) {
|
||||
info += TextFormatting.GRAY + ", " + I18N.localise("botany.ph") + ": " + moisture.getLocalisedName(true);
|
||||
info += I18N.localise("botany.ph") + ": " + ph.getLocalisedName(true) + TextFormatting.GRAY + ", ";
|
||||
}
|
||||
String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized";
|
||||
info += TextFormatting.GRAY + " " + I18N.localise(fertilizedKey);
|
||||
info += (fertilised ? TextFormatting.GREEN : TextFormatting.RED) + I18N.localise(fertilizedKey) + TextFormatting.GRAY;
|
||||
addTooltipString(I18N.localise("for.binnie.circuit.garden.info", info));
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -12,17 +12,17 @@ import net.minecraft.world.World;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
|
||||
public class FarmableFlower implements IFarmable {
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos) == Botany.flower;
|
||||
return world.getBlockState(pos) == ModuleFlowers.flower;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -38,7 +38,7 @@ public class FarmableFlower implements IFarmable {
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
ItemStack mature = flowerRoot.getMemberStack(flower, EnumFlowerStage.FLOWER);
|
||||
ItemStack seed = flowerRoot.getMemberStack(flower, EnumFlowerStage.SEED);
|
||||
if (mature != null && seed != null) {
|
||||
if (!mature.isEmpty() && !seed.isEmpty()) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
return new FlowerCrop(pos, mature, seed);
|
||||
}
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package binnie.botany.farm;
|
||||
package binnie.botany.farming;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class FarmableVanillaFlower extends FarmableFlower {
|
||||
Loaded 100 of 4961 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user