mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-14 17:24:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
990fcb8cad | ||
|
|
327fd1a6b5 | ||
|
|
b60554e90a | ||
|
|
2358e03096 | ||
|
|
23d066df7d | ||
|
|
07193e39f5 | ||
|
|
59c409b4bb | ||
|
|
c6eaf3010c | ||
|
|
a23491bb0b | ||
|
|
1ef2f23604 | ||
|
|
de6028e85d | ||
|
|
4689fef8c3 | ||
|
|
f13bfc0a63 | ||
|
|
9342817813 | ||
|
|
caa307e72e | ||
|
|
1a9b0839a1 | ||
|
|
03f562a300 | ||
|
|
f1e7a198e5 | ||
|
|
925649c486 | ||
|
|
72ea6b71be | ||
|
|
2794bd076a | ||
|
|
4566890273 | ||
|
|
4c03896354 | ||
|
|
266657a3ab | ||
|
|
1d97fc17e6 | ||
|
|
adef8dc0e4 | ||
|
|
37c3231624 | ||
|
|
06ad753490 | ||
|
|
76cfaaed83 | ||
|
|
f400985ab3 | ||
|
|
a12e293eed | ||
|
|
de33285994 | ||
|
|
6873c36d81 | ||
|
|
3fc36f8e37 | ||
|
|
134efac45b | ||
|
|
a19fccc5d0 | ||
|
|
fc2f1c5930 | ||
|
|
ca4da294b4 | ||
|
|
a41e6d32a1 | ||
|
|
12f4f55799 | ||
|
|
9fe388beee | ||
|
|
a0f239bd92 | ||
|
|
7d88eb7ebb | ||
|
|
53aa5fc6d6 | ||
|
|
57d30512e3 | ||
|
|
7de1c86d29 | ||
|
|
8fa3d5ece8 | ||
|
|
efc88324c6 | ||
|
|
527044da56 | ||
|
|
50a0887329 | ||
|
|
79ea282f9b | ||
|
|
60395a0ec7 | ||
|
|
5ecb465d01 | ||
|
|
e9556c44f9 | ||
|
|
868cedbf6f | ||
|
|
7ede85dfb8 | ||
|
|
fab5b82cbe | ||
|
|
fdb9a14962 | ||
|
|
92cc62950e | ||
|
|
ef90f2228b | ||
|
|
8600dc9e66 | ||
|
|
0f5861f015 | ||
|
|
68e966800e | ||
|
|
767723fc02 | ||
|
|
7d5b6da9a4 | ||
|
|
78687099cd | ||
|
|
151ce90672 | ||
|
|
1a717e2e2c | ||
|
|
9acfedfa16 | ||
|
|
f968bfdb38 | ||
|
|
c247bd1243 | ||
|
|
40f8c11a1b | ||
|
|
f68d62671f | ||
|
|
c7ebb39486 | ||
|
|
228958f1d0 | ||
|
|
96b753d37f | ||
|
|
9dfe741f38 | ||
|
|
c0f18b9f6a | ||
|
|
b4568bba62 | ||
|
|
555f18dd99 | ||
|
|
7e9bd507d0 | ||
|
|
7c623fd9a8 | ||
|
|
64e443eda7 |
No files matched your search
@@ -10,3 +10,4 @@ classes/
|
||||
build/
|
||||
run/
|
||||
out/
|
||||
/changelog.html
|
||||
@@ -10,7 +10,7 @@ along with new features such as fully breedable flowers and genetic manipulation
|
||||
|
||||
[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/)
|
||||
[Latest Builds for 1.12 ](http://jenkins.ic2.player.to/job/Binnie's%201.12/)
|
||||
|
||||
### Mods
|
||||
|
||||
|
||||
+5
-6
@@ -1,10 +1,9 @@
|
||||
archivesBaseName = 'all-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":botany")
|
||||
compile project(":core")
|
||||
compile project(":extrabees")
|
||||
compile project(":extratrees")
|
||||
compile project(":genetics")
|
||||
runtimeOnly project(":botany")
|
||||
runtimeOnly project(":core")
|
||||
runtimeOnly project(":extrabees")
|
||||
runtimeOnly project(":extratrees")
|
||||
runtimeOnly project(":genetics")
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
archivesBaseName = 'api-' + mcversion
|
||||
@@ -1,10 +0,0 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface IFlowerFactory {
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||
|
||||
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package binnie.extrabees.api;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
|
||||
public class ExtraBeesAPI {
|
||||
public static IBreedingSystem beeBreedingSystem;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public final class DesignerManager {
|
||||
public static DesignerManager instance = new DesignerManager();
|
||||
|
||||
private final List<IDesignSystem> systems;
|
||||
|
||||
private DesignerManager() {
|
||||
this.systems = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void registerDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
|
||||
public Collection<IDesignSystem> getDesignSystems() {
|
||||
return this.systems;
|
||||
}
|
||||
|
||||
public void addDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public interface IBlockDesign {
|
||||
IDesignSystem getDesignSystem();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
archivesBaseName = 'botany-api-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":core-api")
|
||||
}
|
||||
File renamed without changes.
+1
@@ -12,6 +12,7 @@ public enum EnumAcidity implements IStringSerializable {
|
||||
ALKALINE(TextFormatting.AQUA);
|
||||
|
||||
@Nullable
|
||||
private final
|
||||
TextFormatting color;
|
||||
|
||||
EnumAcidity(@Nullable TextFormatting color) {
|
||||
File renamed without changes.
+1
-1
@@ -13,7 +13,7 @@ public enum EnumMoisture implements IStringSerializable {
|
||||
DAMP(TextFormatting.DARK_BLUE);
|
||||
|
||||
@Nullable
|
||||
final TextFormatting color;
|
||||
private final TextFormatting color;
|
||||
|
||||
EnumMoisture(@Nullable TextFormatting color) {
|
||||
this.color = color;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -25,7 +25,7 @@ public enum EnumFlowerChromosome implements IChromosomeType {
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
STEM(IAlleleInteger.class);
|
||||
|
||||
private Class<? extends IAllele> cls;
|
||||
private final Class<? extends IAllele> cls;
|
||||
|
||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
@@ -0,0 +1,130 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumFlowerColor implements IStringSerializable {
|
||||
Aquamarine("aquamarine", new Color(8388564)),
|
||||
Black("black", new Color(2631720)),
|
||||
Blue("blue", new Color(255)),
|
||||
Brown("brown", new Color(10824234)),
|
||||
CadetBlue("cadetBlue", new Color(6266528)),
|
||||
Chocolate("chocolate", new Color(13789470)),
|
||||
Coral("coral", new Color(16744272)),
|
||||
Crimson("crimson", new Color(14423100)),
|
||||
Cyan("cyan", new Color(65535)),
|
||||
DarkGoldenrod("darkGoldenrod", new Color(12092939)),
|
||||
DarkGray("darkGray", new Color(11119017)),
|
||||
DarkGreen("darkGreen", new Color(25600)),
|
||||
DarkKhaki("darkKhaki", new Color(12433259)),
|
||||
DarkOliveGreen("darkOliveGreen", new Color(5597999)),
|
||||
DarkOrange("darkOrange", new Color(16747520)),
|
||||
DarkSalmon("darkSalmon", new Color(15308410)),
|
||||
DarkSeaGreen("darkSeaGreen", new Color(9419915)),
|
||||
DarkSlateBlue("darkSlateBlue", new Color(4734347)),
|
||||
DarkSlateGray("darkSlateGray", new Color(3100495)),
|
||||
DarkTurquoise("darkTurquoise", new Color(52945)),
|
||||
DarkViolet("darkViolet", new Color(9699539)),
|
||||
DeepPink("deepPink", new Color(16716947)),
|
||||
DeepSkyBlue("deepSkyBlue", new Color(49151)),
|
||||
DimGray("dimGray", new Color(6908265)),
|
||||
DodgerBlue("dodgerBlue", new Color(2003199)),
|
||||
Gold("gold", new Color(16766720)),
|
||||
Goldenrod("goldenrod", new Color(14329120)),
|
||||
Gray("gray", new Color(8421504)),
|
||||
Green("green", new Color(32768)),
|
||||
HotPink("hotPink", new Color(16738740)),
|
||||
IndianRed("indianRed", new Color(13458524)),
|
||||
Indigo("indigo", new Color(4915330)),
|
||||
Khaki("khaki", new Color(15787660)),
|
||||
Lavender("lavender", new Color(15132410)),
|
||||
LemonChiffon("lemonChiffon", new Color(16775885)),
|
||||
LightGray("lightGray", new Color(13882323)),
|
||||
LightSeaGreen("lightSeaGreen", new Color(2142890)),
|
||||
LightSteelBlue("lightSteelBlue", new Color(11584734)),
|
||||
Lime("lime", new Color(65280)),
|
||||
LimeGreen("limeGreen", new Color(3329330)),
|
||||
Magenta("magenta", new Color(16711935)),
|
||||
Maroon("maroon", new Color(8388608)),
|
||||
MediumAquamarine("mediumAquamarine", new Color(6737322)),
|
||||
MediumOrchid("mediumOrchid", new Color(12211667)),
|
||||
MediumPurple("mediumPurple", new Color(9662683)),
|
||||
MediumSeaGreen("mediumSeaGreen", new Color(3978097)),
|
||||
MediumVioletRed("mediumVioletRed", new Color(13047173)),
|
||||
MistyRose("mistyRose", new Color(16770273)),
|
||||
Navy("navy", new Color(128)),
|
||||
Olive("olive", new Color(8421376)),
|
||||
OliveDrab("oliveDrab", new Color(7048739)),
|
||||
Orange("orange", new Color(16753920)),
|
||||
PaleGreen("paleGreen", new Color(10025880)),
|
||||
PaleTurquoise("paleTurquoise", new Color(11529966)),
|
||||
PaleVioletRed("paleVioletRed", new Color(14381203)),
|
||||
Peru("peru", new Color(13468991)),
|
||||
Pink("pink", new Color(16761035)),
|
||||
Plum("plum", new Color(14524637)),
|
||||
Purple("purple", new Color(8388736)),
|
||||
Red("red", new Color(16711680)),
|
||||
RosyBrown("rosyBrown", new Color(12357519)),
|
||||
RoyalBlue("royalBlue", new Color(4286945)),
|
||||
Salmon("salmon", new Color(16416882)),
|
||||
SandyBrown("sandyBrown", new Color(16032864)),
|
||||
SeaGreen("seaGreen", new Color(3050327)),
|
||||
Sienna("sienna", new Color(10506797)),
|
||||
SkyBlue("skyBlue", new Color(8900331)),
|
||||
SlateBlue("slateBlue", new Color(6970061)),
|
||||
SlateGray("slateGray", new Color(7372944)),
|
||||
SpringGreen("springGreen", new Color(65407)),
|
||||
SteelBlue("steelBlue", new Color(4620980)),
|
||||
Tan("tan", new Color(13808780)),
|
||||
Teal("teal", new Color(32896)),
|
||||
Thistle("thistle", new Color(14204888)),
|
||||
Turquoise("turquoise", new Color(4251856)),
|
||||
Violet("violet", new Color(15631086)),
|
||||
Wheat("wheat", new Color(16113331)),
|
||||
White("white", new Color(16777215)),
|
||||
Yellow("yellow", new Color(16776960)),
|
||||
YellowGreen("yellowGreen", new Color(10145074));
|
||||
|
||||
public static final EnumFlowerColor[] VALUES = values();
|
||||
|
||||
private final String ident;
|
||||
private final IAlleleFlowerColor allele;
|
||||
|
||||
EnumFlowerColor(String ident, Color color) {
|
||||
this.ident = ident;
|
||||
int r = color.getRed();
|
||||
int g = color.getGreen();
|
||||
int b = color.getBlue();
|
||||
r = (int) (0.45 * (r + 214));
|
||||
g = (int) (0.45 * (g + 174));
|
||||
b = (int) (0.45 * (b + 131));
|
||||
Color colorWilted = new Color(r, g, b);
|
||||
String uid = "botany.color" + name();
|
||||
allele = BotanyAPI.flowerFactory.createFlowerColorAllele(uid, ordinal(), color, colorWilted, name().toLowerCase(), uid, true);
|
||||
}
|
||||
|
||||
public String getIdent() {
|
||||
return ident;
|
||||
}
|
||||
|
||||
public static EnumFlowerColor get(int i) {
|
||||
return values()[Math.max(0, i) % values().length];
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return I18n.translateToLocal("botany.color." + getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public IAlleleFlowerColor getFlowerColorAllele() {
|
||||
return allele;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -8,7 +8,7 @@ public enum EnumFlowerStage implements ISpeciesType {
|
||||
POLLEN("Pollen");
|
||||
|
||||
public static final EnumFlowerStage[] VALUES = values();
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
EnumFlowerStage(String name) {
|
||||
this.name = name;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,14 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface IFlowerFactory {
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(String modId, String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||
|
||||
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance);
|
||||
|
||||
IAlleleFlowerColor createFlowerColorAllele(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+4
-4
@@ -1,9 +1,9 @@
|
||||
archivesBaseName = 'botany-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":core")
|
||||
|
||||
// TODO: remove
|
||||
compile project(":extratrees")
|
||||
compile project(":botany-api")
|
||||
compile project(":extratrees-api")
|
||||
compile project(":genetics-api")
|
||||
compile project(":design")
|
||||
}
|
||||
@@ -1,29 +1,37 @@
|
||||
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.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.genetics.TolerancePh;
|
||||
import binnie.botany.genetics.gui.analyst.FlowerAnalystPagePlugin;
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.proxy.Proxy;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.modules.BlankModuleContainer;
|
||||
import binnie.core.modules.BotanyModuleUIDs;
|
||||
import binnie.core.modules.ModuleManager;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.core.modules.BlankModuleContainer;
|
||||
import binnie.genetics.api.GeneticsApi;
|
||||
import binnie.genetics.api.acclimatiser.IAcclimatiserManager;
|
||||
import binnie.genetics.api.analyst.IAnalystManager;
|
||||
|
||||
@Mod(
|
||||
modid = Constants.BOTANY_MOD_ID,
|
||||
name = "Binnie's Botany",
|
||||
dependencies = "required-after:" + Constants.CORE_MOD_ID
|
||||
acceptedMinecraftVersions = Constants.ACCEPTED_MINECRAFT_VERSIONS,
|
||||
dependencies = "required-after:" + Constants.CORE_MOD_ID + ";"
|
||||
+ "after:" + Constants.GENETICS_MOD_ID + ";"
|
||||
+ "after:" + Constants.DESIGN_MOD_ID + ";"
|
||||
)
|
||||
public class Botany extends BlankModuleContainer {
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
@@ -34,13 +42,24 @@ public class Botany extends BlankModuleContainer {
|
||||
@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);
|
||||
|
||||
IAnalystManager analystManager = GeneticsApi.analystManager;
|
||||
if (analystManager != null) {
|
||||
analystManager.registerAnalystPagePlugin(new FlowerAnalystPagePlugin());
|
||||
}
|
||||
|
||||
if(ModuleManager.isModuleEnabled(Constants.BOTANY_MOD_ID, BotanyModuleUIDs.FLOWERS)) {
|
||||
IAcclimatiserManager acclimatiserManager = GeneticsApi.acclimatiserManager;
|
||||
if (acclimatiserManager != null) {
|
||||
acclimatiserManager.addTolerance(EnumFlowerChromosome.HUMIDITY_TOLERANCE, acclimatiserManager.getHumidityToleranceType());
|
||||
acclimatiserManager.addTolerance(EnumFlowerChromosome.TEMPERATURE_TOLERANCE, acclimatiserManager.getTemperatureToleranceType());
|
||||
acclimatiserManager.addTolerance(EnumFlowerChromosome.PH_TOLERANCE, new TolerancePh());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
@@ -83,7 +102,7 @@ public class Botany extends BlankModuleContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
public String getModId() {
|
||||
return Constants.BOTANY_MOD_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CreativeTabBotany extends CreativeTabs {
|
||||
public static CreativeTabs instance = new CreativeTabBotany();
|
||||
public static final CreativeTabs INSTANCE = new CreativeTabBotany();
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegi
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setRegistryName("ceramic");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,7 +71,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setRegistryName("ceramicBrick");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,7 +170,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
ItemStack stack = placer.getHeldItem(hand);
|
||||
CeramicBrickPair pair = new CeramicBrickPair(stack);
|
||||
return getDefaultState().withProperty(TYPE, pair.type);
|
||||
return getDefaultState().withProperty(TYPE, pair.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,7 +178,7 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(worldIn, pos, TileCeramicBrick.class);
|
||||
if (ceramic != null) {
|
||||
CeramicBrickPair pair = new CeramicBrickPair(stack);
|
||||
ceramic.setColors(pair.colorFirst, pair.colorSecond);
|
||||
ceramic.setColors(pair.getColorFirst(), pair.getColorSecond());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,14 +249,16 @@ public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicB
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||
for (CeramicBrickType type : CeramicBrickType.VALUES) {
|
||||
type.sprites = new TextureAtlasSprite[3];
|
||||
TextureAtlasSprite[] sprites = new TextureAtlasSprite[3];
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
type.sprites[i] = textureMap.registerSprite(new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.id + "." + i));
|
||||
ResourceLocation location = new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.getId() + "." + i);
|
||||
sprites[i] = textureMap.registerSprite(location);
|
||||
}
|
||||
type.setSprites(sprites);
|
||||
}
|
||||
}
|
||||
|
||||
private class CeramicBrickMeshDefinition implements ItemMeshDefinition {
|
||||
private static class CeramicBrickMeshDefinition implements ItemMeshDefinition {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import binnie.design.DesignHelper;
|
||||
import binnie.design.blocks.BlockDesign;
|
||||
import binnie.design.blocks.DesignBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -7,10 +10,7 @@ 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;
|
||||
import binnie.extratrees.carpentry.DesignBlock;
|
||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||
import binnie.design.api.IDesign;
|
||||
|
||||
public class BlockCeramicPatterned extends BlockDesign {
|
||||
public BlockCeramicPatterned() {
|
||||
@@ -22,7 +22,7 @@ public class BlockCeramicPatterned extends BlockDesign {
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
||||
return DesignHelper.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import binnie.botany.tile.FlowerRenderInfo;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -153,7 +154,7 @@ public class BlockFlower extends BlockContainer implements IColoredBlock, IState
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = flowerRoot.getMember(stack);
|
||||
if (f != null) {
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
((TileEntityFlower) flower).setRender(new FlowerRenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
|
||||
public BlockPlant() {
|
||||
setRegistryName("plant");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setTickRandomly(true);
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
this.type = type;
|
||||
this.weedKilled = weedKilled;
|
||||
setUnlocalizedName("botany.soil." + type.getName());
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setRegistryName(blockName);
|
||||
setTickRandomly(true);
|
||||
setLightOpacity(255);
|
||||
|
||||
@@ -36,15 +36,15 @@ import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
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.block.BlockMetadata;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister {
|
||||
public BlockStainedGlass() {
|
||||
super(Material.GLASS);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setRegistryName("stained");
|
||||
setSoundType(SoundType.GLASS);
|
||||
setHardness(0.3F);
|
||||
|
||||
@@ -12,8 +12,8 @@ public enum PlantType implements IStringSerializable {
|
||||
DEAD_FLOWER("dead_flower"),
|
||||
DECAYING_FLOWER("decaying_flower");
|
||||
|
||||
String name;
|
||||
boolean isWeed;
|
||||
private final String name;
|
||||
private final boolean isWeed;
|
||||
|
||||
PlantType(String name) {
|
||||
this(name, false);
|
||||
|
||||
@@ -7,8 +7,8 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.design.api.IDesignMaterial;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial {
|
||||
private final static Map<EnumFlowerColor, CeramicColor> map = new LinkedHashMap<>();
|
||||
@@ -19,7 +19,7 @@ public class CeramicColor implements IDesignMaterial {
|
||||
}
|
||||
}
|
||||
|
||||
EnumFlowerColor color;
|
||||
private final EnumFlowerColor color;
|
||||
|
||||
CeramicColor(EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
@@ -48,4 +48,8 @@ public class CeramicColor implements IDesignMaterial {
|
||||
public int getColour() {
|
||||
return color.getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
|
||||
public int getMaterialIndex() {
|
||||
return color.ordinal();
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ 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;
|
||||
@@ -20,20 +18,19 @@ import binnie.botany.Botany;
|
||||
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.design.EnumPattern;
|
||||
import binnie.design.api.IDesignMaterial;
|
||||
import binnie.design.api.IDesignSystem;
|
||||
import binnie.design.api.IPattern;
|
||||
|
||||
public class CeramicDesignSystem implements IDesignSystem {
|
||||
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||
Map<Integer, TextureAtlasSprite> primary;
|
||||
Map<Integer, TextureAtlasSprite> secondary;
|
||||
public static final CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||
private final Map<Integer, TextureAtlasSprite> primary;
|
||||
private final Map<Integer, TextureAtlasSprite> secondary;
|
||||
|
||||
CeramicDesignSystem() {
|
||||
primary = new HashMap<>();
|
||||
secondary = new HashMap<>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,7 +50,7 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
|
||||
@Override
|
||||
public int getMaterialIndex(IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
return ((CeramicColor) id).getMaterialIndex();
|
||||
}
|
||||
|
||||
public String getTexturePath() {
|
||||
@@ -65,7 +62,7 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getPrimarySprite(IPattern pattern) {
|
||||
int index = pattern.getIndex();
|
||||
if (index > 0 && index < primary.size()) {
|
||||
if (index >= 0 && index < primary.size()) {
|
||||
return primary.get(index);
|
||||
}
|
||||
return null;
|
||||
@@ -76,7 +73,7 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSecondarySprite(IPattern pattern) {
|
||||
int index = pattern.getIndex();
|
||||
if (index > 0 && index < secondary.size()) {
|
||||
if (index >= 0 && index < secondary.size()) {
|
||||
return secondary.get(index);
|
||||
}
|
||||
return null;
|
||||
@@ -87,15 +84,15 @@ public class CeramicDesignSystem implements IDesignSystem {
|
||||
public void registerSprites() {
|
||||
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||
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");
|
||||
ResourceLocation primaryLocation = new ResourceLocation(getModId(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0");
|
||||
ResourceLocation secondaryLocation = new ResourceLocation(getModId(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1");
|
||||
primary.put(pattern.getIndex(), textureMap.registerSprite(primaryLocation));
|
||||
secondary.put(pattern.getIndex(), textureMap.registerSprite(secondaryLocation));
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
public String getModId() {
|
||||
return Botany.instance.getModId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,11 +17,11 @@ import binnie.core.util.I18N;
|
||||
public class CeramicBrickPair {
|
||||
public static final CeramicBrickPair EMPTY = new CeramicBrickPair(EnumFlowerColor.DarkSeaGreen, EnumFlowerColor.DarkSeaGreen, CeramicBrickType.TILE);
|
||||
|
||||
public final EnumFlowerColor colorFirst;
|
||||
public final EnumFlowerColor colorSecond;
|
||||
private final EnumFlowerColor colorFirst;
|
||||
private final EnumFlowerColor colorSecond;
|
||||
|
||||
public CeramicBrickType type;
|
||||
public int ordinal;
|
||||
private CeramicBrickType type;
|
||||
private int ordinal;
|
||||
|
||||
public CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
this.colorFirst = colorFirst;
|
||||
@@ -63,7 +63,7 @@ public class CeramicBrickPair {
|
||||
if (type.canDouble() && colorSecond != colorFirst) {
|
||||
name = name + " & " + colorSecond.getFlowerColorAllele().getColorName();
|
||||
}
|
||||
return I18N.localise("botany.ceramic.type." + type.id + ".name", name);
|
||||
return I18N.localise("botany.ceramic.type." + type.getId() + ".name", name);
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
@@ -72,7 +72,7 @@ public class CeramicBrickPair {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite(int pass) {
|
||||
TextureAtlasSprite[] sprites = type.sprites;
|
||||
TextureAtlasSprite[] sprites = type.getSprites();
|
||||
Preconditions.checkState(sprites != null, "Sprites have not been registered.");
|
||||
return sprites[pass];
|
||||
}
|
||||
@@ -87,4 +87,20 @@ public class CeramicBrickPair {
|
||||
return obj instanceof CeramicBrickPair
|
||||
&& ((CeramicBrickPair) obj).type == type;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColorFirst() {
|
||||
return colorFirst;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColorSecond() {
|
||||
return colorSecond;
|
||||
}
|
||||
|
||||
public CeramicBrickType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(CeramicBrickType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
|
||||
public enum CeramicBrickType implements IStringSerializable {
|
||||
TILE("tile") {
|
||||
@@ -69,8 +69,8 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
if (stacks.size() == 1) {
|
||||
ItemStack stack3 = stacks.get(0);
|
||||
CeramicBrickPair type3 = new CeramicBrickPair(stack3);
|
||||
if (type3.type == CeramicBrickType.VERTICAL_LARGE_BRICK) {
|
||||
type3.type = this;
|
||||
if (type3.getType() == CeramicBrickType.VERTICAL_LARGE_BRICK) {
|
||||
type3.setType(this);
|
||||
return type3.getStack(1);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
@@ -86,10 +86,10 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||
if (type4.type != CeramicBrickType.TILE) {
|
||||
if (type4.getType() != CeramicBrickType.TILE) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color5 = type4.colorFirst.ordinal();
|
||||
int color5 = type4.getColorFirst().ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color5;
|
||||
a++;
|
||||
@@ -126,10 +126,10 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack2);
|
||||
if (type.type != CeramicBrickType.TILE) {
|
||||
if (type.getType() != CeramicBrickType.TILE) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color2 = type.colorFirst.ordinal();
|
||||
int color2 = type.getColorFirst().ordinal();
|
||||
if (colors[alt] == -1) {
|
||||
colors[alt] = color2;
|
||||
} else if (colors[alt] != color2) {
|
||||
@@ -152,11 +152,11 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
if (type2.type != CeramicBrickType.SPLIT) {
|
||||
if (type2.getType() != CeramicBrickType.SPLIT) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color3 = type2.colorFirst.ordinal();
|
||||
int color4 = type2.colorSecond.ordinal();
|
||||
int color3 = type2.getColorFirst().ordinal();
|
||||
int color4 = type2.getColorSecond().ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
colors[1] = color4;
|
||||
@@ -184,14 +184,14 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
if (type2.isTwoColors()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color3 = type2.colorFirst.ordinal();
|
||||
if (type2.type == CeramicBrickType.SPLIT) {
|
||||
int color3 = type2.getColorFirst().ordinal();
|
||||
if (type2.getType() == CeramicBrickType.SPLIT) {
|
||||
if (colors[1] != -1) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
colors[1] = color3;
|
||||
} else {
|
||||
if (type2.type != CeramicBrickType.CHEQUERED) {
|
||||
if (type2.getType() != CeramicBrickType.CHEQUERED) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
if (colors[0] == -1) {
|
||||
@@ -200,7 +200,7 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
int color4 = type2.colorSecond.ordinal();
|
||||
int color4 = type2.getColorSecond().ordinal();
|
||||
}
|
||||
if (colors[0] == -1 || colors[1] == -1) {
|
||||
return ItemStack.EMPTY;
|
||||
@@ -229,11 +229,11 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
|
||||
public static final CeramicBrickType[] VALUES = values();
|
||||
|
||||
public String id;
|
||||
private final String id;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
public TextureAtlasSprite[] sprites;
|
||||
private TextureAtlasSprite[] sprites;
|
||||
|
||||
CeramicBrickType(String id) {
|
||||
this.id = id;
|
||||
@@ -255,18 +255,18 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
ItemStack stack5 = stacks.get(0);
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack5);
|
||||
if (type.type == CeramicBrickType.LARGE_BRICK) {
|
||||
type.type = CeramicBrickType.VERTICAL_LARGE_BRICK;
|
||||
if (type.getType() == CeramicBrickType.LARGE_BRICK) {
|
||||
type.setType(CeramicBrickType.VERTICAL_LARGE_BRICK);
|
||||
return type.getStack(1);
|
||||
}
|
||||
|
||||
if (type.type == CeramicBrickType.BRICK) {
|
||||
type.type = CeramicBrickType.VERTICAL_BRICK;
|
||||
if (type.getType() == CeramicBrickType.BRICK) {
|
||||
type.setType(CeramicBrickType.VERTICAL_BRICK);
|
||||
return type.getStack(1);
|
||||
}
|
||||
|
||||
if (type.type == CeramicBrickType.STRIPE_BRICK) {
|
||||
type.type = CeramicBrickType.VERTICAL_STRIPE_BRICK;
|
||||
if (type.getType() == CeramicBrickType.STRIPE_BRICK) {
|
||||
type.setType(CeramicBrickType.VERTICAL_STRIPE_BRICK);
|
||||
return type.getStack(1);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
@@ -276,13 +276,13 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
if (stacks.size() == 1) {
|
||||
ItemStack stack5 = stacks.get(0);
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack5);
|
||||
if (type.type == CeramicBrickType.VERTICAL_BRICK) {
|
||||
type.type = ceramicType;
|
||||
if (type.getType() == CeramicBrickType.VERTICAL_BRICK) {
|
||||
type.setType(ceramicType);
|
||||
return type.getStack(1);
|
||||
}
|
||||
|
||||
if (type.type == CeramicBrickType.STRIPE_BRICK) {
|
||||
type.type = ceramicType;
|
||||
if (type.getType() == CeramicBrickType.STRIPE_BRICK) {
|
||||
type.setType(ceramicType);
|
||||
return type.getStack(1);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
@@ -295,12 +295,12 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
}
|
||||
|
||||
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||
if (type4.type != CeramicBrickType.LARGE_BRICK) {
|
||||
if (type4.getType() != CeramicBrickType.LARGE_BRICK) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
int color5 = type4.colorFirst.ordinal();
|
||||
int color6 = type4.colorSecond.ordinal();
|
||||
int color5 = type4.getColorFirst().ordinal();
|
||||
int color6 = type4.getColorSecond().ordinal();
|
||||
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
||||
if (ceramicType == CeramicBrickType.STRIPE_BRICK) {
|
||||
alt2 = 0;
|
||||
@@ -326,4 +326,19 @@ public enum CeramicBrickType implements IStringSerializable {
|
||||
public String getName() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite[] getSprites() {
|
||||
return sprites;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setSprites(TextureAtlasSprite[] sprites) {
|
||||
this.sprites = sprites;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import binnie.core.util.I18N;
|
||||
|
||||
public class CircuitGarden extends BinnieCircuit {
|
||||
private boolean isManual;
|
||||
private GardenLogic logic;
|
||||
private final GardenLogic logic;
|
||||
|
||||
public CircuitGarden(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
|
||||
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraft.world.World;
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
|
||||
public abstract class FarmLogic implements IFarmLogic {
|
||||
boolean isManual;
|
||||
private boolean isManual;
|
||||
|
||||
@Override
|
||||
public IFarmLogic setManual(boolean flag) {
|
||||
@@ -46,4 +46,8 @@ public abstract class FarmLogic implements IFarmLogic {
|
||||
protected final void setBlock(World world, BlockPos pos, Block block, int meta) {
|
||||
world.setBlockState(pos, block.getStateFromMeta(meta), 2);
|
||||
}
|
||||
|
||||
public boolean isManual() {
|
||||
return isManual;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import forestry.api.farming.ICrop;
|
||||
|
||||
public class FlowerCrop implements ICrop {
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
BlockPos position;
|
||||
private final NonNullList<ItemStack> drops = NonNullList.create();
|
||||
private final BlockPos position;
|
||||
|
||||
public FlowerCrop(BlockPos pos, ItemStack... drops) {
|
||||
Collections.addAll(this.drops, drops);
|
||||
|
||||
@@ -43,17 +43,17 @@ import binnie.botany.tile.TileEntityFlower;
|
||||
import binnie.core.liquid.ManagerLiquid;
|
||||
|
||||
public class GardenLogic extends FarmLogic {
|
||||
List<IFarmable> farmables;
|
||||
private EnumMoisture moisture;
|
||||
private final List<IFarmable> farmables;
|
||||
private final EnumMoisture moisture;
|
||||
@Nullable
|
||||
private EnumAcidity acidity;
|
||||
private boolean fertilised;
|
||||
private String name;
|
||||
private final EnumAcidity acidity;
|
||||
private final boolean fertilised;
|
||||
private final String name;
|
||||
private NonNullList<ItemStack> produce;
|
||||
private ItemStack icon;
|
||||
|
||||
public GardenLogic(EnumMoisture moisture, @Nullable EnumAcidity acidity, boolean isManual, boolean isFertilised, ItemStack icon, String name) {
|
||||
this.isManual = isManual;
|
||||
this.setManual(isManual);
|
||||
this.moisture = moisture;
|
||||
this.acidity = acidity;
|
||||
this.fertilised = isFertilised;
|
||||
@@ -96,7 +96,7 @@ public class GardenLogic extends FarmLogic {
|
||||
@Override
|
||||
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
|
||||
return maintainSoil(world, pos, direction, extent, farmHousing) ||
|
||||
(!isManual && maintainWater(world, pos, direction, extent, farmHousing)) ||
|
||||
(!isManual() && maintainWater(world, pos, direction, extent, farmHousing)) ||
|
||||
maintainCrops(world, pos.up(), direction, extent, farmHousing);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class GardenLogic extends FarmLogic {
|
||||
setBlock(world, position, Blocks.AIR, 0);
|
||||
return trySetSoil(world, position, loam, housing);
|
||||
}
|
||||
} else if (!isManual) {
|
||||
} else if (!isManual()) {
|
||||
if (!isWaterBlock(world, position)) {
|
||||
if (i % 2 == 0) {
|
||||
return trySetSoil(world, position, housing);
|
||||
@@ -317,13 +317,18 @@ public class GardenLogic extends FarmLogic {
|
||||
|
||||
@Override
|
||||
public Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent) {
|
||||
if (isManual) {
|
||||
if (isManual()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return farmables.stream().map(farmable -> farmable.getCropAt(world, pos.up(), world.getBlockState(pos.up())))
|
||||
.filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData) {
|
||||
// all {@link IBlockSoil} are soil, and nothing else
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureMap() {
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
|
||||
+18
-16
@@ -1,25 +1,27 @@
|
||||
package binnie.botany.api.genetics;
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import binnie.botany.api.genetics.IAlleleFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
// TODO: move out of API
|
||||
public class AlleleFlowerColor implements IAlleleFlowerColor {
|
||||
private int color;
|
||||
private String uid;
|
||||
private boolean isDominant;
|
||||
private String name;
|
||||
private String unlocalizedName;
|
||||
private int colorDis;
|
||||
private int id;
|
||||
private final int color;
|
||||
private final String uid;
|
||||
private final boolean isDominant;
|
||||
private final String name;
|
||||
private final String unlocalizedName;
|
||||
private final int colorWilted;
|
||||
private final int id;
|
||||
|
||||
public AlleleFlowerColor(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
|
||||
this.color = color;
|
||||
public AlleleFlowerColor(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant) {
|
||||
this.color = color.getRGB();
|
||||
this.uid = uid;
|
||||
this.isDominant = isDominant;
|
||||
this.name = name;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.colorDis = colorDis;
|
||||
this.colorWilted = colorWilted.getRGB();
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -54,8 +56,8 @@ public class AlleleFlowerColor implements IAlleleFlowerColor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(boolean dis) {
|
||||
return dis ? colorDis : color;
|
||||
public int getColor(boolean wilted) {
|
||||
return wilted ? colorWilted : color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,6 +72,6 @@ public class AlleleFlowerColor implements IAlleleFlowerColor {
|
||||
|
||||
@Override
|
||||
public String getColorName() {
|
||||
return I18n.translateToLocal("botany.color." + getAlleleName());
|
||||
return I18N.localise("botany.color." + getAlleleName());
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,4 +1,7 @@
|
||||
package binnie.botany.api.genetics;
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
|
||||
public final class ColorMix implements IColorMix {
|
||||
private final IFlowerColor colorFirst;
|
||||
@@ -67,10 +67,10 @@ public enum EnumFlowerType implements IFlowerType<EnumFlowerType> {
|
||||
public static EnumFlowerType[] VALUES = values();
|
||||
public static int highestSection = 2;
|
||||
|
||||
int sections;
|
||||
ModelResourceLocation flower;
|
||||
ModelResourceLocation seed;
|
||||
ModelResourceLocation pollen;
|
||||
private final int sections;
|
||||
private ModelResourceLocation flower;
|
||||
private ModelResourceLocation seed;
|
||||
private ModelResourceLocation pollen;
|
||||
|
||||
EnumFlowerType() {
|
||||
this(1);
|
||||
|
||||
@@ -25,10 +25,10 @@ import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class Flower extends Individual implements IFlower {
|
||||
public IFlowerGenome genome;
|
||||
private final IFlowerGenome genome;
|
||||
|
||||
@Nullable
|
||||
public IFlowerGenome mate;
|
||||
private IFlowerGenome mate;
|
||||
|
||||
private int age;
|
||||
private boolean wilting;
|
||||
|
||||
@@ -51,11 +51,11 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
|
||||
EnumFlowerChromosome.PH_TOLERANCE
|
||||
};
|
||||
private int lastTopOffset;
|
||||
private int rowSize = 12;
|
||||
private int margin = 10;
|
||||
private final int rowSize = 12;
|
||||
private final int margin = 10;
|
||||
private int guiLeft;
|
||||
private int guiTop;
|
||||
private HashMap<String, ItemStack> iconStacks = new HashMap<>();
|
||||
private final HashMap<String, ItemStack> iconStacks = new HashMap<>();
|
||||
|
||||
|
||||
public FlowerAlyzerPlugin() {
|
||||
@@ -65,10 +65,12 @@ public class FlowerAlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawLine(GuiScreen gui, int xOffset, String msg, int color) {
|
||||
gui.mc.fontRenderer.drawString(msg, guiLeft + xOffset, guiTop + lastTopOffset + margin, color);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawChromosome(GuiScreen gui, EnumFlowerChromosome chromosome, IFlower flower) {
|
||||
drawLine(gui, COLUMN_0, StringUtils.capitalize(chromosome.getName()), 0xEEEEEE);
|
||||
drawLine(gui, COLUMN_1, I18N.localise(flower.getGenome().getActiveAllele(chromosome).getUnlocalizedName()), 0xEEEEEE);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -16,14 +16,22 @@ import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
import binnie.core.Binnie;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IBotanistTracker;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.Binnie;
|
||||
import binnie.core.api.genetics.IFieldKitPlugin;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.ForestryAllele;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.resource.textures.StandardTexture;
|
||||
import binnie.core.texture.BinnieCoreTexture;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class FlowerBreedingSystem extends BreedingSystem {
|
||||
@@ -136,4 +144,34 @@ public class FlowerBreedingSystem extends BreedingSystem {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFieldKitPlugin getFieldKitPlugin() {
|
||||
return new FieldKitPlugin();
|
||||
}
|
||||
|
||||
private static class FieldKitPlugin implements IFieldKitPlugin {
|
||||
@Override
|
||||
public Map<IChromosomeType, IPoint> getChromosomePickerPositions() {
|
||||
Map<IChromosomeType, IPoint> positions = new HashMap<>();
|
||||
positions.put(EnumFlowerChromosome.SPECIES, new Point(35, 81));
|
||||
positions.put(EnumFlowerChromosome.PRIMARY, new Point(36, 28));
|
||||
positions.put(EnumFlowerChromosome.SECONDARY, new Point(27, 13));
|
||||
positions.put(EnumFlowerChromosome.FERTILITY, new Point(47, 15));
|
||||
positions.put(EnumFlowerChromosome.TERRITORY, new Point(54, 31));
|
||||
positions.put(EnumFlowerChromosome.EFFECT, new Point(15, 55));
|
||||
positions.put(EnumFlowerChromosome.LIFESPAN, new Point(23, 38));
|
||||
positions.put(EnumFlowerChromosome.TEMPERATURE_TOLERANCE, new Point(17, 77));
|
||||
positions.put(EnumFlowerChromosome.HUMIDITY_TOLERANCE, new Point(52, 51));
|
||||
positions.put(EnumFlowerChromosome.PH_TOLERANCE, new Point(54, 80));
|
||||
positions.put(EnumFlowerChromosome.SAPPINESS, new Point(41, 42));
|
||||
positions.put(EnumFlowerChromosome.STEM, new Point(37, 63));
|
||||
return positions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITexture getTypeTexture() {
|
||||
return new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-131
@@ -1,122 +1,22 @@
|
||||
package binnie.botany.api.genetics;
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import static binnie.botany.api.genetics.EnumFlowerColor.*;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
public final class FlowerColorMutations {
|
||||
private FlowerColorMutations() {
|
||||
|
||||
//TODO: Clean Up, move out of API
|
||||
public enum EnumFlowerColor implements IStringSerializable {
|
||||
Aquamarine("aquamarine", 8388564),
|
||||
Black("black", 2631720),
|
||||
Blue("blue", 255),
|
||||
Brown("brown", 10824234),
|
||||
CadetBlue("cadetBlue", 6266528),
|
||||
Chocolate("chocolate", 13789470),
|
||||
Coral("coral", 16744272),
|
||||
Crimson("crimson", 14423100),
|
||||
Cyan("cyan", 65535),
|
||||
DarkGoldenrod("darkGoldenrod", 12092939),
|
||||
DarkGray("darkGray", 11119017),
|
||||
DarkGreen("darkGreen", 25600),
|
||||
DarkKhaki("darkKhaki", 12433259),
|
||||
DarkOliveGreen("darkOliveGreen", 5597999),
|
||||
DarkOrange("darkOrange", 16747520),
|
||||
DarkSalmon("darkSalmon", 15308410),
|
||||
DarkSeaGreen("darkSeaGreen", 9419915),
|
||||
DarkSlateBlue("darkSlateBlue", 4734347),
|
||||
DarkSlateGray("darkSlateGray", 3100495),
|
||||
DarkTurquoise("darkTurquoise", 52945),
|
||||
DarkViolet("darkViolet", 9699539),
|
||||
DeepPink("deepPink", 16716947),
|
||||
DeepSkyBlue("deepSkyBlue", 49151),
|
||||
DimGray("dimGray", 6908265),
|
||||
DodgerBlue("dodgerBlue", 2003199),
|
||||
Gold("gold", 16766720),
|
||||
Goldenrod("goldenrod", 14329120),
|
||||
Gray("gray", 8421504),
|
||||
Green("green", 32768),
|
||||
HotPink("hotPink", 16738740),
|
||||
IndianRed("indianRed", 13458524),
|
||||
Indigo("indigo", 4915330),
|
||||
Khaki("khaki", 15787660),
|
||||
Lavender("lavender", 15132410),
|
||||
LemonChiffon("lemonChiffon", 16775885),
|
||||
LightGray("lightGray", 13882323),
|
||||
LightSeaGreen("lightSeaGreen", 2142890),
|
||||
LightSteelBlue("lightSteelBlue", 11584734),
|
||||
Lime("lime", 65280),
|
||||
LimeGreen("limeGreen", 3329330),
|
||||
Magenta("magenta", 16711935),
|
||||
Maroon("maroon", 8388608),
|
||||
MediumAquamarine("mediumAquamarine", 6737322),
|
||||
MediumOrchid("mediumOrchid", 12211667),
|
||||
MediumPurple("mediumPurple", 9662683),
|
||||
MediumSeaGreen("mediumSeaGreen", 3978097),
|
||||
MediumVioletRed("mediumVioletRed", 13047173),
|
||||
MistyRose("mistyRose", 16770273),
|
||||
Navy("navy", 128),
|
||||
Olive("olive", 8421376),
|
||||
OliveDrab("oliveDrab", 7048739),
|
||||
Orange("orange", 16753920),
|
||||
PaleGreen("paleGreen", 10025880),
|
||||
PaleTurquoise("paleTurquoise", 11529966),
|
||||
PaleVioletRed("paleVioletRed", 14381203),
|
||||
Peru("peru", 13468991),
|
||||
Pink("pink", 16761035),
|
||||
Plum("plum", 14524637),
|
||||
Purple("purple", 8388736),
|
||||
Red("red", 16711680),
|
||||
RosyBrown("rosyBrown", 12357519),
|
||||
RoyalBlue("royalBlue", 4286945),
|
||||
Salmon("salmon", 16416882),
|
||||
SandyBrown("sandyBrown", 16032864),
|
||||
SeaGreen("seaGreen", 3050327),
|
||||
Sienna("sienna", 10506797),
|
||||
SkyBlue("skyBlue", 8900331),
|
||||
SlateBlue("slateBlue", 6970061),
|
||||
SlateGray("slateGray", 7372944),
|
||||
SpringGreen("springGreen", 65407),
|
||||
SteelBlue("steelBlue", 4620980),
|
||||
Tan("tan", 13808780),
|
||||
Teal("teal", 32896),
|
||||
Thistle("thistle", 14204888),
|
||||
Turquoise("turquoise", 4251856),
|
||||
Violet("violet", 15631086),
|
||||
Wheat("wheat", 16113331),
|
||||
White("white", 16777215),
|
||||
Yellow("yellow", 16776960),
|
||||
YellowGreen("yellowGreen", 10145074);
|
||||
|
||||
public static final EnumFlowerColor[] VALUES = values();
|
||||
|
||||
private final String ident;
|
||||
private IAlleleFlowerColor allele;
|
||||
|
||||
EnumFlowerColor(String ident, int color) {
|
||||
this.ident = ident;
|
||||
int r = color >> 16 & 0xFF;
|
||||
int g = color >> 8 & 0xFF;
|
||||
int b = color & 0xFF;
|
||||
r = (int) (0.45 * (r + 214));
|
||||
g = (int) (0.45 * (g + 174));
|
||||
b = (int) (0.45 * (b + 131));
|
||||
int colorDis = (r << 16) + (g << 8) + b;
|
||||
String uid = "botany.color" + name();
|
||||
allele = new AlleleFlowerColor(uid, ordinal(), color, colorDis, name().toLowerCase(), uid, true);
|
||||
}
|
||||
|
||||
public String getIdent() {
|
||||
return ident;
|
||||
public static void registerFlowerColorAlleles() {
|
||||
for (EnumFlowerColor color : values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getFlowerColorAllele());
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMix(EnumFlowerColor start1, EnumFlowerColor start2, EnumFlowerColor result, int chance) {
|
||||
BotanyAPI.flowerRoot.registerColourMix(new ColorMix(start1.allele, start2.allele, result.allele, chance));
|
||||
}
|
||||
|
||||
public static void setupMutations() {
|
||||
public static void registerFlowerColorMutations() {
|
||||
addMix(Blue, Aquamarine, SteelBlue, 55);
|
||||
addMix(Blue, Black, Navy, 85);
|
||||
addMix(Brown, Aquamarine, Gray, 50);
|
||||
@@ -2934,26 +2834,8 @@ public enum EnumFlowerColor implements IStringSerializable {
|
||||
addMix(YellowGreen, Yellow, Khaki, 110);
|
||||
}
|
||||
|
||||
public static void initColours() {
|
||||
for (EnumFlowerColor color : values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.allele);
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumFlowerColor get(int i) {
|
||||
return values()[Math.max(0, i) % values().length];
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return I18n.translateToLocal("botany.color." + getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public IAlleleFlowerColor getFlowerColorAllele() {
|
||||
return allele;
|
||||
private static void addMix(EnumFlowerColor start1, EnumFlowerColor start2, EnumFlowerColor result, int chance) {
|
||||
ColorMix colorMix = new ColorMix(start1.getFlowerColorAllele(), start2.getFlowerColorAllele(), result.getFlowerColorAllele(), chance);
|
||||
BotanyAPI.flowerRoot.registerColourMix(colorMix);
|
||||
}
|
||||
}
|
||||
@@ -944,14 +944,15 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
|
||||
public static FlowerDefinition[] VALUES = values();
|
||||
private final IAlleleFlowerSpecies species;
|
||||
IFlowerType<EnumFlowerType> type;
|
||||
String name;
|
||||
String binomial;
|
||||
String branchName;
|
||||
List<IAllele[]> variantTemplates;
|
||||
private final IFlowerType<EnumFlowerType> type;
|
||||
private final String name;
|
||||
private final String binomial;
|
||||
private final String branchName;
|
||||
private final List<IAllele[]> variantTemplates;
|
||||
@Nullable
|
||||
IClassification branch;
|
||||
EnumFlowerColor primaryColor, secondaryColor;
|
||||
private IClassification branch;
|
||||
private final EnumFlowerColor primaryColor;
|
||||
private final EnumFlowerColor secondaryColor;
|
||||
private IAllele[] template;
|
||||
private IFlowerGenome genome;
|
||||
|
||||
@@ -964,7 +965,8 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
}
|
||||
|
||||
FlowerDefinition(String name, String branch, String binomial, IFlowerType<EnumFlowerType> flowerType, boolean isDominant, EnumFlowerColor primaryColor, EnumFlowerColor secondaryColor) {
|
||||
String uid = Constants.BOTANY_MOD_ID + ".flower" + this;
|
||||
String modId = Constants.BOTANY_MOD_ID;
|
||||
String uid = modId + ".flower" + this;
|
||||
String unlocalizedDescription = "botany.description.flower" + this;
|
||||
String unlocalizedName = "botany.flowers.species." + name;
|
||||
|
||||
@@ -976,7 +978,7 @@ public enum FlowerDefinition implements IFlowerDefinition {
|
||||
this.primaryColor = primaryColor;
|
||||
this.secondaryColor = secondaryColor;
|
||||
|
||||
IAlleleFlowerSpeciesBuilder speciesBuilder = BotanyAPI.flowerFactory.createSpecies(uid, unlocalizedName, "Binnie's Mod Team", unlocalizedDescription, isDominant, getBranch(), binomial, flowerType);
|
||||
IAlleleFlowerSpeciesBuilder speciesBuilder = BotanyAPI.flowerFactory.createSpecies(modId, uid, unlocalizedName, "Binnie's Mod Team", unlocalizedDescription, isDominant, getBranch(), binomial, flowerType);
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
species = speciesBuilder.build();
|
||||
if (this.branch != null) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import binnie.botany.api.genetics.IAlleleFlowerColor;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
@@ -14,9 +17,9 @@ import binnie.botany.models.FlowerSpriteManager;
|
||||
|
||||
public class FlowerFactory implements IFlowerFactory {
|
||||
@Override
|
||||
public IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType) {
|
||||
public IAlleleFlowerSpeciesBuilder createSpecies(String modId, String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType) {
|
||||
FlowerSpriteManager.initSprites(flowerType);
|
||||
return new AlleleFlowerSpecies(uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial, flowerType);
|
||||
return new AlleleFlowerSpecies(modId, uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial, flowerType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,4 +28,9 @@ public class FlowerFactory implements IFlowerFactory {
|
||||
BotanyAPI.flowerRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerColor createFlowerColorAllele(String uid, int id, Color color, Color colorWilted, String name, String unlocalizedName, boolean isDominant) {
|
||||
return new AlleleFlowerColor(uid, id, color, colorWilted, name, unlocalizedName, isDominant);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.api.genetics.AlleleFlowerColor;
|
||||
|
||||
public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
||||
|
||||
@@ -42,12 +42,12 @@ import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
|
||||
public class FlowerRoot extends SpeciesRoot implements IFlowerRoot {
|
||||
static final String UID = "rootFlowers";
|
||||
public static int flowerSpeciesCount = -1;
|
||||
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||
private static ArrayList<IColorMix> colourMixes = new ArrayList<>();
|
||||
Map<ItemStack, IFlower> conversions;
|
||||
private static final String UID = "rootFlowers";
|
||||
private static int flowerSpeciesCount = -1;
|
||||
private static final ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||
private static final ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||
private static final ArrayList<IColorMix> colourMixes = new ArrayList<>();
|
||||
private final Map<ItemStack, IFlower> conversions;
|
||||
|
||||
public FlowerRoot() {
|
||||
conversions = new HashMap<>();
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.gardening.EnumFertiliserType;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.genetics.api.acclimatiser.IToleranceType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TolerancePh implements IToleranceType {
|
||||
@Override
|
||||
public float getEffect(ItemStack stack) {
|
||||
IGardeningManager gardening = BotanyAPI.gardening;
|
||||
if (gardening.isFertiliser(EnumFertiliserType.ACID, stack)) {
|
||||
return -0.5f * gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
if (gardening.isFertiliser(EnumFertiliserType.ALKALINE, stack)) {
|
||||
return 0.5f * gardening.getFertiliserStrength(stack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS
|
||||
private EnumMoisture moisture = EnumMoisture.NORMAL;
|
||||
|
||||
public AlleleFlowerSpecies(
|
||||
String modId,
|
||||
String uid,
|
||||
String unlocalizedName,
|
||||
String authority,
|
||||
@@ -35,7 +36,7 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS
|
||||
IClassification branch,
|
||||
String binomial,
|
||||
IFlowerType flowerType) {
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial);
|
||||
super(modId, uid, unlocalizedName, authority, unlocalizedDescription, isDominant, branch, binomial);
|
||||
this.flowerType = flowerType;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package binnie.botany.genetics.gui.analyst;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.ITitledWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.gui.database.ControlColorDisplay;
|
||||
import binnie.botany.models.FlowerSpriteManager;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.minecraft.control.ControlIconDisplay;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.genetics.api.analyst.AnalystConstants;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class AnalystPageAppearance extends Control implements ITitledWidget {
|
||||
public AnalystPageAppearance(IWidget parent, IArea area, IFlower flower) {
|
||||
super(parent, area);
|
||||
setColor(3355443);
|
||||
int y = 4;
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
IAlleleSpecies species = genome.getPrimary();
|
||||
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 12;
|
||||
ControlColorDisplay a = new ControlColorDisplay(this, getWidth() / 2 - 28, y, genome.getPrimaryColor());
|
||||
a.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".primary"));
|
||||
ControlColorDisplay b = new ControlColorDisplay(this, getWidth() / 2 - 8, y, genome.getSecondaryColor());
|
||||
b.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".secondary"));
|
||||
ControlColorDisplay c = new ControlColorDisplay(this, getWidth() / 2 + 12, y, genome.getStemColor());
|
||||
c.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".stem"));
|
||||
y += 26;
|
||||
IFlowerType type = genome.getType();
|
||||
int sections = type.getSections();
|
||||
int width = (sections > 1) ? 50 : 100;
|
||||
new FlowerIconDisplay(this, width, y, sections, flower, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise(AnalystConstants.APPEARANCE_KEY + ".title");
|
||||
}
|
||||
|
||||
private static class FlowerIconDisplay extends ControlIconDisplay {
|
||||
private final int width;
|
||||
private final int sections;
|
||||
private final IFlower flower;
|
||||
private final IFlowerType type;
|
||||
|
||||
public FlowerIconDisplay(AnalystPageAppearance analystPageAppearance, int width, int y, int sections, IFlower flower, IFlowerType type) {
|
||||
super(analystPageAppearance, (analystPageAppearance.getWidth() - width) / 2, y - ((sections == 1) ? 0 : 0));
|
||||
this.width = width;
|
||||
this.sections = sections;
|
||||
this.flower = flower;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
GlStateManager.pushMatrix();
|
||||
float scale = width / 16.0f;
|
||||
int dy = (sections > 1) ? 16 : 0;
|
||||
GlStateManager.scale(scale, scale, 1.0f);
|
||||
RenderUtil.setColour(flower.getGenome().getStemColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
RenderUtil.drawSprite(Point.ZERO, FlowerSpriteManager.getStem(type, 1, true));
|
||||
}
|
||||
RenderUtil.drawSprite(new Point(0, dy), FlowerSpriteManager.getStem(type, 0, true));
|
||||
RenderUtil.setColour(flower.getGenome().getPrimaryColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
RenderUtil.drawSprite(Point.ZERO, FlowerSpriteManager.getPetal(type, 1, true));
|
||||
}
|
||||
RenderUtil.drawSprite(new Point(0, dy), FlowerSpriteManager.getPetal(type, 0, true));
|
||||
RenderUtil.setColour(flower.getGenome().getSecondaryColor().getColor(false));
|
||||
if (sections > 1) {
|
||||
RenderUtil.drawSprite(Point.ZERO, FlowerSpriteManager.getVariant(type, 1, true));
|
||||
}
|
||||
RenderUtil.drawSprite(new Point(0, dy), FlowerSpriteManager.getVariant(type, 0, true));
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
-32
@@ -1,31 +1,32 @@
|
||||
package binnie.genetics.gui.analyst.flower;
|
||||
package binnie.botany.genetics.gui.analyst;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.blocks.BlockSoil;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.ITitledWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.gui.controls.ControlToleranceBar;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.TextJustification;
|
||||
import binnie.core.gui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.genetics.gui.analyst.AnalystConstants;
|
||||
import binnie.genetics.gui.analyst.ControlAnalystPage;
|
||||
import binnie.genetics.gui.analyst.ControlToleranceBar;
|
||||
import binnie.genetics.api.analyst.AnalystConstants;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
public class AnalystPageSoil extends ControlAnalystPage {
|
||||
public AnalystPageSoil(IWidget parent, Area area, IFlower flower) {
|
||||
public class AnalystPageSoil extends Control implements ITitledWidget {
|
||||
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
|
||||
super(parent, area);
|
||||
setColor(6697728);
|
||||
EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
|
||||
@@ -107,35 +108,47 @@ public class AnalystPageSoil extends ControlAnalystPage {
|
||||
}
|
||||
|
||||
protected void createMoisture(IWidget parent, int x, int y, int w, int h, EnumMoisture value, forestry.api.genetics.EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumMoisture>(parent, x, y, w, h, EnumMoisture.class) {
|
||||
@Override
|
||||
protected String getName(EnumMoisture value) {
|
||||
return value.getLocalisedName(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColour(EnumMoisture value) {
|
||||
return (new int[]{13434828, 6737151, 3368703})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
new MoistureBar(parent, x, y, w, h).setValues(value, tol);
|
||||
}
|
||||
|
||||
protected void createAcidity(IWidget parent, int x, int y, int w, int h, EnumAcidity value, forestry.api.genetics.EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumAcidity>(parent, x, y, w, h, EnumAcidity.class) {
|
||||
@Override
|
||||
protected String getName(EnumAcidity value) {
|
||||
return value.getLocalisedName(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColour(EnumAcidity value) {
|
||||
return (new int[]{16711782, 65280, 26367})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
new AcidityBar(parent, x, y, w, h).setValues(value, tol);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return I18N.localise(AnalystConstants.SOIL_KEY + ".title");
|
||||
}
|
||||
|
||||
private static class MoistureBar extends ControlToleranceBar<EnumMoisture> {
|
||||
public MoistureBar(IWidget parent, int x, int y, int w, int h) {
|
||||
super(parent, x, y, w, h, EnumMoisture.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName(EnumMoisture value) {
|
||||
return value.getLocalisedName(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColour(EnumMoisture value) {
|
||||
return (new int[]{13434828, 6737151, 3368703})[value.ordinal()];
|
||||
}
|
||||
}
|
||||
|
||||
private static class AcidityBar extends ControlToleranceBar<EnumAcidity> {
|
||||
public AcidityBar(IWidget parent, int x, int y, int w, int h) {
|
||||
super(parent, x, y, w, h, EnumAcidity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName(EnumAcidity value) {
|
||||
return value.getLocalisedName(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColour(EnumAcidity value) {
|
||||
return (new int[]{16711782, 65280, 26367})[value.ordinal()];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package binnie.botany.genetics.gui.analyst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.ITitledWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.core.util.TimeUtil;
|
||||
import binnie.genetics.api.analyst.IAnalystManager;
|
||||
import binnie.genetics.api.analyst.IAnalystPagePlugin;
|
||||
import binnie.genetics.api.analyst.IBiologyPlugin;
|
||||
import binnie.genetics.api.analyst.IClimatePlugin;
|
||||
import binnie.genetics.api.analyst.AnalystConstants;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class FlowerAnalystPagePlugin implements IAnalystPagePlugin<IFlower> {
|
||||
@Override
|
||||
public boolean handles(IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addAnalystPages(IFlower individual, IWidget parent, IArea pageSize, List<ITitledWidget> analystPages, IAnalystManager analystManager) {
|
||||
analystPages.add(analystManager.createClimatePage(parent, pageSize, individual, new ClimatePlugin()));
|
||||
analystPages.add(new AnalystPageSoil(parent, pageSize, individual));
|
||||
analystPages.add(analystManager.createBiologyPage(parent, pageSize, individual, new BiologyPlugin()));
|
||||
analystPages.add(new AnalystPageAppearance(parent, pageSize, individual));
|
||||
}
|
||||
|
||||
private static class BiologyPlugin implements IBiologyPlugin<IFlower> {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IFlower flower, IWidget parent, int y, IAnalystManager analystManager) {
|
||||
y += 10;
|
||||
int butterflySpawn2 = Math.round(Constants.SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn", TimeUtil.getTimeString(butterflySpawn2)))
|
||||
.setColor(parent.getColor());
|
||||
y += 30;
|
||||
|
||||
int fertility = flower.getGenome().getFertility();
|
||||
float chanceDispersal = 0.8f;
|
||||
chanceDispersal += 0.2f * fertility;
|
||||
if (chanceDispersal > 1.0f) {
|
||||
chanceDispersal = 1.0f;
|
||||
}
|
||||
|
||||
float chancePollinate = 0.6f;
|
||||
chancePollinate += 0.25f * fertility;
|
||||
if (chancePollinate > 1.0f) {
|
||||
chancePollinate = 1.0f;
|
||||
}
|
||||
|
||||
float maxAge = flower.getMaxAge();
|
||||
float ageChance = flower.getGenome().getAgeChance();
|
||||
float dispersalTime = Constants.SPAWN_KOEF / chanceDispersal;
|
||||
float pollinateTime = Constants.SPAWN_KOEF / chancePollinate;
|
||||
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
|
||||
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - Constants.SPAWN_KOEF;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(lifespan2))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".seedDispersal"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / dispersalTime)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".pollination"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / pollinateTime)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClimatePlugin implements IClimatePlugin<IFlower> {
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTemperatureTolerance(IFlower flower) {
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance) genome.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
|
||||
return tolerance.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getHumidityTolerance(IFlower flower) {
|
||||
return EnumTolerance.BOTH_5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showHumiditySection() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.gui.resource.minecraft;
|
||||
package binnie.botany.genetics.gui.analyst;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package binnie.botany.gui;
|
||||
|
||||
import binnie.design.gui.WindowDesigner;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -11,17 +15,27 @@ import binnie.core.gui.minecraft.Window;
|
||||
|
||||
public enum BotanyGUI implements IBinnieGUID {
|
||||
DATABASE,
|
||||
DATABASE_MASTER;
|
||||
DATABASE_MASTER,
|
||||
TILEWORKER;
|
||||
|
||||
@Override
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
|
||||
IInventory inventory = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
inventory = (IInventory) tileEntity;
|
||||
}
|
||||
switch (this) {
|
||||
case DATABASE:
|
||||
case DATABASE_MASTER: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.DATABASE);
|
||||
break;
|
||||
}
|
||||
case TILEWORKER: {
|
||||
window = WindowDesigner.create(player, inventory, side);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.ITooltip;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.core.IControlValue;
|
||||
@@ -40,6 +40,7 @@ public class ControlColorDisplay extends Control implements IControlValue<IFlowe
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getTooltip(Tooltip tooltip, ITooltipFlag tooltipFlag) {
|
||||
super.getTooltip(tooltip, tooltipFlag);
|
||||
tooltip.add(value.getColorName());
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package binnie.botany.gui.database;
|
||||
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.listbox.ControlListBox;
|
||||
|
||||
public class ControlColorMixBox extends ControlListBox<IColorMix> {
|
||||
private int index;
|
||||
private Type type;
|
||||
private final Type type;
|
||||
|
||||
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
||||
super(parent, x, y, width, height, 12);
|
||||
|
||||
@@ -8,21 +8,21 @@ import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.ITooltip;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.database.DatabaseConstants;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITextureSheet;
|
||||
import binnie.core.gui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.gui.resource.textures.Texture;
|
||||
import binnie.core.gui.resource.textures.CraftGUITextureSheet;
|
||||
import binnie.core.gui.resource.textures.StandardTexture;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ControlColorMixSymbol extends Control implements ITooltip {
|
||||
static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.CONTROLS_2);
|
||||
static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.CONTROLS_2);
|
||||
IColorMix value;
|
||||
int type;
|
||||
private static final Texture MUTATION_PLUS = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.CONTROLS);
|
||||
private static final Texture MUTATION_ARROW = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.CONTROLS);
|
||||
private final IColorMix value;
|
||||
private final int type;
|
||||
|
||||
protected ControlColorMixSymbol(IWidget parent, int x, int y, int type, IColorMix value) {
|
||||
super(parent, x, y, 16 + type * 16, 16);
|
||||
@@ -36,9 +36,9 @@ public class ControlColorMixSymbol extends Control implements ITooltip {
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
if (type == 0) {
|
||||
CraftGUI.RENDER.texture(ControlColorMixSymbol.MutationPlus, Point.ZERO);
|
||||
CraftGUI.RENDER.texture(ControlColorMixSymbol.MUTATION_PLUS, Point.ZERO);
|
||||
} else {
|
||||
CraftGUI.RENDER.texture(ControlColorMixSymbol.MutationArrow, Point.ZERO);
|
||||
CraftGUI.RENDER.texture(ControlColorMixSymbol.MUTATION_ARROW, Point.ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import binnie.core.gui.geometry.Point;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ControlColorOption extends ControlTextOption<IFlowerColor> {
|
||||
private ControlColorDisplay controlBee;
|
||||
private Point boxPosition;
|
||||
private final ControlColorDisplay controlBee;
|
||||
private final Point boxPosition;
|
||||
|
||||
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
|
||||
super(controlList, option, option.getColorName(), y);
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.gui.database.DatabaseConstants;
|
||||
@@ -15,8 +15,8 @@ import binnie.core.gui.database.PageAbstract;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class PageColorMix extends PageAbstract<IFlowerColor> {
|
||||
ControlText title;
|
||||
ControlColorMixBox list;
|
||||
private final ControlText title;
|
||||
private final ControlColorMixBox list;
|
||||
|
||||
public PageColorMix(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import binnie.botany.api.genetics.IColorMix;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.gui.database.DatabaseConstants;
|
||||
@@ -15,13 +15,13 @@ import binnie.core.gui.database.PageAbstract;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
|
||||
ControlText pageSpeciesFurther_Title;
|
||||
ControlColorMixBox pageSpeciesFurther_List;
|
||||
private final ControlText pageSpeciesFurtherTitle;
|
||||
private final ControlColorMixBox pageSpeciesFurtherList;
|
||||
|
||||
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
pageSpeciesFurther_Title = new ControlTextCentered(this, 8, I18N.localise(DatabaseConstants.BOTANY_PAGES_KEY + ".species_further.title"));
|
||||
pageSpeciesFurther_List = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.RESULTANT);
|
||||
pageSpeciesFurtherTitle = new ControlTextCentered(this, 8, I18N.localise(DatabaseConstants.BOTANY_PAGES_KEY + ".species_further.title"));
|
||||
pageSpeciesFurtherList = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.RESULTANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,6 +32,6 @@ public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
pageSpeciesFurther_List.setOptions(mixes);
|
||||
pageSpeciesFurtherList.setOptions(mixes);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.scroll.ControlScrollableContent;
|
||||
@@ -39,9 +39,9 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlower tree = BotanyAPI.flowerRoot.templateAsIndividual(template);
|
||||
IFlowerGenome genome = tree.getGenome();
|
||||
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||
IFlower flower = BotanyAPI.flowerRoot.templateAsIndividual(template);
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
IAlleleFlowerSpecies flowerSpecies = genome.getPrimary();
|
||||
int w = 144;
|
||||
int h = 176;
|
||||
new ControlText(this, new Area(0, 4, w, 16), I18N.localise(DatabaseConstants.BOTANY_GENOME_KEY + ".title"), TextJustification.MIDDLE_CENTER);
|
||||
@@ -54,15 +54,15 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
int th = 14;
|
||||
int th2 = 18;
|
||||
new ControlText(contents, new Area(0, y, w2, th), I18N.localise(DatabaseConstants.BOTANY_GENOME_KEY + ".temp"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFT);
|
||||
new ControlText(contents, new Area(w2, y, w3, th), flowerSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFT);
|
||||
|
||||
y += th;
|
||||
new ControlText(contents, new Area(0, y, w2, th), I18N.localise(DatabaseConstants.BOTANY_GENOME_KEY + ".moist"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getMoisture().getLocalisedName(false), TextJustification.MIDDLE_LEFT);
|
||||
new ControlText(contents, new Area(w2, y, w3, th), flowerSpecies.getMoisture().getLocalisedName(false), TextJustification.MIDDLE_LEFT);
|
||||
|
||||
y += th;
|
||||
new ControlText(contents, new Area(0, y, w2, th), I18N.localise(DatabaseConstants.BOTANY_GENOME_KEY + ".ph"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPH().getLocalisedName(false), TextJustification.MIDDLE_LEFT);
|
||||
new ControlText(contents, new Area(w2, y, w3, th), flowerSpecies.getPH().getLocalisedName(false), TextJustification.MIDDLE_LEFT);
|
||||
|
||||
y += th;
|
||||
new ControlText(contents, new Area(0, y, w2, th), I18N.localise(DatabaseConstants.BOTANY_GENOME_KEY + ".fertility"), TextJustification.MIDDLE_RIGHT);
|
||||
@@ -82,7 +82,7 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
int x = w2;
|
||||
int tot = 0;
|
||||
for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||
if (vid.getGenome().getPrimary() == flowerSpecies) {
|
||||
if (tot > 0 && tot % 3 == 0) {
|
||||
x -= 54;
|
||||
y += 18;
|
||||
|
||||
@@ -4,6 +4,9 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.gui.controls.page.ControlPage;
|
||||
import binnie.core.gui.database.ModeWidgets;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -12,8 +15,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.genetics.IFlowerColor;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.listbox.ControlListBox;
|
||||
import binnie.core.gui.database.DatabaseConstants;
|
||||
import binnie.core.gui.database.DatabaseTab;
|
||||
@@ -26,13 +29,12 @@ import binnie.core.gui.database.PageSpeciesMutations;
|
||||
import binnie.core.gui.database.PageSpeciesOverview;
|
||||
import binnie.core.gui.database.PageSpeciesResultant;
|
||||
import binnie.core.gui.database.WindowAbstractDatabase;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||
super(player, side, nei, Botany.flowerBreedingSystem, 130);
|
||||
super(player, side, nei, ModuleFlowers.flowerBreedingSystem, 130);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||
@@ -49,15 +51,20 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
new PageSpeciesMutations(getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.further"));
|
||||
new PageBranchOverview(getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.overview"));
|
||||
new PageBranchSpecies(getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.species"));
|
||||
createMode(FlowerMode.Color, new FlowerColorModeWidgets());
|
||||
createMode(FlowerMode.Color, new ModeWidgets(FlowerMode.Color, this, (area, modePage) -> {
|
||||
FlowerColorControlListBox listBox = new FlowerColorControlListBox(modePage, area);
|
||||
List<IFlowerColor> colors = Arrays.stream(EnumFlowerColor.values()).map(EnumFlowerColor::getFlowerColorAllele).collect(Collectors.toList());
|
||||
listBox.setOptions(colors);
|
||||
return listBox;
|
||||
}));
|
||||
new PageColorMixResultant(getInfoPages(FlowerMode.Color), new DatabaseTab(Botany.instance, "color.resultant"));
|
||||
new PageColorMix(getInfoPages(FlowerMode.Color), new DatabaseTab(Botany.instance, "color.further"));
|
||||
new PageBreeder(getInfoPages(Mode.BREEDER), getUsername(), new DatabaseTab(Botany.instance, "breeder"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
protected String getModId() {
|
||||
return Botany.instance.getModId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,22 +82,14 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private class FlowerColorModeWidgets extends ModeWidgets {
|
||||
public FlowerColorModeWidgets() {
|
||||
super(FlowerMode.Color, WindowBotanistDatabase.this);
|
||||
private static class FlowerColorControlListBox extends ControlListBox<IFlowerColor> {
|
||||
public FlowerColorControlListBox(ControlPage<IDatabaseMode> modePage, IArea area) {
|
||||
super(modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createListBox(Area area) {
|
||||
listBox = new ControlListBox<IFlowerColor>(modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
|
||||
@Override
|
||||
public IWidget createOption(IFlowerColor value, int y) {
|
||||
return new ControlColorOption(getContent(), value, y);
|
||||
}
|
||||
};
|
||||
|
||||
List<IFlowerColor> colors = Arrays.stream(EnumFlowerColor.values()).map(EnumFlowerColor::getFlowerColorAllele).collect(Collectors.toList());
|
||||
listBox.setOptions(colors);
|
||||
public IWidget createOption(IFlowerColor value, int y) {
|
||||
return new ControlColorOption(getContent(), value, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public enum BotanyItems implements IItemMiscProvider {
|
||||
MORTAR,
|
||||
WEEDKILLER;
|
||||
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
BotanyItems() {
|
||||
name = name().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
@@ -15,7 +15,7 @@ import binnie.core.util.I18N;
|
||||
public enum CeramicItems implements IItemMiscProvider {
|
||||
MORTAR;
|
||||
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
CeramicItems() {
|
||||
name = name().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
@@ -15,8 +15,8 @@ public enum EnumTubeInsulate {
|
||||
|
||||
public static final EnumTubeInsulate[] VALUES = values();
|
||||
|
||||
int color;
|
||||
String uid;
|
||||
private final int color;
|
||||
private final String uid;
|
||||
|
||||
EnumTubeInsulate(int color, String uid) {
|
||||
this.color = color;
|
||||
|
||||
@@ -10,8 +10,8 @@ public enum EnumTubeMaterial {
|
||||
|
||||
public static final EnumTubeMaterial[] VALUES = values();
|
||||
|
||||
int color;
|
||||
String uid;
|
||||
private final int color;
|
||||
private final String uid;
|
||||
|
||||
EnumTubeMaterial(int color, String uid) {
|
||||
this.color = color;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ItemBotany extends Item implements IItemModelRegister {
|
||||
public ItemBotany(String registryName) {
|
||||
setRegistryName(registryName);
|
||||
setUnlocalizedName(registryName);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -15,6 +15,7 @@ import binnie.core.util.I18N;
|
||||
public class ItemCeramic extends ItemBlock implements IColoredItem {
|
||||
public ItemCeramic(BlockCeramic block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ import binnie.botany.ceramic.brick.CeramicBrickPair;
|
||||
public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
|
||||
public ItemCeramicBrick(BlockCeramicBrick block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,9 +27,9 @@ public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
|
||||
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||
CeramicBrickPair ceramic = new CeramicBrickPair(stack);
|
||||
if (tintIndex == 1) {
|
||||
return ceramic.colorFirst.getFlowerColorAllele().getColor(false);
|
||||
return ceramic.getColorFirst().getFlowerColorAllele().getColor(false);
|
||||
} else if (tintIndex == 2) {
|
||||
return ceramic.colorSecond.getFlowerColorAllele().getColor(false);
|
||||
return ceramic.getColorSecond().getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.google.common.base.Preconditions;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -53,13 +54,13 @@ import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemFlowerGE extends Item implements IColoredItem, IItemModelRegister {
|
||||
private EnumFlowerStage type;
|
||||
private String tag;
|
||||
private final EnumFlowerStage type;
|
||||
private final String tag;
|
||||
|
||||
public ItemFlowerGE(String name, EnumFlowerStage type, String tag) {
|
||||
this.type = type;
|
||||
this.tag = tag;
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
hasSubtypes = true;
|
||||
@@ -122,6 +123,17 @@ public class ItemFlowerGE extends Item implements IColoredItem, IItemModelRegist
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getCreatorModId(ItemStack itemStack) {
|
||||
IIndividual individual = getIndividual(itemStack);
|
||||
if (individual != null) {
|
||||
IAlleleSpecies species = individual.getGenome().getPrimary();
|
||||
return species.getModID();
|
||||
}
|
||||
return super.getCreatorModId(itemStack);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IIndividual getIndividual(ItemStack itemstack) {
|
||||
NBTTagCompound tagCompound = itemstack.getTagCompound();
|
||||
@@ -132,11 +144,11 @@ public class ItemFlowerGE extends Item implements IColoredItem, IItemModelRegist
|
||||
}
|
||||
|
||||
private IAlleleFlowerSpecies getPrimarySpecies(ItemStack itemstack) {
|
||||
IFlower tree = BotanyCore.getFlowerRoot().getMember(itemstack);
|
||||
if (tree == null) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(itemstack);
|
||||
if (flower == null) {
|
||||
return (IAlleleFlowerSpecies) BotanyCore.getFlowerRoot().getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
||||
}
|
||||
return tree.getGenome().getPrimary();
|
||||
return flower.getGenome().getPrimary();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||
public ItemInsulatedTube() {
|
||||
super("insulated_tube");
|
||||
setUnlocalizedName("botany.insulated_tube");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ItemPigment extends Item implements IItemModelRegister, IColoredIte
|
||||
public ItemPigment() {
|
||||
setUnlocalizedName("botany.pigment");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setRegistryName("pigment");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import binnie.core.util.I18N;
|
||||
|
||||
public class ItemSoilMeter extends Item implements IItemModelRegister {
|
||||
public ItemSoilMeter() {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
setUnlocalizedName("botany.soil_meter");
|
||||
setMaxStackSize(1);
|
||||
setRegistryName("soil_meter");
|
||||
|
||||
@@ -10,7 +10,7 @@ import forestry.core.items.IColoredItem;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
|
||||
public class ItemStainedGlass extends ItemMetadata implements IColoredItem {
|
||||
public ItemStainedGlass(Block block) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemTrowel extends Item implements IItemModelRegister {
|
||||
theToolMaterial = toolMaterial;
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(toolMaterial.getMaxUses());
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setCreativeTab(CreativeTabBotany.INSTANCE);
|
||||
modelName = "trowel_" + materialName;
|
||||
setUnlocalizedName("botany." + modelName);
|
||||
setRegistryName(modelName);
|
||||
@@ -90,7 +90,7 @@ public class ItemTrowel extends Item implements IItemModelRegister {
|
||||
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
|
||||
|
||||
if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", theToolMaterial.getDamageVsEntity() + 0.5, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", theToolMaterial.getAttackDamage() + 0.5, 0));
|
||||
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -1.5, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,25 +2,15 @@ package binnie.botany.machines;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.machines.designer.PackageDesigner;
|
||||
import binnie.botany.machines.designer.Tileworker;
|
||||
import binnie.botany.modules.ModuleMachine;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.machines.IMachineType;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.component.IInteraction;
|
||||
import binnie.core.modules.BotanyModuleUIDs;
|
||||
import binnie.core.modules.ModuleManager;
|
||||
import binnie.extratrees.core.ExtraTreesGUID;
|
||||
import binnie.extratrees.machines.designer.PackageDesigner;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public enum BotanyMachine implements IMachineType {
|
||||
Tileworker(() -> {
|
||||
@@ -30,7 +20,7 @@ public enum BotanyMachine implements IMachineType {
|
||||
return null;
|
||||
});
|
||||
|
||||
Supplier<MachinePackage> supplier;
|
||||
private final Supplier<MachinePackage> supplier;
|
||||
|
||||
BotanyMachine(final Supplier<MachinePackage> supplier) {
|
||||
this.supplier = supplier;
|
||||
@@ -45,33 +35,4 @@ public enum BotanyMachine implements IMachineType {
|
||||
return new ItemStack(ModuleMachine.blockMachine, i, this.ordinal());
|
||||
}
|
||||
|
||||
public static class ComponentExtraTreeGUI extends MachineComponent implements IInteraction.RightClick {
|
||||
ExtraTreesGUID id;
|
||||
|
||||
public ComponentExtraTreeGUI(final Machine machine, final ExtraTreesGUID id) {
|
||||
super(machine);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(World p0, EntityPlayer p1, BlockPos pos) {
|
||||
Botany.proxy.openGui(this.id, p1, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract static class PackageExtraTreeMachine extends MachinePackage {
|
||||
|
||||
protected PackageExtraTreeMachine(final String uid, final boolean powered) {
|
||||
super(uid, powered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package binnie.botany.machines;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachineComponent;
|
||||
import binnie.core.machines.component.IInteraction;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ComponentBotanyGUI extends MachineComponent implements IInteraction.RightClick {
|
||||
private final BotanyGUI id;
|
||||
|
||||
public ComponentBotanyGUI(final Machine machine, final BotanyGUI id) {
|
||||
super(machine);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRightClick(World p0, EntityPlayer p1, BlockPos pos) {
|
||||
Botany.proxy.openGui(this.id, p1, pos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package binnie.botany.machines.designer;
|
||||
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.botany.machines.ComponentBotanyGUI;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.gui.minecraft.IMachineInformation;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.MachinePackage;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.core.machines.inventory.ComponentInventorySlots;
|
||||
import binnie.core.machines.inventory.InventorySlot;
|
||||
import binnie.design.api.IDesignerType;
|
||||
import binnie.design.gui.ComponentDesignerRecipe;
|
||||
import binnie.design.gui.DesignerSlots;
|
||||
import binnie.design.gui.SlotValidatorDesignAdhesive;
|
||||
import binnie.design.gui.SlotValidatorDesignMaterial;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public final class PackageDesigner extends MachinePackage implements IMachineInformation {
|
||||
private final IDesignerType type;
|
||||
|
||||
public PackageDesigner(final IDesignerType type) {
|
||||
super(type.getName());
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity() {
|
||||
return new TileEntityMachine(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMachine(final Machine machine) {
|
||||
new ComponentBotanyGUI(machine, BotanyGUI.TILEWORKER);
|
||||
final ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
|
||||
InventorySlot mortarSlot = inventory.addSlot(DesignerSlots.ADHESIVE_SLOT, new ResourceLocation(Constants.BOTANY_MOD_ID, "gui.slot.mortar"));
|
||||
mortarSlot.setValidator(new SlotValidatorDesignAdhesive(this.type));
|
||||
InventorySlot ceramicSlot1 = inventory.addSlot(DesignerSlots.DESIGN_SLOT_1, new ResourceLocation(Constants.BOTANY_MOD_ID, "gui.slot.ceramic"));
|
||||
ceramicSlot1.setValidator(new SlotValidatorDesignMaterial(this.type));
|
||||
InventorySlot ceramicSlot2 = inventory.addSlot(DesignerSlots.DESIGN_SLOT_2, new ResourceLocation(Constants.BOTANY_MOD_ID, "gui.slot.ceramic"));
|
||||
ceramicSlot2.setValidator(new SlotValidatorDesignMaterial(this.type));
|
||||
new ComponentDesignerRecipe(machine, this.type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package binnie.botany.machines.designer;
|
||||
|
||||
import binnie.extratrees.machines.designer.IDesignerType;
|
||||
import binnie.design.DesignHelper;
|
||||
import binnie.design.EnumDesign;
|
||||
import binnie.design.api.IDesignerType;
|
||||
import binnie.design.blocks.BlockDesign;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.ceramic.CeramicDesignSystem;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
import binnie.extratrees.carpentry.EnumDesign;
|
||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||
import binnie.design.api.IDesign;
|
||||
import binnie.design.api.IDesignMaterial;
|
||||
import binnie.design.api.IDesignSystem;
|
||||
|
||||
public class Tileworker implements IDesignerType {
|
||||
private static final String name = "tileworker";
|
||||
@@ -28,7 +28,7 @@ public class Tileworker implements IDesignerType {
|
||||
type2 = type1;
|
||||
stackSize = 1;
|
||||
}
|
||||
final ItemStack stack = ModuleCarpentry.getItemStack(this.getBlock(), type1, type2, design);
|
||||
final ItemStack stack = DesignHelper.getItemStack(this.getBlock(), type1, type2, design);
|
||||
stack.setCount(stackSize);
|
||||
return stack;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class Tileworker implements IDesignerType {
|
||||
|
||||
@Override
|
||||
public String getMaterialTooltip() {
|
||||
return I18N.localise("extratrees.machine.machine.designer.material.tile");
|
||||
return I18N.localise("botany.machine.machine.designer.material.tile");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.machines.designer;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
Loaded 100 of 861 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user