mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-10-25 20:22:30 +00:00
Update buildscript & spotlessApply
This commit is contained in:
1 parent
e4329e2b8f
commit
8683a345c3
818 files changed
+51123
-49403
No files matched your search
+2
-2
@@ -1,4 +1,4 @@
|
||||
//version: 1656003794
|
||||
//version: 1656760175
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
|
||||
@@ -91,7 +91,7 @@ spotless {
|
||||
encoding 'UTF-8'
|
||||
|
||||
format 'misc', {
|
||||
target '*.md', '.gitignore'
|
||||
target '.gitignore'
|
||||
|
||||
trimTrailingWhitespace()
|
||||
indentWithSpaces(4)
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:ForestryMC:4.4.6:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:ForestryMC:4.4.6:dev')
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:api')
|
||||
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('curse.maven:cofh-lib-220333:2388748')
|
||||
}
|
||||
+22
-22
@@ -1,26 +1,26 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name 'GTNH Maven'
|
||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||
allowInsecureProtocol
|
||||
}
|
||||
maven {
|
||||
name 'ic2'
|
||||
url 'http://maven.ic2.player.to/'
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://cursemaven.com'
|
||||
content {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
maven {
|
||||
name 'GTNH Maven'
|
||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||
allowInsecureProtocol
|
||||
}
|
||||
maven {
|
||||
name 'ic2'
|
||||
url 'http://maven.ic2.player.to/'
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://cursemaven.com'
|
||||
content {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,15 @@ import binnie.core.liquid.ManagerLiquid;
|
||||
import binnie.core.machines.ManagerMachine;
|
||||
import binnie.core.mod.config.ManagerConfig;
|
||||
import binnie.core.resource.ManagerResource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class Binnie {
|
||||
public static List<ManagerBase> Managers = new ArrayList<>();
|
||||
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||
public static ManagerConfig Configuration = new ManagerConfig();
|
||||
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||
public static ManagerMachine Machine = new ManagerMachine();
|
||||
public static ManagerItem Item = new ManagerItem();
|
||||
public static ManagerResource Resource = new ManagerResource();
|
||||
public static List<ManagerBase> Managers = new ArrayList<>();
|
||||
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||
public static ManagerConfig Configuration = new ManagerConfig();
|
||||
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||
public static ManagerMachine Machine = new ManagerMachine();
|
||||
public static ManagerItem Item = new ManagerItem();
|
||||
public static ManagerResource Resource = new ManagerResource();
|
||||
}
|
||||
@@ -53,288 +53,300 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
|
||||
@Mod(
|
||||
modid = "Botany",
|
||||
name = "Botany",
|
||||
version = BinnieCore.VERSION,
|
||||
useMetadata = true,
|
||||
dependencies = "after:BinnieCore"
|
||||
)
|
||||
modid = "Botany",
|
||||
name = "Botany",
|
||||
version = BinnieCore.VERSION,
|
||||
useMetadata = true,
|
||||
dependencies = "after:BinnieCore")
|
||||
public class Botany extends AbstractMod {
|
||||
@Mod.Instance("Botany")
|
||||
public static Botany instance;
|
||||
@Mod.Instance("Botany")
|
||||
public static Botany instance;
|
||||
|
||||
@SidedProxy(
|
||||
clientSide = "binnie.botany.proxy.ProxyClient",
|
||||
serverSide = "binnie.botany.proxy.ProxyServer"
|
||||
)
|
||||
public static Proxy proxy;
|
||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
|
||||
public static BlockFlower flower;
|
||||
public static Item seed;
|
||||
public static Item pollen;
|
||||
public static ItemDictionary database;
|
||||
public static BlockPlant plant;
|
||||
public static ItemTrowel trowelWood;
|
||||
public static ItemTrowel trowelStone;
|
||||
public static ItemTrowel trowelIron;
|
||||
public static ItemTrowel trowelDiamond;
|
||||
public static ItemTrowel trowelGold;
|
||||
public static BlockSoil soil;
|
||||
public static BlockSoil loam;
|
||||
public static BlockSoil flowerbed;
|
||||
public static BlockSoil soilNoWeed;
|
||||
public static BlockSoil loamNoWeed;
|
||||
public static BlockSoil flowerbedNoWeed;
|
||||
public static ItemInsulatedTube insulatedTube;
|
||||
public static ItemSoilMeter soilMeter;
|
||||
public static ItemMisc misc;
|
||||
public static ItemFlower flowerItem;
|
||||
public static ItemPigment pigment;
|
||||
public static ItemClay clay;
|
||||
public static BlockCeramic ceramic;
|
||||
public static BlockCeramicPatterned ceramicTile;
|
||||
public static BlockStained stained;
|
||||
public static BlockCeramicBrick ceramicBrick;
|
||||
public static BlockFlower flower;
|
||||
public static Item seed;
|
||||
public static Item pollen;
|
||||
public static ItemDictionary database;
|
||||
public static BlockPlant plant;
|
||||
public static ItemTrowel trowelWood;
|
||||
public static ItemTrowel trowelStone;
|
||||
public static ItemTrowel trowelIron;
|
||||
public static ItemTrowel trowelDiamond;
|
||||
public static ItemTrowel trowelGold;
|
||||
public static BlockSoil soil;
|
||||
public static BlockSoil loam;
|
||||
public static BlockSoil flowerbed;
|
||||
public static BlockSoil soilNoWeed;
|
||||
public static BlockSoil loamNoWeed;
|
||||
public static BlockSoil flowerbedNoWeed;
|
||||
public static ItemInsulatedTube insulatedTube;
|
||||
public static ItemSoilMeter soilMeter;
|
||||
public static ItemMisc misc;
|
||||
public static ItemFlower flowerItem;
|
||||
public static ItemPigment pigment;
|
||||
public static ItemClay clay;
|
||||
public static BlockCeramic ceramic;
|
||||
public static BlockCeramicPatterned ceramicTile;
|
||||
public static BlockStained stained;
|
||||
public static BlockCeramicBrick ceramicBrick;
|
||||
|
||||
public Botany() {
|
||||
Botany.instance = this;
|
||||
}
|
||||
public Botany() {
|
||||
Botany.instance = this;
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
addModule(new ModuleCore());
|
||||
addModule(new ModuleGenetics());
|
||||
addModule(new ModuleGardening());
|
||||
preInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
addModule(new ModuleCore());
|
||||
addModule(new ModuleGenetics());
|
||||
addModule(new ModuleGardening());
|
||||
preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
init();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
postInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
postInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BotanyGUI.values();
|
||||
}
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BotanyGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return PacketID.values();
|
||||
}
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return PacketID.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Botany.proxy;
|
||||
}
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Botany.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BOT";
|
||||
}
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BOT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "botany";
|
||||
}
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "botany";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onShearFlower(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onShearFlower(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
flower.onShear();
|
||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||
}
|
||||
}
|
||||
if (event.entityPlayer != null
|
||||
&& event.entityPlayer.getHeldItem() != null
|
||||
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
flower.onShear();
|
||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.entityPlayer != null
|
||||
&& event.entityPlayer.getHeldItem() != null
|
||||
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onFertiliseSoil(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
||||
return;
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onFertiliseSoil(PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int y = event.y;
|
||||
Block block = event.world.getBlock(event.x, y, event.z);
|
||||
if (block == null || !Gardening.isSoil(block)) {
|
||||
block = event.world.getBlock(event.x, --y, event.z);
|
||||
}
|
||||
if (block == null || !Gardening.isSoil(block)) {
|
||||
return;
|
||||
}
|
||||
int y = event.y;
|
||||
Block block = event.world.getBlock(event.x, y, event.z);
|
||||
if (block == null || !Gardening.isSoil(block)) {
|
||||
block = event.world.getBlock(event.x, --y, event.z);
|
||||
}
|
||||
if (block == null || !Gardening.isSoil(block)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||
int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem())
|
||||
&& soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||
int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next])
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||
heldItem2.stackSize--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem())
|
||||
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||
heldItem2.stackSize--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
||||
heldItem3.stackSize--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem())
|
||||
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
||||
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next])
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
||||
heldItem3.stackSize--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem()) && Gardening.addWeedKiller(event.world, event.x, y, event.z) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||
heldItem4.stackSize--;
|
||||
}
|
||||
}
|
||||
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem())
|
||||
&& Gardening.addWeedKiller(event.world, event.x, y, event.z)
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||
heldItem4.stackSize--;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
||||
World world = event.world;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
Block block = world.getBlock(x, y - 1, z);
|
||||
if (!(block instanceof IBlockSoil)) {
|
||||
return;
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
||||
World world = event.world;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
Block block = world.getBlock(x, y - 1, z);
|
||||
if (!(block instanceof IBlockSoil)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||
if (flower != null) {
|
||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||
}
|
||||
}
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||
if (flower != null) {
|
||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void onPlantVanilla(PlayerInteractEvent event) {
|
||||
if (!BinnieCore.proxy.isSimulating(event.world) || event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||
return;
|
||||
}
|
||||
@Deprecated
|
||||
public void onPlantVanilla(PlayerInteractEvent event) {
|
||||
if (!BinnieCore.proxy.isSimulating(event.world)
|
||||
|| event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
World world = event.world;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int py = -1;
|
||||
if (block instanceof IBlockSoil && (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
||||
py = 1;
|
||||
}
|
||||
World world = event.world;
|
||||
int x = event.x;
|
||||
int y = event.y;
|
||||
int z = event.z;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int py = -1;
|
||||
if (block instanceof IBlockSoil
|
||||
&& (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
||||
py = 1;
|
||||
}
|
||||
|
||||
if (py < 0) {
|
||||
return;
|
||||
}
|
||||
if (py < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
||||
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
}
|
||||
}
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
||||
if (flower != null
|
||||
&& Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile())
|
||||
&& !event.entityPlayer.capabilities.isCreativeMode) {
|
||||
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
heldItem.stackSize--;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBonemeal(BonemealEvent event) {
|
||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
if (Gardening.isSoil(block)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onBonemeal(BonemealEvent event) {
|
||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
if (Gardening.isSoil(block)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onIMC(FMLInterModComms.IMCEvent event) {
|
||||
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-nutrient-fertiliser-2")) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
|
||||
}
|
||||
if (message.key.equals("add-acid-fertiliser-1")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-acid-fertiliser-2")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
|
||||
}
|
||||
if (message.key.equals("add-alkaline-fertiliser-1")) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-alkaline-fertiliser-2")) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void onIMC(FMLInterModComms.IMCEvent event) {
|
||||
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-nutrient-fertiliser-2")) {
|
||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
|
||||
}
|
||||
if (message.key.equals("add-acid-fertiliser-1")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-acid-fertiliser-2")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
|
||||
}
|
||||
if (message.key.equals("add-alkaline-fertiliser-1")) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
if (message.key.equals("add-alkaline-fertiliser-2")) {
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,31 +9,31 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CreativeTabBotany extends CreativeTabs {
|
||||
public static CreativeTabs instance = new CreativeTabBotany();
|
||||
public static CreativeTabs instance = new CreativeTabBotany();
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return getTabLabel();
|
||||
}
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return getTabLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return I18N.localise("botany.tab.botany");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return I18N.localise("botany.tab.botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(Blocks.yellow_flower);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return Item.getItemFromBlock(Blocks.yellow_flower);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumAcidity {
|
||||
ACID,
|
||||
NEUTRAL,
|
||||
ALKALINE;
|
||||
ACID,
|
||||
NEUTRAL,
|
||||
ALKALINE;
|
||||
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -10,37 +10,37 @@ import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public enum EnumFlowerChromosome implements IChromosomeType {
|
||||
SPECIES(IAlleleFlowerSpecies.class),
|
||||
PRIMARY(IAlleleInteger.class),
|
||||
SECONDARY(IAlleleInteger.class),
|
||||
FERTILITY(IAlleleInteger.class),
|
||||
TERRITORY(IAlleleArea.class),
|
||||
EFFECT(IAlleleFlowerEffect.class),
|
||||
LIFESPAN(IAlleleInteger.class),
|
||||
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
||||
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
||||
PH_TOLERANCE(IAlleleTolerance.class),
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
STEM(IAlleleInteger.class);
|
||||
SPECIES(IAlleleFlowerSpecies.class),
|
||||
PRIMARY(IAlleleInteger.class),
|
||||
SECONDARY(IAlleleInteger.class),
|
||||
FERTILITY(IAlleleInteger.class),
|
||||
TERRITORY(IAlleleArea.class),
|
||||
EFFECT(IAlleleFlowerEffect.class),
|
||||
LIFESPAN(IAlleleInteger.class),
|
||||
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
||||
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
||||
PH_TOLERANCE(IAlleleTolerance.class),
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
STEM(IAlleleInteger.class);
|
||||
|
||||
private Class<? extends IAllele> cls;
|
||||
private Class<? extends IAllele> cls;
|
||||
|
||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return cls;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return toString().toLowerCase();
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumFlowerStage {
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen"),
|
||||
NONE("NONE");
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen"),
|
||||
NONE("NONE");
|
||||
|
||||
protected String name;
|
||||
protected String name;
|
||||
|
||||
EnumFlowerStage(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
EnumFlowerStage(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumMoisture {
|
||||
DRY,
|
||||
NORMAL,
|
||||
DAMP;
|
||||
DRY,
|
||||
NORMAL,
|
||||
DAMP;
|
||||
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumSoilType {
|
||||
SOIL,
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
SOIL,
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
public String getID() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,5 @@ import forestry.api.genetics.IEffectData;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||
IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z);
|
||||
IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z);
|
||||
}
|
||||
@@ -3,9 +3,9 @@ package binnie.botany.api;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies {
|
||||
IFlowerType getType();
|
||||
IFlowerType getType();
|
||||
|
||||
EnumAcidity getPH();
|
||||
EnumAcidity getPH();
|
||||
|
||||
EnumMoisture getMoisture();
|
||||
EnumMoisture getMoisture();
|
||||
}
|
||||
@@ -2,5 +2,4 @@ package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IBotanistTracker extends IBreedingTracker {
|
||||
}
|
||||
public interface IBotanistTracker extends IBreedingTracker {}
|
||||
@@ -1,13 +1,13 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
public interface IColourMix {
|
||||
IFlowerColor getColor1();
|
||||
IFlowerColor getColor1();
|
||||
|
||||
IFlowerColor getColor2();
|
||||
IFlowerColor getColor2();
|
||||
|
||||
boolean isMutation(IFlowerColor color1, IFlowerColor color2);
|
||||
boolean isMutation(IFlowerColor color1, IFlowerColor color2);
|
||||
|
||||
int getChance();
|
||||
int getChance();
|
||||
|
||||
IFlowerColor getResult();
|
||||
IFlowerColor getResult();
|
||||
}
|
||||
@@ -4,30 +4,30 @@ import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFlower extends IIndividual {
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
IFlowerGenome getMate();
|
||||
IFlowerGenome getMate();
|
||||
|
||||
void mate(IFlower other);
|
||||
void mate(IFlower other);
|
||||
|
||||
int getAge();
|
||||
int getAge();
|
||||
|
||||
void setAge(int age);
|
||||
void setAge(int age);
|
||||
|
||||
void age();
|
||||
void age();
|
||||
|
||||
IFlower getOffspring(World world);
|
||||
IFlower getOffspring(World world);
|
||||
|
||||
int getMaxAge();
|
||||
int getMaxAge();
|
||||
|
||||
boolean isWilted();
|
||||
boolean isWilted();
|
||||
|
||||
void setWilted(boolean value);
|
||||
void setWilted(boolean value);
|
||||
|
||||
boolean hasFlowered();
|
||||
boolean hasFlowered();
|
||||
|
||||
void setFlowered(boolean value);
|
||||
void setFlowered(boolean value);
|
||||
|
||||
void removeMate();
|
||||
void removeMate();
|
||||
}
|
||||
@@ -3,11 +3,11 @@ package binnie.botany.api;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IFlowerColor {
|
||||
int getColor(boolean dis);
|
||||
int getColor(boolean dis);
|
||||
|
||||
IAlleleInteger getAllele();
|
||||
IAlleleInteger getAllele();
|
||||
|
||||
int getID();
|
||||
int getID();
|
||||
|
||||
String getName();
|
||||
String getName();
|
||||
}
|
||||
@@ -5,37 +5,37 @@ import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface IFlowerGenome extends IGenome {
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
|
||||
IFlowerColor getPrimaryColor();
|
||||
IFlowerColor getPrimaryColor();
|
||||
|
||||
IFlowerColor getSecondaryColor();
|
||||
IFlowerColor getSecondaryColor();
|
||||
|
||||
IFlowerColor getStemColor();
|
||||
IFlowerColor getStemColor();
|
||||
|
||||
int getFertility();
|
||||
int getFertility();
|
||||
|
||||
int getLifespan();
|
||||
int getLifespan();
|
||||
|
||||
IFlowerType getType();
|
||||
IFlowerType getType();
|
||||
|
||||
EnumTolerance getToleranceTemperature();
|
||||
EnumTolerance getToleranceTemperature();
|
||||
|
||||
EnumTolerance getToleranceMoisture();
|
||||
EnumTolerance getToleranceMoisture();
|
||||
|
||||
EnumTolerance getTolerancePH();
|
||||
EnumTolerance getTolerancePH();
|
||||
|
||||
float getAgeChance();
|
||||
float getAgeChance();
|
||||
|
||||
float getSappiness();
|
||||
float getSappiness();
|
||||
|
||||
boolean canTolerate(EnumAcidity pH);
|
||||
boolean canTolerate(EnumAcidity pH);
|
||||
|
||||
boolean canTolerate(EnumMoisture moisture);
|
||||
boolean canTolerate(EnumMoisture moisture);
|
||||
|
||||
boolean canTolerate(EnumTemperature temp);
|
||||
boolean canTolerate(EnumTemperature temp);
|
||||
}
|
||||
@@ -5,5 +5,5 @@ import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IFlowerMutation extends IMutation {
|
||||
float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
}
|
||||
@@ -3,42 +3,41 @@ package binnie.botany.api;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IFlowerRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
IFlower getMember(ItemStack stack);
|
||||
@Override
|
||||
IFlower getMember(ItemStack stack);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] template);
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(World world, GameProfile player);
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(World world, GameProfile player);
|
||||
|
||||
@Override
|
||||
Collection<IFlowerMutation> getMutations(boolean shuffle);
|
||||
@Override
|
||||
Collection<IFlowerMutation> getMutations(boolean shuffle);
|
||||
|
||||
EnumFlowerStage getStageType(ItemStack stack);
|
||||
EnumFlowerStage getStageType(ItemStack stack);
|
||||
|
||||
IFlower getFlower(World world, IFlowerGenome genome);
|
||||
IFlower getFlower(World world, IFlowerGenome genome);
|
||||
|
||||
void addConversion(ItemStack stack, IAllele[] template);
|
||||
void addConversion(ItemStack stack, IAllele[] template);
|
||||
|
||||
IFlower getConversion(ItemStack stack);
|
||||
IFlower getConversion(ItemStack stack);
|
||||
|
||||
Collection<IColourMix> getColourMixes(boolean shuffle);
|
||||
Collection<IColourMix> getColourMixes(boolean shuffle);
|
||||
|
||||
void registerColourMix(IColourMix colorMix);
|
||||
void registerColourMix(IColourMix colorMix);
|
||||
}
|
||||
@@ -3,15 +3,15 @@ package binnie.botany.api;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IFlowerType {
|
||||
IIcon getStem(EnumFlowerStage stage, boolean flowered, int section);
|
||||
IIcon getStem(EnumFlowerStage stage, boolean flowered, int section);
|
||||
|
||||
IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||
IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||
|
||||
IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||
IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||
|
||||
int getID();
|
||||
int getID();
|
||||
|
||||
int getSections();
|
||||
int getSections();
|
||||
|
||||
int ordinal();
|
||||
int ordinal();
|
||||
}
|
||||
@@ -6,19 +6,19 @@ import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockSoil {
|
||||
EnumAcidity getPH(World world, int x, int y, int z);
|
||||
EnumAcidity getPH(World world, int x, int y, int z);
|
||||
|
||||
EnumMoisture getMoisture(World world, int x, int y, int z);
|
||||
EnumMoisture getMoisture(World world, int x, int y, int z);
|
||||
|
||||
EnumSoilType getType(World world, int x, int y, int z);
|
||||
EnumSoilType getType(World world, int x, int y, int z);
|
||||
|
||||
boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel);
|
||||
boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel);
|
||||
|
||||
boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel);
|
||||
boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel);
|
||||
|
||||
boolean setPH(World world, int x, int y, int z, EnumAcidity pH);
|
||||
boolean setPH(World world, int x, int y, int z, EnumAcidity pH);
|
||||
|
||||
boolean setMoisture(World world, int x, int y, int z, EnumMoisture p4);
|
||||
boolean setMoisture(World world, int x, int y, int z, EnumMoisture p4);
|
||||
|
||||
boolean resistsWeeds(World world, int x, int y, int z);
|
||||
boolean resistsWeeds(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -24,123 +26,120 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
public BlockCeramic() {
|
||||
super(Material.rock);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setBlockName("ceramic");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
public BlockCeramic() {
|
||||
super(Material.rock);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setBlockName("ceramic");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
return I18N.localise("botany.ceramicBlock");
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
return I18N.localise("botany.ceramicBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -8,35 +8,35 @@ import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
import binnie.extratrees.carpentry.DesignBlock;
|
||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCeramicPatterned extends BlockDesign {
|
||||
public BlockCeramicPatterned() {
|
||||
super(CeramicDesignSystem.instance, Material.rock);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setBlockName("ceramicPattern");
|
||||
}
|
||||
public BlockCeramicPatterned() {
|
||||
super(CeramicDesignSystem.instance, Material.rock);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setBlockName("ceramicPattern");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.WHITE), CeramicColor.get(EnumFlowerColor.BLACK), design);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCreativeStack(IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(
|
||||
this, CeramicColor.get(EnumFlowerColor.WHITE), CeramicColor.get(EnumFlowerColor.BLACK), design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(DesignBlock design) {
|
||||
return I18N.localise("botany.ceramicBlock");
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(DesignBlock design) {
|
||||
return I18N.localise("botany.ceramicBlock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
super.addBlockTooltip(stack, tooltip);
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||
super.addBlockTooltip(stack, tooltip);
|
||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import binnie.core.util.I18N;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -25,173 +28,168 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockStained extends Block implements IBlockMetadata {
|
||||
public BlockStained() {
|
||||
super(Material.glass);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setBlockName("stained");
|
||||
}
|
||||
public BlockStained() {
|
||||
super(Material.glass);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setBlockName("stained");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z - Facing.offsetsZForSide[side]);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block != this
|
||||
&& block != ExtraTrees.blockStained
|
||||
&& super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z -
|
||||
// Facing.offsetsZForSide[side]);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block != this && block != ExtraTrees.blockStained && super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
return I18N.localise("botany.pigmentedGlass");
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
return I18N.localise("botany.pigmentedGlass");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
||||
dropBlockAsItem(world, x, y, z, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||
super.breakBlock(world, x, y, z, block, side);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -4,43 +4,42 @@ import binnie.botany.Botany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial {
|
||||
private static Map<EnumFlowerColor, CeramicColor> map;
|
||||
private static Map<EnumFlowerColor, CeramicColor> map;
|
||||
|
||||
static {
|
||||
CeramicColor.map = new LinkedHashMap<>();
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
static {
|
||||
CeramicColor.map = new LinkedHashMap<>();
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
|
||||
protected EnumFlowerColor color;
|
||||
protected EnumFlowerColor color;
|
||||
|
||||
CeramicColor(EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
CeramicColor(EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public static CeramicColor get(EnumFlowerColor c) {
|
||||
return CeramicColor.map.get(c);
|
||||
}
|
||||
public static CeramicColor get(EnumFlowerColor c) {
|
||||
return CeramicColor.map.get(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return color.getName();
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color.getColor(false);
|
||||
}
|
||||
@Override
|
||||
public int getColor() {
|
||||
return color.getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -10,85 +10,94 @@ import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.extratrees.carpentry.DesignerManager;
|
||||
import binnie.extratrees.carpentry.EnumPattern;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CeramicDesignSystem implements IDesignSystem {
|
||||
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||
|
||||
protected Map<Integer, IIcon> primary;
|
||||
protected Map<Integer, IIcon> secondary;
|
||||
protected Map<Integer, IIcon> primary;
|
||||
protected Map<Integer, IIcon> secondary;
|
||||
|
||||
CeramicDesignSystem() {
|
||||
primary = new HashMap<>();
|
||||
secondary = new HashMap<>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
CeramicDesignSystem() {
|
||||
primary = new HashMap<>();
|
||||
secondary = new HashMap<>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial() {
|
||||
return CeramicColor.get(EnumFlowerColor.WHITE);
|
||||
}
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial() {
|
||||
return CeramicColor.get(EnumFlowerColor.WHITE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial2() {
|
||||
return CeramicColor.get(EnumFlowerColor.BLACK);
|
||||
}
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial2() {
|
||||
return CeramicColor.get(EnumFlowerColor.BLACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(int id) {
|
||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||
}
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(int id) {
|
||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialIndex(IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
}
|
||||
@Override
|
||||
public int getMaterialIndex(IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
}
|
||||
|
||||
public String getTexturePath() {
|
||||
return "ceramic";
|
||||
}
|
||||
public String getTexturePath() {
|
||||
return "ceramic";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return primary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return primary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return secondary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return secondary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (EnumPattern pattern : EnumPattern.values()) {
|
||||
primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (EnumPattern pattern : EnumPattern.values()) {
|
||||
primary.put(
|
||||
pattern.ordinal(),
|
||||
BinnieCore.proxy.getIcon(
|
||||
register,
|
||||
getMod().getModID(),
|
||||
getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
secondary.put(
|
||||
pattern.ordinal(),
|
||||
BinnieCore.proxy.getIcon(
|
||||
register,
|
||||
getMod().getModID(),
|
||||
getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.Mortar.get(1);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.Mortar.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(ItemStack stack) {
|
||||
return (stack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? getMaterial(stack.getItemDamage()) : null;
|
||||
}
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(ItemStack stack) {
|
||||
return (stack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? getMaterial(stack.getItemDamage()) : null;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +1,70 @@
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CeramicTileRecipe implements IRecipe {
|
||||
protected ItemStack cached;
|
||||
protected ItemStack cached;
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting crafting, World world) {
|
||||
cached = getCraftingResult(crafting);
|
||||
return cached != null;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting crafting, World world) {
|
||||
cached = getCraftingResult(crafting);
|
||||
return cached != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||
Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||
Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||
Item mortar = Botany.misc;
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
int ix = -1;
|
||||
int iy = -1;
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||
Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||
Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||
Item mortar = Botany.misc;
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
int ix = -1;
|
||||
int iy = -1;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
int x = i / 3;
|
||||
int y = i % 3;
|
||||
if (ix == -1) {
|
||||
ix = x;
|
||||
iy = y;
|
||||
}
|
||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item item = stack.getItem();
|
||||
if (item != ceramicBlock && item != ceramicTile && item != ceramicBrick && item != mortar) {
|
||||
return null;
|
||||
}
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
int x = i / 3;
|
||||
int y = i % 3;
|
||||
if (ix == -1) {
|
||||
ix = x;
|
||||
iy = y;
|
||||
}
|
||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||
ItemStack stack2 = type.getRecipe(stacks);
|
||||
if (stack2 != null) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Item item = stack.getItem();
|
||||
if (item != ceramicBlock && item != ceramicTile && item != ceramicBrick && item != mortar) {
|
||||
return null;
|
||||
}
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
}
|
||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||
ItemStack stack2 = type.getRecipe(stacks);
|
||||
if (stack2 != null) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return cached;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
@@ -9,51 +9,54 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PigmentRecipe implements IRecipe {
|
||||
protected ItemStack cached;
|
||||
protected ItemStack cached;
|
||||
|
||||
private ItemStack unknown;
|
||||
private ItemStack unknown;
|
||||
|
||||
public PigmentRecipe() {
|
||||
unknown = null;
|
||||
}
|
||||
public PigmentRecipe() {
|
||||
unknown = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting crafting, World world) {
|
||||
return getCraftingResult(crafting) != null;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting crafting, World world) {
|
||||
return getCraftingResult(crafting) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
return unknown;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
return unknown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
||||
int n = 0;
|
||||
ItemStack stack = null;
|
||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||
if (crafting.getStackInSlot(i) != null) {
|
||||
if (++n > 1) {
|
||||
return null;
|
||||
}
|
||||
if (!Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
||||
continue;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
||||
int n = 0;
|
||||
ItemStack stack = null;
|
||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||
if (crafting.getStackInSlot(i) != null) {
|
||||
if (++n > 1) {
|
||||
return null;
|
||||
}
|
||||
if (!Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
||||
if (flower.getAge() >= 1) {
|
||||
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
||||
if (flower.getAge() >= 1) {
|
||||
stack = new ItemStack(
|
||||
Botany.pigment,
|
||||
1,
|
||||
flower.getGenome().getPrimaryColor().getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 1;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.genetics.FlowerHelper;
|
||||
|
||||
public class BotanyCore {
|
||||
public static IFlowerRoot speciesRoot = new FlowerHelper();
|
||||
public static IFlowerRoot speciesRoot = new FlowerHelper();
|
||||
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
return BotanyCore.speciesRoot;
|
||||
}
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
return BotanyCore.speciesRoot;
|
||||
}
|
||||
}
|
||||
@@ -8,19 +8,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public enum BotanyGUI implements IBinnieGUID {
|
||||
Database,
|
||||
DatabaseNEI;
|
||||
Database,
|
||||
DatabaseNEI;
|
||||
|
||||
@Override
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
switch (this) {
|
||||
case Database:
|
||||
case DatabaseNEI: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
@Override
|
||||
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||
Window window = null;
|
||||
switch (this) {
|
||||
case Database:
|
||||
case DatabaseNEI: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,18 @@ package binnie.botany.core;
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleCore implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -11,33 +11,33 @@ import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
|
||||
public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip {
|
||||
private IFlowerColor value;
|
||||
private IFlowerColor value;
|
||||
|
||||
public ControlColorDisplay(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
}
|
||||
public ControlColorDisplay(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getValue() {
|
||||
return value;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColor getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IFlowerColor value) {
|
||||
this.value = value;
|
||||
}
|
||||
@Override
|
||||
public void setValue(IFlowerColor value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
IArea area = getArea();
|
||||
CraftGUI.render.solid(area, -1);
|
||||
CraftGUI.render.solid(area.inset(1), 0xff000000 + getValue().getColor(false));
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
IArea area = getArea();
|
||||
CraftGUI.render.solid(area, -1);
|
||||
CraftGUI.render.solid(area.inset(1), 0xff000000 + getValue().getColor(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
super.getTooltip(tooltip);
|
||||
tooltip.add(value.getName());
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
super.getTooltip(tooltip);
|
||||
tooltip.add(value.getName());
|
||||
}
|
||||
}
|
||||
@@ -5,20 +5,20 @@ import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||
|
||||
public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
||||
private Type type;
|
||||
private Type type;
|
||||
|
||||
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
||||
super(parent, x, y, width, height, 12.0f);
|
||||
this.type = type;
|
||||
}
|
||||
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
||||
super(parent, x, y, width, height, 12.0f);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget createOption(IColourMix value, int y) {
|
||||
return new ControlColorMixItem(getContent(), value, y);
|
||||
}
|
||||
@Override
|
||||
public IWidget createOption(IColourMix value, int y) {
|
||||
return new ControlColorMixItem(getContent(), value, y);
|
||||
}
|
||||
|
||||
enum Type {
|
||||
Resultant,
|
||||
Further
|
||||
}
|
||||
enum Type {
|
||||
Resultant,
|
||||
Further
|
||||
}
|
||||
}
|
||||
@@ -5,26 +5,26 @@ import binnie.core.craftgui.controls.listbox.ControlList;
|
||||
import binnie.core.craftgui.controls.listbox.ControlOption;
|
||||
|
||||
public class ControlColorMixItem extends ControlOption<IColourMix> {
|
||||
protected ControlColorDisplay itemWidget1;
|
||||
protected ControlColorDisplay itemWidget2;
|
||||
protected ControlColorDisplay itemWidget3;
|
||||
protected ControlColourMixSymbol addSymbol;
|
||||
protected ControlColourMixSymbol arrowSymbol;
|
||||
protected ControlColorDisplay itemWidget1;
|
||||
protected ControlColorDisplay itemWidget2;
|
||||
protected ControlColorDisplay itemWidget3;
|
||||
protected ControlColourMixSymbol addSymbol;
|
||||
protected ControlColourMixSymbol arrowSymbol;
|
||||
|
||||
public ControlColorMixItem(ControlList<IColourMix> controlList, IColourMix option, int y) {
|
||||
super(controlList, option, y);
|
||||
itemWidget1 = new ControlColorDisplay(this, 4.0f, 4.0f);
|
||||
itemWidget2 = new ControlColorDisplay(this, 44.0f, 4.0f);
|
||||
itemWidget3 = new ControlColorDisplay(this, 104.0f, 4.0f);
|
||||
addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||
arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||
public ControlColorMixItem(ControlList<IColourMix> controlList, IColourMix option, int y) {
|
||||
super(controlList, option, y);
|
||||
itemWidget1 = new ControlColorDisplay(this, 4.0f, 4.0f);
|
||||
itemWidget2 = new ControlColorDisplay(this, 44.0f, 4.0f);
|
||||
itemWidget3 = new ControlColorDisplay(this, 104.0f, 4.0f);
|
||||
addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||
arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||
|
||||
if (getValue() != null) {
|
||||
itemWidget1.setValue(getValue().getColor1());
|
||||
itemWidget2.setValue(getValue().getColor2());
|
||||
itemWidget3.setValue(getValue().getResult());
|
||||
addSymbol.setValue(getValue());
|
||||
arrowSymbol.setValue(getValue());
|
||||
}
|
||||
}
|
||||
if (getValue() != null) {
|
||||
itemWidget1.setValue(getValue().getColor1());
|
||||
itemWidget2.setValue(getValue().getColor2());
|
||||
itemWidget3.setValue(getValue().getResult());
|
||||
addSymbol.setValue(getValue());
|
||||
arrowSymbol.setValue(getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,20 +9,21 @@ import binnie.core.craftgui.geometry.CraftGUIUtil;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
|
||||
public class ControlColorOption extends ControlTextOption<IFlowerColor> {
|
||||
protected ControlColorDisplay controlBee;
|
||||
protected IPoint boxPosition;
|
||||
protected ControlColorDisplay controlBee;
|
||||
protected IPoint boxPosition;
|
||||
|
||||
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
|
||||
super(controlList, option, option.getName(), y);
|
||||
setSize(new IPoint(getSize().x(), 20.0f));
|
||||
(controlBee = new ControlColorDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f));
|
||||
textWidget.setSize(textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
||||
int th = (int) CraftGUI.render.textHeight(textWidget.getValue(), textWidget.getSize().x());
|
||||
int height = Math.max(20, th + 6);
|
||||
setSize(new IPoint(size().x(), height));
|
||||
textWidget.setSize(new IPoint(textWidget.getSize().x(), height));
|
||||
boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
||||
}
|
||||
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
|
||||
super(controlList, option, option.getName(), y);
|
||||
setSize(new IPoint(getSize().x(), 20.0f));
|
||||
(controlBee = new ControlColorDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f));
|
||||
textWidget.setSize(textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
||||
int th = (int) CraftGUI.render.textHeight(
|
||||
textWidget.getValue(), textWidget.getSize().x());
|
||||
int height = Math.max(20, th + 6);
|
||||
setSize(new IPoint(size().x(), height));
|
||||
textWidget.setSize(new IPoint(textWidget.getSize().x(), height));
|
||||
boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
||||
}
|
||||
}
|
||||
@@ -14,39 +14,39 @@ import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||
protected static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||
protected static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||
|
||||
protected IColourMix value;
|
||||
protected int type;
|
||||
protected IColourMix value;
|
||||
protected int type;
|
||||
|
||||
protected ControlColourMixSymbol(IWidget parent, int x, int y, int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||
this.type = type;
|
||||
value = null;
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
}
|
||||
protected ControlColourMixSymbol(IWidget parent, int x, int y, int type) {
|
||||
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||
this.type = type;
|
||||
value = null;
|
||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
if (type == 0) {
|
||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
||||
} else {
|
||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationArrow, IPoint.ZERO);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
super.onRenderBackground();
|
||||
if (type == 0) {
|
||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
||||
} else {
|
||||
CraftGUI.render.texture(ControlColourMixSymbol.MutationArrow, IPoint.ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(IColourMix value) {
|
||||
this.value = value;
|
||||
setColor(0xffffff);
|
||||
}
|
||||
public void setValue(IColourMix value) {
|
||||
this.value = value;
|
||||
setColor(0xffffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (type == 1) {
|
||||
float chance = value.getChance();
|
||||
tooltip.add(I18N.localise("botany.gui.controls.colorMixSymbol.chance", chance));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (type == 1) {
|
||||
float chance = value.getChance();
|
||||
tooltip.add(I18N.localise("botany.gui.controls.colorMixSymbol.chance", chance));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,28 +9,27 @@ import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.database.PageAbstract;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageColorMix extends PageAbstract<IFlowerColor> {
|
||||
ControlText title;
|
||||
ControlColorMixBox list;
|
||||
ControlText title;
|
||||
ControlColorMixBox list;
|
||||
|
||||
public PageColorMix(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageColorFurtherTitle"));
|
||||
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further);
|
||||
}
|
||||
public PageColorMix(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageColorFurtherTitle"));
|
||||
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(IFlowerColor colour) {
|
||||
List<IColourMix> mixes = new ArrayList<>();
|
||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getColor1() == colour || mix.getColor2() == colour) {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
list.setOptions(mixes);
|
||||
}
|
||||
@Override
|
||||
public void onValueChanged(IFlowerColor colour) {
|
||||
List<IColourMix> mixes = new ArrayList<>();
|
||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getColor1() == colour || mix.getColor2() == colour) {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
list.setOptions(mixes);
|
||||
}
|
||||
}
|
||||
@@ -9,28 +9,27 @@ import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.database.PageAbstract;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
|
||||
protected ControlText title;
|
||||
protected ControlColorMixBox list;
|
||||
protected ControlText title;
|
||||
protected ControlColorMixBox list;
|
||||
|
||||
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageSpeciesFurtherTitle"));
|
||||
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant);
|
||||
}
|
||||
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageSpeciesFurtherTitle"));
|
||||
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(IFlowerColor color) {
|
||||
List<IColourMix> mixes = new ArrayList<>();
|
||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getResult() == color) {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
list.setOptions(mixes);
|
||||
}
|
||||
@Override
|
||||
public void onValueChanged(IFlowerColor color) {
|
||||
List<IColourMix> mixes = new ArrayList<>();
|
||||
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||
if (mix.getResult() == color) {
|
||||
mixes.add(mix);
|
||||
}
|
||||
}
|
||||
list.setOptions(mixes);
|
||||
}
|
||||
}
|
||||
@@ -25,84 +25,137 @@ import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||
public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
}
|
||||
public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(IAlleleSpecies species) {
|
||||
deleteAllChildren();
|
||||
IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
|
||||
if (template == null) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onValueChanged(IAlleleSpecies species) {
|
||||
deleteAllChildren();
|
||||
IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
|
||||
if (template == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlowerGenome genome = tree.getGenome();
|
||||
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||
int w = 144;
|
||||
int h = 176;
|
||||
IFlowerGenome genome = tree.getGenome();
|
||||
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||
int w = 144;
|
||||
int h = 176;
|
||||
|
||||
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), I18N.localise("botany.gui.database.tab.genome"), TextJustification.MIDDLE_CENTER);
|
||||
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||
new ControlText(
|
||||
this,
|
||||
new IArea(0.0f, 4.0f, w, 16.0f),
|
||||
I18N.localise("botany.gui.database.tab.genome"),
|
||||
TextJustification.MIDDLE_CENTER);
|
||||
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||
|
||||
int tw = w - 8 - 12;
|
||||
int w2 = 55;
|
||||
int w3 = tw - 50;
|
||||
int y = 0;
|
||||
int th = 14;
|
||||
int valueX = w2 + 4;
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.temp"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getTemperature()), TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
int tw = w - 8 - 12;
|
||||
int w2 = 55;
|
||||
int w3 = tw - 50;
|
||||
int y = 0;
|
||||
int th = 14;
|
||||
int valueX = w2 + 4;
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y, w2, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.temp"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(valueX, y, w3, th),
|
||||
AlleleHelper.toDisplay(treeSpecies.getTemperature()),
|
||||
TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.moist"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getMoisture()), TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y, w2, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.moist"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(valueX, y, w3, th),
|
||||
AlleleHelper.toDisplay(treeSpecies.getMoisture()),
|
||||
TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.ph"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getPH()), TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y, w2, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.ph"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(valueX, y, w3, th),
|
||||
AlleleHelper.toDisplay(treeSpecies.getPH()),
|
||||
TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.fertility"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y, w2, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.fertility"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(
|
||||
contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
|
||||
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||
String lifespanValue = String.format("%.2f", lifespan);
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.lifespan"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||
String lifespanValue = String.format("%.2f", lifespan);
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y, w2, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.lifespan"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(valueX, y, w3, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue),
|
||||
TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
|
||||
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.nectar"), TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y, w2, th),
|
||||
I18N.localise("botany.gui.database.tab.genome.nectar"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(valueX, y, w3, th),
|
||||
genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(),
|
||||
TextJustification.MIDDLE_LEFT);
|
||||
y += th;
|
||||
|
||||
int x = w2;
|
||||
int tot = 0;
|
||||
for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||
if (tot > 0 && tot % 3 == 0) {
|
||||
x -= 54;
|
||||
y += 18;
|
||||
}
|
||||
ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER.ordinal());
|
||||
ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
||||
display.setItemStack(stack);
|
||||
tot++;
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
int x = w2;
|
||||
int tot = 0;
|
||||
for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||
if (tot > 0 && tot % 3 == 0) {
|
||||
x -= 54;
|
||||
y += 18;
|
||||
}
|
||||
ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER.ordinal());
|
||||
ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
||||
display.setItemStack(stack);
|
||||
tot++;
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
|
||||
int numOfLines = 1 + (tot - 1) / 3;
|
||||
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise("botany.gui.database.tab.genome.varieties"), TextJustification.MIDDLE_RIGHT);
|
||||
y += th;
|
||||
contents.setSize(new IPoint(contents.size().x(), y));
|
||||
scrollable.setScrollableContent(contents);
|
||||
}
|
||||
int numOfLines = 1 + (tot - 1) / 3;
|
||||
new ControlText(
|
||||
contents,
|
||||
new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines),
|
||||
I18N.localise("botany.gui.database.tab.genome.varieties"),
|
||||
TextJustification.MIDDLE_RIGHT);
|
||||
y += th;
|
||||
contents.setSize(new IPoint(contents.size().x(), y));
|
||||
scrollable.setScrollableContent(contents);
|
||||
}
|
||||
}
|
||||
@@ -21,71 +21,71 @@ import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
|
||||
}
|
||||
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||
return new WindowBotanistDatabase(player, side, nei);
|
||||
}
|
||||
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||
return new WindowBotanistDatabase(player, side, nei);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview"));
|
||||
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome"));
|
||||
new PageSpeciesClassification(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification"));
|
||||
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant"));
|
||||
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 ColorModeWidget());
|
||||
new PageColorMixResultant(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.resultant"));
|
||||
new PageColorMix(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.further"));
|
||||
new PageBreeder(getInfoPages(Mode.Breeder), getUsername(), new DatabaseTab(Botany.instance, "breeder"));
|
||||
}
|
||||
@Override
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview"));
|
||||
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome"));
|
||||
new PageSpeciesClassification(
|
||||
getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification"));
|
||||
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant"));
|
||||
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 ColorModeWidget());
|
||||
new PageColorMixResultant(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.resultant"));
|
||||
new PageColorMix(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.further"));
|
||||
new PageBreeder(getInfoPages(Mode.Breeder), getUsername(), new DatabaseTab(Botany.instance, "breeder"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
@Override
|
||||
protected AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName() {
|
||||
return I18N.localise("botany.gui.database.name");
|
||||
}
|
||||
@Override
|
||||
protected String getName() {
|
||||
return I18N.localise("botany.gui.database.name");
|
||||
}
|
||||
|
||||
enum FlowerMode implements IDatabaseMode {
|
||||
COLOR;
|
||||
enum FlowerMode implements IDatabaseMode {
|
||||
COLOR;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("botany.gui.database.tab." + name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("botany.gui.database.tab." + name().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
private class ColorModeWidget extends ModeWidgets {
|
||||
public ColorModeWidget() {
|
||||
super(FlowerMode.COLOR, WindowBotanistDatabase.this);
|
||||
}
|
||||
private class ColorModeWidget extends ModeWidgets {
|
||||
public ColorModeWidget() {
|
||||
super(FlowerMode.COLOR, WindowBotanistDatabase.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createListBox(IArea area) {
|
||||
listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
@Override
|
||||
public IWidget createOption(IFlowerColor value, int y) {
|
||||
return new ControlColorOption(getContent(), value, y);
|
||||
}
|
||||
};
|
||||
List<IFlowerColor> colors = new ArrayList<>();
|
||||
Collections.addAll(colors, EnumFlowerColor.values());
|
||||
listBox.setOptions(colors);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void createListBox(IArea area) {
|
||||
listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||
@Override
|
||||
public IWidget createOption(IFlowerColor value, int y) {
|
||||
return new ControlColorOption(getContent(), value, y);
|
||||
}
|
||||
};
|
||||
List<IFlowerColor> colors = new ArrayList<>();
|
||||
Collections.addAll(colors, EnumFlowerColor.values());
|
||||
listBox.setOptions(colors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,97 +11,100 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class CircuitGarden extends BinnieCircuit {
|
||||
private boolean isManual;
|
||||
private boolean isFertilised;
|
||||
private ItemStack icon;
|
||||
private EnumMoisture moisture;
|
||||
private EnumAcidity acidity;
|
||||
private boolean isManual;
|
||||
private boolean isFertilised;
|
||||
private ItemStack icon;
|
||||
private EnumMoisture moisture;
|
||||
private EnumAcidity acidity;
|
||||
|
||||
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
|
||||
super("garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "") + (fertilised ? ".fert" : ""), 4, manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), recipe);
|
||||
this.moisture = moisture;
|
||||
this.icon = icon;
|
||||
isManual = manual;
|
||||
isFertilised = fertilised;
|
||||
acidity = ph;
|
||||
String info = "";
|
||||
public CircuitGarden(
|
||||
EnumMoisture moisture,
|
||||
EnumAcidity ph,
|
||||
boolean manual,
|
||||
boolean fertilised,
|
||||
ItemStack recipe,
|
||||
ItemStack icon) {
|
||||
super(
|
||||
"garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "")
|
||||
+ (fertilised ? ".fert" : ""),
|
||||
4,
|
||||
manual
|
||||
? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual")
|
||||
: ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"),
|
||||
recipe);
|
||||
this.moisture = moisture;
|
||||
this.icon = icon;
|
||||
isManual = manual;
|
||||
isFertilised = fertilised;
|
||||
acidity = ph;
|
||||
String info = "";
|
||||
|
||||
if (moisture == EnumMoisture.DRY) {
|
||||
info += EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.moisture.dry")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (moisture == EnumMoisture.DRY) {
|
||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.dry") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
info += EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.moisture.damp")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.damp") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (acidity == EnumAcidity.ACID) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.RED
|
||||
+ I18N.localise("botany.ph.acid")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (acidity == EnumAcidity.ACID) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (acidity == EnumAcidity.NEUTRAL) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.GREEN
|
||||
+ I18N.localise("botany.ph.neutral")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (acidity == EnumAcidity.NEUTRAL) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (acidity == EnumAcidity.ALKALINE) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.AQUA
|
||||
+ I18N.localise("botany.ph.alkaline")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (acidity == EnumAcidity.ALKALINE) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (info.length() > 0) {
|
||||
info = " (" + info + EnumChatFormatting.RESET + ")";
|
||||
}
|
||||
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
info = " (" + info + EnumChatFormatting.RESET + ")";
|
||||
}
|
||||
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(Object tile) {
|
||||
return tile instanceof IFarmHousing;
|
||||
}
|
||||
@Override
|
||||
public boolean isCircuitable(Object tile) {
|
||||
return tile instanceof IFarmHousing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int slot, Object tile) {
|
||||
if (!isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onInsertion(int slot, Object tile) {
|
||||
if (!isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||
logic.setData(moisture, acidity, isManual, isFertilised, icon, I18N.localise(getName()));
|
||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||
logic.setData(moisture, acidity, isManual, isFertilised, icon, I18N.localise(getName()));
|
||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int slot, Object tile) {
|
||||
onInsertion(slot, tile);
|
||||
}
|
||||
@Override
|
||||
public void onLoad(int slot, Object tile) {
|
||||
onInsertion(slot, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int slot, Object tile) {
|
||||
if (!isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||
}
|
||||
@Override
|
||||
public void onRemoval(int slot, Object tile) {
|
||||
if (!isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -10,49 +10,48 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class FarmLogic implements IFarmLogic {
|
||||
protected World world;
|
||||
protected IFarmHousing housing;
|
||||
protected boolean isManual;
|
||||
protected World world;
|
||||
protected IFarmHousing housing;
|
||||
protected boolean isManual;
|
||||
|
||||
public FarmLogic(IFarmHousing housing) {
|
||||
this.housing = housing;
|
||||
}
|
||||
public FarmLogic(IFarmHousing housing) {
|
||||
this.housing = housing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFarmLogic setManual(boolean flag) {
|
||||
isManual = flag;
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public IFarmLogic setManual(boolean flag) {
|
||||
isManual = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected boolean isAirBlock(Vect position) {
|
||||
return world.isAirBlock(position.x, position.y, position.z);
|
||||
}
|
||||
protected boolean isAirBlock(Vect position) {
|
||||
return world.isAirBlock(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
protected boolean isWaterBlock(Vect position) {
|
||||
return world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
||||
}
|
||||
protected boolean isWaterBlock(Vect position) {
|
||||
return world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
||||
}
|
||||
|
||||
protected Block getBlock(Vect position) {
|
||||
return world.getBlock(position.x, position.y, position.z);
|
||||
}
|
||||
protected Block getBlock(Vect position) {
|
||||
return world.getBlock(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
protected int getBlockMeta(Vect position) {
|
||||
return world.getBlockMetadata(position.x, position.y, position.z);
|
||||
}
|
||||
protected int getBlockMeta(Vect position) {
|
||||
return world.getBlockMetadata(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
protected ItemStack getAsItemStack(Vect position) {
|
||||
return new ItemStack(getBlock(position), 1, getBlockMeta(position));
|
||||
}
|
||||
protected ItemStack getAsItemStack(Vect position) {
|
||||
return new ItemStack(getBlock(position), 1, getBlockMeta(position));
|
||||
}
|
||||
|
||||
protected Vect translateWithOffset(int x, int y, int z, FarmDirection direction, int step) {
|
||||
return new Vect(
|
||||
x + direction.getForgeDirection().offsetX * step,
|
||||
y + direction.getForgeDirection().offsetY * step,
|
||||
z + direction.getForgeDirection().offsetZ * step
|
||||
);
|
||||
}
|
||||
protected Vect translateWithOffset(int x, int y, int z, FarmDirection direction, int step) {
|
||||
return new Vect(
|
||||
x + direction.getForgeDirection().offsetX * step,
|
||||
y + direction.getForgeDirection().offsetY * step,
|
||||
z + direction.getForgeDirection().offsetZ * step);
|
||||
}
|
||||
|
||||
protected void setBlock(Vect position, Block block, int meta) {
|
||||
world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
||||
}
|
||||
protected void setBlock(Vect position, Block block, int meta) {
|
||||
world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
||||
}
|
||||
}
|
||||
@@ -12,31 +12,31 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmableFlower implements IFarmable {
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == Botany.flower;
|
||||
}
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == Botany.flower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICrop getCropAt(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ICrop getCropAt(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||
}
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindfall(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isWindfall(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmableVanillaFlower extends FarmableFlower {
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||
}
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
}
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||
IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,9 @@ import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.access.IOwnable;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -28,380 +31,389 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class GardenLogic extends FarmLogic {
|
||||
protected EnumMoisture moisture;
|
||||
protected EnumAcidity acidity;
|
||||
protected boolean fertilised;
|
||||
protected String name;
|
||||
protected ArrayList<ItemStack> produce;
|
||||
protected List<IFarmable> farmables;
|
||||
protected EnumMoisture moisture;
|
||||
protected EnumAcidity acidity;
|
||||
protected boolean fertilised;
|
||||
protected String name;
|
||||
protected ArrayList<ItemStack> produce;
|
||||
protected List<IFarmable> farmables;
|
||||
|
||||
private ItemStack icon;
|
||||
private ItemStack icon;
|
||||
|
||||
public GardenLogic(IFarmHousing housing) {
|
||||
super(housing);
|
||||
produce = new ArrayList<>();
|
||||
farmables = new ArrayList<>();
|
||||
farmables.add(new FarmableFlower());
|
||||
farmables.add(new FarmableVanillaFlower());
|
||||
}
|
||||
public GardenLogic(IFarmHousing housing) {
|
||||
super(housing);
|
||||
produce = new ArrayList<>();
|
||||
farmables = new ArrayList<>();
|
||||
farmables.add(new FarmableFlower());
|
||||
farmables.add(new FarmableVanillaFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertilizerConsumption() {
|
||||
return fertilised ? 8 : 2;
|
||||
}
|
||||
@Override
|
||||
public int getFertilizerConsumption() {
|
||||
return fertilised ? 8 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterConsumption(float hydrationModifier) {
|
||||
return (int) (moisture.ordinal() * 40 * hydrationModifier);
|
||||
}
|
||||
@Override
|
||||
public int getWaterConsumption(float hydrationModifier) {
|
||||
return (int) (moisture.ordinal() * 40 * hydrationModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedResource(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
return Gardening.isSoil(item)
|
||||
|| item == Item.getItemFromBlock(Blocks.sand)
|
||||
|| item == Item.getItemFromBlock(Blocks.dirt)
|
||||
|| Gardening.isAcidFertiliser(stack)
|
||||
|| Gardening.isAlkalineFertiliser(stack);
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedResource(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
return Gardening.isSoil(item)
|
||||
|| item == Item.getItemFromBlock(Blocks.sand)
|
||||
|| item == Item.getItemFromBlock(Blocks.dirt)
|
||||
|| Gardening.isAcidFertiliser(stack)
|
||||
|| Gardening.isAlkalineFertiliser(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> collect() {
|
||||
Collection<ItemStack> products = produce;
|
||||
produce = new ArrayList<>();
|
||||
return products;
|
||||
}
|
||||
@Override
|
||||
public Collection<ItemStack> collect() {
|
||||
Collection<ItemStack> products = produce;
|
||||
produce = new ArrayList<>();
|
||||
return products;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cultivate(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
world = housing.getWorld();
|
||||
return maintainSoil(x, y, z, direction, extent)
|
||||
|| !isManual && maintainWater(x, y, z, direction, extent)
|
||||
|| maintainCrops(x, y + 1, z, direction, extent);
|
||||
}
|
||||
@Override
|
||||
public boolean cultivate(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
world = housing.getWorld();
|
||||
return maintainSoil(x, y, z, direction, extent)
|
||||
|| !isManual && maintainWater(x, y, z, direction, extent)
|
||||
|| maintainCrops(x, y + 1, z, direction, extent);
|
||||
}
|
||||
|
||||
private boolean isWaste(ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
||||
}
|
||||
private boolean isWaste(ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
||||
}
|
||||
|
||||
private boolean maintainSoil(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
boolean isSoil = Gardening.isSoil(world.getBlock(position.x, position.y, position.z));
|
||||
|
||||
// remove unnecessary blocks
|
||||
if (!isManual && !isSoil && !isAirBlock(position)) {
|
||||
Block block = world.getBlock(position.x, position.y, position.z);
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
if (block != Blocks.water) {
|
||||
dropBlockAsProduction(position);
|
||||
}
|
||||
} else if (moisture == EnumMoisture.DRY) {
|
||||
if (block != Blocks.sand) {
|
||||
dropBlockAsProduction(position);
|
||||
}
|
||||
} else {
|
||||
dropBlockAsProduction(position);
|
||||
}
|
||||
}
|
||||
private boolean maintainSoil(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
boolean isSoil = Gardening.isSoil(world.getBlock(position.x, position.y, position.z));
|
||||
|
||||
if (fertilised && isSoil) {
|
||||
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||
if (soil.fertilise(world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// remove unnecessary blocks
|
||||
if (!isManual && !isSoil && !isAirBlock(position)) {
|
||||
Block block = world.getBlock(position.x, position.y, position.z);
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
if (block != Blocks.water) {
|
||||
dropBlockAsProduction(position);
|
||||
}
|
||||
} else if (moisture == EnumMoisture.DRY) {
|
||||
if (block != Blocks.sand) {
|
||||
dropBlockAsProduction(position);
|
||||
}
|
||||
} else {
|
||||
dropBlockAsProduction(position);
|
||||
}
|
||||
}
|
||||
|
||||
if (world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||
world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||
continue;
|
||||
}
|
||||
if (fertilised && isSoil) {
|
||||
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||
if (soil.fertilise(world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (acidity != null && isSoil) {
|
||||
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||
EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z);
|
||||
if (pH.ordinal() < acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAlkaline();
|
||||
if (stack != null && soil.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
housing.getFarmInventory().removeResources(new ItemStack[]{stack});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||
world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pH.ordinal() > acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAcid();
|
||||
if (stack != null && soil.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
housing.getFarmInventory().removeResources(new ItemStack[]{stack});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (acidity != null && isSoil) {
|
||||
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||
EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z);
|
||||
if (pH.ordinal() < acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAlkaline();
|
||||
if (stack != null
|
||||
&& soil.setPH(
|
||||
world,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z,
|
||||
EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
housing.getFarmInventory().removeResources(new ItemStack[] {stack});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAirBlock(position) && !world.getBlock(position.x, position.y, position.z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||
ItemStack block = getAsItemStack(position);
|
||||
ItemStack loam = getAvailableLoam();
|
||||
if (isWaste(block) && loam != null) {
|
||||
produce.addAll(Blocks.dirt.getDrops(world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||
setBlock(position, Blocks.air, 0);
|
||||
return trySetSoil(position, loam);
|
||||
}
|
||||
} else if (!isManual) {
|
||||
if (!isWaterBlock(position)) {
|
||||
if (i % 2 == 0) {
|
||||
return trySetSoil(position);
|
||||
}
|
||||
if (pH.ordinal() > acidity.ordinal()) {
|
||||
ItemStack stack = getAvailableAcid();
|
||||
if (stack != null
|
||||
&& soil.setPH(
|
||||
world,
|
||||
position.x,
|
||||
position.y,
|
||||
position.z,
|
||||
EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
housing.getFarmInventory().removeResources(new ItemStack[] {stack});
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FarmDirection cclock = FarmDirection.EAST;
|
||||
if (direction == FarmDirection.EAST) {
|
||||
cclock = FarmDirection.SOUTH;
|
||||
} else if (direction == FarmDirection.SOUTH) {
|
||||
cclock = FarmDirection.EAST;
|
||||
} else if (direction == FarmDirection.WEST) {
|
||||
cclock = FarmDirection.SOUTH;
|
||||
}
|
||||
if (!isAirBlock(position)
|
||||
&& !world.getBlock(position.x, position.y, position.z)
|
||||
.isReplaceable(world, position.x, position.y, position.z)) {
|
||||
ItemStack block = getAsItemStack(position);
|
||||
ItemStack loam = getAvailableLoam();
|
||||
if (isWaste(block) && loam != null) {
|
||||
produce.addAll(
|
||||
Blocks.dirt.getDrops(world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||
setBlock(position, Blocks.air, 0);
|
||||
return trySetSoil(position, loam);
|
||||
}
|
||||
} else if (!isManual) {
|
||||
if (!isWaterBlock(position)) {
|
||||
if (i % 2 == 0) {
|
||||
return trySetSoil(position);
|
||||
}
|
||||
|
||||
Vect previous = translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||
ItemStack soil2 = getAsItemStack(previous);
|
||||
if (!Gardening.isSoil(soil2.getItem())) {
|
||||
trySetSoil(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
FarmDirection cclock = FarmDirection.EAST;
|
||||
if (direction == FarmDirection.EAST) {
|
||||
cclock = FarmDirection.SOUTH;
|
||||
} else if (direction == FarmDirection.SOUTH) {
|
||||
cclock = FarmDirection.EAST;
|
||||
} else if (direction == FarmDirection.WEST) {
|
||||
cclock = FarmDirection.SOUTH;
|
||||
}
|
||||
|
||||
private boolean maintainWater(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
if (!isAirBlock(position) && !world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||
continue;
|
||||
}
|
||||
Vect previous = translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||
ItemStack soil2 = getAsItemStack(previous);
|
||||
if (!Gardening.isSoil(soil2.getItem())) {
|
||||
trySetSoil(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isWaterBlock(position)) {
|
||||
continue;
|
||||
}
|
||||
private boolean maintainWater(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
if (!isAirBlock(position)
|
||||
&& !world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isEnclosed = true;
|
||||
if (world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
} else if (world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
} else if (world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||
isEnclosed = false;
|
||||
} else if (world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
if (isWaterBlock(position)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP);
|
||||
if (isEnclosed) {
|
||||
return trySetWater(position);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
boolean isEnclosed = true;
|
||||
if (world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
} else if (world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
} else if (world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||
isEnclosed = false;
|
||||
} else if (world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
|
||||
private ItemStack getAvailableLoam() {
|
||||
EnumMoisture[] moistures;
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
moistures = new EnumMoisture[]{
|
||||
EnumMoisture.DAMP,
|
||||
EnumMoisture.NORMAL,
|
||||
EnumMoisture.DRY
|
||||
};
|
||||
} else if (moisture == EnumMoisture.DRY) {
|
||||
moistures = new EnumMoisture[]{
|
||||
EnumMoisture.DRY,
|
||||
EnumMoisture.DAMP,
|
||||
EnumMoisture.DRY
|
||||
};
|
||||
} else {
|
||||
moistures = new EnumMoisture[]{
|
||||
EnumMoisture.DRY,
|
||||
EnumMoisture.NORMAL,
|
||||
EnumMoisture.DAMP
|
||||
};
|
||||
}
|
||||
isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP);
|
||||
if (isEnclosed) {
|
||||
return trySetWater(position);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumAcidity[] acidities = {
|
||||
EnumAcidity.NEUTRAL,
|
||||
EnumAcidity.ACID,
|
||||
EnumAcidity.ALKALINE
|
||||
};
|
||||
private ItemStack getAvailableLoam() {
|
||||
EnumMoisture[] moistures;
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
moistures = new EnumMoisture[] {EnumMoisture.DAMP, EnumMoisture.NORMAL, EnumMoisture.DRY};
|
||||
} else if (moisture == EnumMoisture.DRY) {
|
||||
moistures = new EnumMoisture[] {EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY};
|
||||
} else {
|
||||
moistures = new EnumMoisture[] {EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP};
|
||||
}
|
||||
|
||||
for (EnumMoisture moist : moistures) {
|
||||
for (EnumAcidity acid : acidities) {
|
||||
for (Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) {
|
||||
int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||
ItemStack[] resource = {new ItemStack(type, 1, meta)};
|
||||
if (housing.getFarmInventory().hasResources(resource)) {
|
||||
return resource[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EnumAcidity[] acidities = {EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE};
|
||||
|
||||
if (housing.getFarmInventory().hasResources(new ItemStack[]{new ItemStack(Blocks.dirt)})) {
|
||||
return new ItemStack(Blocks.dirt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
for (EnumMoisture moist : moistures) {
|
||||
for (EnumAcidity acid : acidities) {
|
||||
for (Block type : new Block[] {Botany.flowerbed, Botany.loam, Botany.soil}) {
|
||||
int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||
ItemStack[] resource = {new ItemStack(type, 1, meta)};
|
||||
if (housing.getFarmInventory().hasResources(resource)) {
|
||||
return resource[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean trySetSoil(Vect position) {
|
||||
return trySetSoil(position, getAvailableLoam());
|
||||
}
|
||||
if (housing.getFarmInventory().hasResources(new ItemStack[] {new ItemStack(Blocks.dirt)})) {
|
||||
return new ItemStack(Blocks.dirt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean trySetSoil(Vect position, ItemStack loam) {
|
||||
ItemStack copy = loam;
|
||||
if (loam == null) {
|
||||
return false;
|
||||
}
|
||||
private boolean trySetSoil(Vect position) {
|
||||
return trySetSoil(position, getAvailableLoam());
|
||||
}
|
||||
|
||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
||||
loam = new ItemStack(Botany.soil, 0, 4);
|
||||
}
|
||||
private boolean trySetSoil(Vect position, ItemStack loam) {
|
||||
ItemStack copy = loam;
|
||||
if (loam == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||
housing.getFarmInventory().removeResources(new ItemStack[]{copy});
|
||||
return true;
|
||||
}
|
||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
||||
loam = new ItemStack(Botany.soil, 0, 4);
|
||||
}
|
||||
|
||||
private boolean trySetWater(Vect position) {
|
||||
FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
if (!housing.hasLiquid(water)) {
|
||||
return false;
|
||||
}
|
||||
setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||
housing.getFarmInventory().removeResources(new ItemStack[] {copy});
|
||||
return true;
|
||||
}
|
||||
|
||||
setBlock(position, Blocks.water, 0);
|
||||
housing.removeLiquid(water);
|
||||
return true;
|
||||
}
|
||||
private boolean trySetWater(Vect position) {
|
||||
FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
if (!housing.hasLiquid(water)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (moisture != EnumMoisture.DRY) {
|
||||
return trySetSoil(position);
|
||||
}
|
||||
setBlock(position, Blocks.water, 0);
|
||||
housing.removeLiquid(water);
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack[] sand = {new ItemStack(Blocks.sand, 1)};
|
||||
if (!housing.getFarmInventory().hasResources(sand)) {
|
||||
return false;
|
||||
}
|
||||
if (moisture != EnumMoisture.DRY) {
|
||||
return trySetSoil(position);
|
||||
}
|
||||
|
||||
setBlock(position, Blocks.sand, 0);
|
||||
housing.getFarmInventory().removeResources(sand);
|
||||
return true;
|
||||
}
|
||||
ItemStack[] sand = {new ItemStack(Blocks.sand, 1)};
|
||||
if (!housing.getFarmInventory().hasResources(sand)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void dropBlockAsProduction(Vect position) {
|
||||
ItemStack stack = new ItemStack(world.getBlock(position.x, position.y, position.z));
|
||||
if (stack.getItem() == null) {
|
||||
return;
|
||||
}
|
||||
produce.add(stack);
|
||||
world.setBlockToAir(position.x, position.y, position.z);
|
||||
}
|
||||
setBlock(position, Blocks.sand, 0);
|
||||
housing.getFarmInventory().removeResources(sand);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedGermling(ItemStack stack) {
|
||||
for (IFarmable farmable : farmables) {
|
||||
if (farmable.isGermling(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private void dropBlockAsProduction(Vect position) {
|
||||
ItemStack stack = new ItemStack(world.getBlock(position.x, position.y, position.z));
|
||||
if (stack.getItem() == null) {
|
||||
return;
|
||||
}
|
||||
produce.add(stack);
|
||||
world.setBlockToAir(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ICrop> harvest(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedGermling(ItemStack stack) {
|
||||
for (IFarmable farmable : farmables) {
|
||||
if (farmable.isGermling(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return icon.getIconIndex();
|
||||
}
|
||||
@Override
|
||||
public Collection<ICrop> harvest(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setIcon(ItemStack icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return icon.getIconIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSpriteSheet() {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
public void setIcon(ItemStack icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getSpriteSheet() {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
protected boolean maintainCrops(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
if (isAirBlock(position) || world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||
ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||
if (Gardening.isSoil(below.getItem())) {
|
||||
return trySetCrop(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
private boolean trySetCrop(Vect position) {
|
||||
for (IFarmable farmable : farmables) {
|
||||
boolean success = housing.plantGermling(farmable, world, position.x, position.y, position.z);
|
||||
if (!success || !(housing instanceof IOwnable)) {
|
||||
continue;
|
||||
}
|
||||
protected boolean maintainCrops(int x, int y, int z, FarmDirection direction, int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
if (isAirBlock(position)
|
||||
|| world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||
ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||
if (Gardening.isSoil(below.getItem())) {
|
||||
return trySetCrop(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
private boolean trySetCrop(Vect position) {
|
||||
for (IFarmable farmable : farmables) {
|
||||
boolean success = housing.plantGermling(farmable, world, position.x, position.y, position.z);
|
||||
if (!success || !(housing instanceof IOwnable)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
IOwnable housing2 = (IOwnable) housing;
|
||||
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2);
|
||||
((TileEntityFlower) tile).setOwner(prof);
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
TileEntity tile = housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAcid() {
|
||||
for (ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
IOwnable housing2 = (IOwnable) housing;
|
||||
GameProfile prof = (GameProfile) IOwnable.class
|
||||
.getMethod("getOwnerProfile", new Class[0])
|
||||
.invoke(housing2);
|
||||
((TileEntityFlower) tile).setOwner(prof);
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAlkaline() {
|
||||
for (ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public ItemStack getAvailableAcid() {
|
||||
for (ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||
if (stack != null
|
||||
&& stack.getItem() != null
|
||||
&& housing.getFarmInventory().hasResources(new ItemStack[] {stack})) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setData(EnumMoisture moisture, EnumAcidity acidity, boolean isManual, boolean fertilised, ItemStack icon, String name) {
|
||||
this.moisture = moisture;
|
||||
this.acidity = acidity;
|
||||
this.isManual = isManual;
|
||||
this.fertilised = fertilised;
|
||||
this.icon = icon;
|
||||
this.name = name;
|
||||
}
|
||||
public ItemStack getAvailableAlkaline() {
|
||||
for (ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||
if (stack != null
|
||||
&& stack.getItem() != null
|
||||
&& housing.getFarmInventory().hasResources(new ItemStack[] {stack})) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setData(
|
||||
EnumMoisture moisture,
|
||||
EnumAcidity acidity,
|
||||
boolean isManual,
|
||||
boolean fertilised,
|
||||
ItemStack icon,
|
||||
String name) {
|
||||
this.moisture = moisture;
|
||||
this.acidity = acidity;
|
||||
this.isManual = isManual;
|
||||
this.fertilised = fertilised;
|
||||
this.icon = icon;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ import binnie.core.BinnieCore;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -25,208 +28,201 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockFlower extends BlockContainer {
|
||||
public BlockFlower() {
|
||||
super(Material.plants);
|
||||
float f = 0.2f;
|
||||
setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||
setTickRandomly(true);
|
||||
setBlockName("flower");
|
||||
setStepSound(Block.soundTypeGrass);
|
||||
}
|
||||
public BlockFlower() {
|
||||
super(Material.plants);
|
||||
float f = 0.2f;
|
||||
setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||
setTickRandomly(true);
|
||||
setBlockName("flower");
|
||||
setStepSound(Block.soundTypeGrass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "botany.flower";
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "botany.flower";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (EnumFlowerType type : EnumFlowerType.values()) {
|
||||
type.registerIcons(register);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (EnumFlowerType type : EnumFlowerType.values()) {
|
||||
type.registerIcons(register);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (entity instanceof EntityPlayer) ? ((EntityPlayer) entity).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
Gardening.tryGrowSection(world, x, y, z);
|
||||
}
|
||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (entity instanceof EntityPlayer) ? ((EntityPlayer) entity).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
Gardening.tryGrowSection(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
TileEntityFlower f = (TileEntityFlower) tile;
|
||||
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
IFlowerType flower = f.getType();
|
||||
int section = f.getRenderSection();
|
||||
boolean flowered = f.isFlowered();
|
||||
if (RendererBotany.pass == 0) {
|
||||
return flower.getStem(stage, flowered, section);
|
||||
}
|
||||
TileEntityFlower f = (TileEntityFlower) tile;
|
||||
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
IFlowerType flower = f.getType();
|
||||
int section = f.getRenderSection();
|
||||
boolean flowered = f.isFlowered();
|
||||
if (RendererBotany.pass == 0) {
|
||||
return flower.getStem(stage, flowered, section);
|
||||
}
|
||||
|
||||
return (RendererBotany.pass == 1) ?
|
||||
flower.getPetalIcon(stage, flowered, section) :
|
||||
flower.getVariantIcon(stage, flowered, section);
|
||||
}
|
||||
return (RendererBotany.pass == 1)
|
||||
? flower.getPetalIcon(stage, flowered, section)
|
||||
: flower.getVariantIcon(stage, flowered, section);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower f = (TileEntityFlower) tile;
|
||||
if (RendererBotany.pass == 0) {
|
||||
return f.getStemColour();
|
||||
}
|
||||
return (RendererBotany.pass == 1) ?
|
||||
f.getPrimaryColor() :
|
||||
f.getSecondaryColor();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower f = (TileEntityFlower) tile;
|
||||
if (RendererBotany.pass == 0) {
|
||||
return f.getStemColour();
|
||||
}
|
||||
return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor();
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||
return super.canPlaceBlockAt(world, x, y, z)
|
||||
&& canBlockStay(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||
return super.canPlaceBlockAt(world, x, y, z) && canBlockStay(world, x, y, z);
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.grass
|
||||
|| block == Blocks.dirt
|
||||
|| block == Blocks.farmland
|
||||
|| Gardening.isSoil(block);
|
||||
}
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
checkAndDropBlock(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
checkAndDropBlock(world, x, y, z);
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0
|
||||
&& flower.getFlower() != null
|
||||
&& flower.getFlower().getAge() > 0
|
||||
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
||||
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0
|
||||
&& flower.getFlower() != null
|
||||
&& flower.getFlower().getAge() > 0
|
||||
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
||||
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, x, y, z);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, x, y, z);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, int x, int y, int z) {
|
||||
if (!canBlockStay(world, x, y, z)) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
protected void checkAndDropBlock(World world, int x, int y, int z) {
|
||||
if (!canBlockStay(world, x, y, z)) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return world.getBlock(x, y - 1, z) == Botany.flower;
|
||||
}
|
||||
return canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||
}
|
||||
@Override
|
||||
public boolean canBlockStay(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return world.getBlock(x, y - 1, z) == Botany.flower;
|
||||
}
|
||||
return canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (flower != null) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (flower != null) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||
if (hasBeenBroken
|
||||
&& BinnieCore.proxy.isSimulating(world)
|
||||
&& drops.size() > 0
|
||||
&& (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int meta, int side) {
|
||||
return Blocks.yellow_flower.getIcon(0, 0);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int meta, int side) {
|
||||
return Blocks.yellow_flower.getIcon(0, 0);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.config.Config;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -30,260 +31,295 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ItemBotany extends Item {
|
||||
public ItemBotany(String name) {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName(name);
|
||||
hasSubtypes = true;
|
||||
}
|
||||
public ItemBotany(String name) {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName(name);
|
||||
hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack, int pass) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack, int pass) {
|
||||
if (!stack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IIndividual individual = getIndividual(stack);
|
||||
return individual != null
|
||||
&& individual.getGenome() != null
|
||||
&& individual.hasEffect();
|
||||
}
|
||||
IIndividual individual = getIndividual(stack);
|
||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return;
|
||||
}
|
||||
IFlower individual = (IFlower) getIndividual(itemstack);
|
||||
if (individual == null) {
|
||||
tooltip.add(I18N.localise("botany.item.tooltip.bugged"));
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return;
|
||||
}
|
||||
IFlower individual = (IFlower) getIndividual(itemstack);
|
||||
if (individual == null) {
|
||||
tooltip.add(I18N.localise("botany.item.tooltip.bugged"));
|
||||
return;
|
||||
}
|
||||
|
||||
IFlowerGenome genome = individual.getGenome();
|
||||
IFlowerColor primaryColor = genome.getPrimaryColor();
|
||||
IFlowerColor secondColor = genome.getSecondaryColor();
|
||||
IFlowerColor stemColor = genome.getStemColor();
|
||||
IFlowerGenome genome = individual.getGenome();
|
||||
IFlowerColor primaryColor = genome.getPrimaryColor();
|
||||
IFlowerColor secondColor = genome.getSecondaryColor();
|
||||
IFlowerColor stemColor = genome.getStemColor();
|
||||
|
||||
if (primaryColor == secondColor) {
|
||||
tooltip.add(EnumChatFormatting.YELLOW + I18N.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.YELLOW + I18N.localise("botany.item.tooltip.flowerColor2", primaryColor.getName(), secondColor.getName(), stemColor.getName()));
|
||||
}
|
||||
if (primaryColor == secondColor) {
|
||||
tooltip.add(EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.YELLOW
|
||||
+ I18N.localise(
|
||||
"botany.item.tooltip.flowerColor2",
|
||||
primaryColor.getName(),
|
||||
secondColor.getName(),
|
||||
stemColor.getName()));
|
||||
}
|
||||
|
||||
if (individual.isAnalyzed()) {
|
||||
if (BinnieCore.proxy.isShiftDown()) {
|
||||
individual.addTooltip(tooltip);
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.holdMore"));
|
||||
}
|
||||
} else {
|
||||
tooltip.add(I18N.localise("botany.item.tooltip.unknownGenome"));
|
||||
}
|
||||
}
|
||||
if (individual.isAnalyzed()) {
|
||||
if (BinnieCore.proxy.isShiftDown()) {
|
||||
individual.addTooltip(tooltip);
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.holdMore"));
|
||||
}
|
||||
} else {
|
||||
tooltip.add(I18N.localise("botany.item.tooltip.unknownGenome"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister par1IconRegister) {}
|
||||
|
||||
protected IIndividual getIndividual(ItemStack itemstack) {
|
||||
return new Flower(itemstack.getTagCompound());
|
||||
}
|
||||
protected IIndividual getIndividual(ItemStack itemstack) {
|
||||
return new Flower(itemstack.getTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return I18N.localise("botany.item.tooltip.unknown");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return I18N.localise("botany.item.tooltip.unknown");
|
||||
}
|
||||
|
||||
IIndividual individual = getIndividual(itemstack);
|
||||
if (individual != null && individual.getGenome() != null) {
|
||||
String tag = getTag();
|
||||
if (tag == null || tag.isEmpty()) {
|
||||
return individual.getDisplayName();
|
||||
}
|
||||
return I18N.localise("botany.item.botany.name", individual.getDisplayName(), tag);
|
||||
}
|
||||
return I18N.localise("botany.item.flowerCorrupted.name");
|
||||
}
|
||||
IIndividual individual = getIndividual(itemstack);
|
||||
if (individual != null && individual.getGenome() != null) {
|
||||
String tag = getTag();
|
||||
if (tag == null || tag.isEmpty()) {
|
||||
return individual.getDisplayName();
|
||||
}
|
||||
return I18N.localise("botany.item.botany.name", individual.getDisplayName(), tag);
|
||||
}
|
||||
return I18N.localise("botany.item.flowerCorrupted.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
addCreativeItems(itemList, true);
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
addCreativeItems(itemList, true);
|
||||
}
|
||||
|
||||
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
||||
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
}
|
||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), getStage().ordinal()));
|
||||
}
|
||||
}
|
||||
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
||||
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
}
|
||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(
|
||||
individual.copy(), getStage().ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return 0xffffff;
|
||||
}
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
if (renderPass == 0) {
|
||||
return flower.getGenome().getStemColor().getColor(flower.isWilted());
|
||||
}
|
||||
return (renderPass == 1) ?
|
||||
flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) :
|
||||
flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
|
||||
}
|
||||
if (renderPass == 0) {
|
||||
return flower.getGenome().getStemColor().getColor(flower.isWilted());
|
||||
}
|
||||
return (renderPass == 1)
|
||||
? flower.getGenome().getPrimaryColor().getColor(flower.isWilted())
|
||||
: flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
return EnumFlowerType.ALLIUM.getBlank();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
return EnumFlowerType.ALLIUM.getBlank();
|
||||
}
|
||||
|
||||
IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||
if (renderPass == 0) {
|
||||
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||
if (renderPass == 0) {
|
||||
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz) {
|
||||
if (getStage() == EnumFlowerStage.POLLEN) {
|
||||
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||
TileEntity target = world.getTileEntity(x, y, z);
|
||||
if (!(target instanceof IPollinatable)) {
|
||||
return false;
|
||||
}
|
||||
IPollinatable pollinatable = (IPollinatable) target;
|
||||
if (!pollinatable.canMateWith(flower)) {
|
||||
return false;
|
||||
}
|
||||
pollinatable.mateWith(flower);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack itemstack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float px,
|
||||
float py,
|
||||
float pz) {
|
||||
if (getStage() == EnumFlowerStage.POLLEN) {
|
||||
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||
TileEntity target = world.getTileEntity(x, y, z);
|
||||
if (!(target instanceof IPollinatable)) {
|
||||
return false;
|
||||
}
|
||||
IPollinatable pollinatable = (IPollinatable) target;
|
||||
if (!pollinatable.canMateWith(flower)) {
|
||||
return false;
|
||||
}
|
||||
pollinatable.mateWith(flower);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Block blockFlower = Botany.flower;
|
||||
Block blockAlreadyThere = world.getBlock(x, y, z);
|
||||
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
||||
side = 1;
|
||||
} else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
} else if (side == 1) {
|
||||
y++;
|
||||
} else if (side == 2) {
|
||||
z--;
|
||||
} else if (side == 3) {
|
||||
z++;
|
||||
} else if (side == 4) {
|
||||
x--;
|
||||
} else if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
Block blockFlower = Botany.flower;
|
||||
Block blockAlreadyThere = world.getBlock(x, y, z);
|
||||
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
||||
side = 1;
|
||||
} else if (blockAlreadyThere != Blocks.vine
|
||||
&& blockAlreadyThere != Blocks.tallgrass
|
||||
&& blockAlreadyThere != Blocks.deadbush
|
||||
&& !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
} else if (side == 1) {
|
||||
y++;
|
||||
} else if (side == 2) {
|
||||
z--;
|
||||
} else if (side == 3) {
|
||||
z++;
|
||||
} else if (side == 4) {
|
||||
x--;
|
||||
} else if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) {
|
||||
return false;
|
||||
}
|
||||
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) {
|
||||
return false;
|
||||
}
|
||||
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
||||
int i1 = getMetadata(itemstack.getItemDamage());
|
||||
int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||
if (placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, blockFlower.stepSound.func_150496_b(), (blockFlower.stepSound.getVolume() + 1.0f) / 2.0f, blockFlower.stepSound.getPitch() * 0.8f);
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
||||
int i1 = getMetadata(itemstack.getItemDamage());
|
||||
int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||
if (placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
||||
world.playSoundEffect(
|
||||
x + 0.5f,
|
||||
y + 0.5f,
|
||||
z + 0.5f,
|
||||
blockFlower.stepSound.func_150496_b(),
|
||||
(blockFlower.stepSound.getVolume() + 1.0f) / 2.0f,
|
||||
blockFlower.stepSound.getPitch() * 0.8f);
|
||||
itemstack.stackSize--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
|
||||
Block field_150939_a = Botany.flower;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == Blocks.snow_layer) {
|
||||
side = 1;
|
||||
} else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z)) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
} else if (side == 1) {
|
||||
y++;
|
||||
} else if (side == 2) {
|
||||
z--;
|
||||
} else if (side == 3) {
|
||||
z++;
|
||||
} else if (side == 4) {
|
||||
x--;
|
||||
} else if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack);
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
|
||||
Block field_150939_a = Botany.flower;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == Blocks.snow_layer) {
|
||||
side = 1;
|
||||
} else if (block != Blocks.vine
|
||||
&& block != Blocks.tallgrass
|
||||
&& block != Blocks.deadbush
|
||||
&& !block.isReplaceable(world, x, y, z)) {
|
||||
if (side == 0) {
|
||||
y--;
|
||||
} else if (side == 1) {
|
||||
y++;
|
||||
} else if (side == 2) {
|
||||
z--;
|
||||
} else if (side == 3) {
|
||||
z++;
|
||||
} else if (side == 4) {
|
||||
x--;
|
||||
} else if (side == 5) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack);
|
||||
}
|
||||
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
Block block = Botany.flower;
|
||||
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
public boolean placeBlockAt(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ,
|
||||
int metadata) {
|
||||
Block block = Botany.flower;
|
||||
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract EnumFlowerStage getStage();
|
||||
public abstract EnumFlowerStage getStage();
|
||||
|
||||
public abstract String getTag();
|
||||
public abstract String getTag();
|
||||
}
|
||||
@@ -3,17 +3,17 @@ package binnie.botany.flower;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemFlower extends ItemBotany {
|
||||
public ItemFlower() {
|
||||
super("itemFlower");
|
||||
}
|
||||
public ItemFlower() {
|
||||
super("itemFlower");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.FLOWER;
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.FLOWER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public String getTag() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import binnie.botany.CreativeTabBotany;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,155 +14,152 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemInsulatedTube extends Item {
|
||||
IIcon[] icons;
|
||||
IIcon[] icons;
|
||||
|
||||
public ItemInsulatedTube() {
|
||||
icons = new IIcon[3];
|
||||
setUnlocalizedName("insulatedTube");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
public ItemInsulatedTube() {
|
||||
icons = new IIcon[3];
|
||||
setUnlocalizedName("insulatedTube");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (Material mat : Material.values()) {
|
||||
for (Insulate ins : Insulate.values()) {
|
||||
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (Material mat : Material.values()) {
|
||||
for (Insulate ins : Insulate.values()) {
|
||||
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
icons[i] = Botany.proxy.getIcon(register, "insulatedTube." + i);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
icons[i] = Botany.proxy.getIcon(register, "insulatedTube." + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
if (pass == 0) {
|
||||
return 0xffffff;
|
||||
}
|
||||
return (pass == 1)
|
||||
? Material.get(stack.getItemDamage()).getColor()
|
||||
: Insulate.get(stack.getItemDamage()).getColor();
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
if (pass == 0) {
|
||||
return 0xffffff;
|
||||
}
|
||||
return (pass == 1)
|
||||
? Material.get(stack.getItemDamage()).getColor()
|
||||
: Insulate.get(stack.getItemDamage()).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return Material.get(stack.getItemDamage()).getName() + " "
|
||||
+ I18N.localise("botany.tube.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return Material.get(stack.getItemDamage()).getName() + " " + I18N.localise("botany.tube.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public int getRenderPasses(int metadata) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return icons[pass % 3];
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass) {
|
||||
return icons[pass % 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
|
||||
enum Material {
|
||||
Copper(0xe3b78e, "cooper"),
|
||||
Tin(0xe1eef4, "tin"),
|
||||
Bronze(0xddc276, "bronze"),
|
||||
Iron(0xd8d8d8, "iron");
|
||||
enum Material {
|
||||
Copper(0xe3b78e, "cooper"),
|
||||
Tin(0xe1eef4, "tin"),
|
||||
Bronze(0xddc276, "bronze"),
|
||||
Iron(0xd8d8d8, "iron");
|
||||
|
||||
protected int color;
|
||||
protected String name;
|
||||
protected int color;
|
||||
protected String name;
|
||||
|
||||
Material(int color, String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
Material(int color, String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Material get(int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
public static Material get(int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return I18N.localise("botany.tube." + name);
|
||||
}
|
||||
}
|
||||
public String getName() {
|
||||
return I18N.localise("botany.tube." + name);
|
||||
}
|
||||
}
|
||||
|
||||
enum Insulate {
|
||||
Clay(0xa1aacc, "clay"),
|
||||
Cobble(0x7b7b7b, "cobblestone"),
|
||||
Sand(0xefeab5, "sand"),
|
||||
HardenedClay(0x935c43, "hardenedClay"),
|
||||
Stone(0x6d6d6d, "smoothStone"),
|
||||
Sandstone(0xc1b989, "sandstone");
|
||||
enum Insulate {
|
||||
Clay(0xa1aacc, "clay"),
|
||||
Cobble(0x7b7b7b, "cobblestone"),
|
||||
Sand(0xefeab5, "sand"),
|
||||
HardenedClay(0x935c43, "hardenedClay"),
|
||||
Stone(0x6d6d6d, "smoothStone"),
|
||||
Sandstone(0xc1b989, "sandstone");
|
||||
|
||||
protected int color;
|
||||
protected String name;
|
||||
protected int color;
|
||||
protected String name;
|
||||
|
||||
Insulate(int color, String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
Insulate(int color, String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Insulate get(int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
public static Insulate get(int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return I18N.localise("botany.tube.insulate." + name);
|
||||
}
|
||||
public String getName() {
|
||||
return I18N.localise("botany.tube.insulate." + name);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay:
|
||||
return new ItemStack(Blocks.clay);
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay:
|
||||
return new ItemStack(Blocks.clay);
|
||||
|
||||
case Cobble:
|
||||
return new ItemStack(Blocks.cobblestone);
|
||||
case Cobble:
|
||||
return new ItemStack(Blocks.cobblestone);
|
||||
|
||||
case HardenedClay:
|
||||
return new ItemStack(Blocks.hardened_clay);
|
||||
case HardenedClay:
|
||||
return new ItemStack(Blocks.hardened_clay);
|
||||
|
||||
case Sand:
|
||||
return new ItemStack(Blocks.sand);
|
||||
case Sand:
|
||||
return new ItemStack(Blocks.sand);
|
||||
|
||||
case Sandstone:
|
||||
return new ItemStack(Blocks.sandstone);
|
||||
case Sandstone:
|
||||
return new ItemStack(Blocks.sandstone);
|
||||
|
||||
case Stone:
|
||||
return new ItemStack(Blocks.stone);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
case Stone:
|
||||
return new ItemStack(Blocks.stone);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,17 +4,17 @@ import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemPollen extends ItemBotany {
|
||||
public ItemPollen() {
|
||||
super("pollen");
|
||||
}
|
||||
public ItemPollen() {
|
||||
super("pollen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return I18N.localise("botany.item.pollen.tag.name");
|
||||
}
|
||||
@Override
|
||||
public String getTag() {
|
||||
return I18N.localise("botany.item.pollen.tag.name");
|
||||
}
|
||||
}
|
||||
@@ -4,17 +4,17 @@ import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class ItemSeed extends ItemBotany {
|
||||
public ItemSeed() {
|
||||
super("seed");
|
||||
}
|
||||
public ItemSeed() {
|
||||
super("seed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return I18N.localise("botany.item.germling.tag.name");
|
||||
}
|
||||
@Override
|
||||
public String getTag() {
|
||||
return I18N.localise("botany.item.germling.tag.name");
|
||||
}
|
||||
}
|
||||
@@ -9,52 +9,53 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class RendererBotany implements ISimpleBlockRenderingHandler {
|
||||
public static int renderID;
|
||||
public static int pass;
|
||||
public static int renderID;
|
||||
public static int pass;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||
double d1 = x;
|
||||
double d2 = y;
|
||||
double d3 = z;
|
||||
long i1 = x * 3129871 ^ z * 116129781L;
|
||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||
double d1 = x;
|
||||
double d2 = y;
|
||||
double d3 = z;
|
||||
long i1 = x * 3129871 ^ z * 116129781L;
|
||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
RendererBotany.pass = j;
|
||||
int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
float f3 = (l & 0xFF) / 255.0f;
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
RendererBotany.pass = j;
|
||||
int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
float f3 = (l & 0xFF) / 255.0f;
|
||||
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
f = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||
f2 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||
f3 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f, f2, f3);
|
||||
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (EntityRenderer.anaglyphEnable) {
|
||||
f = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||
f2 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||
f3 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f, f2, f3);
|
||||
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -7,6 +7,9 @@ import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -17,141 +20,135 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlant extends BlockBush {
|
||||
public BlockPlant() {
|
||||
setBlockName("plant");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setTickRandomly(true);
|
||||
setStepSound(Block.soundTypeGrass);
|
||||
}
|
||||
public BlockPlant() {
|
||||
setBlockName("plant");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setTickRandomly(true);
|
||||
setStepSound(Block.soundTypeGrass);
|
||||
}
|
||||
|
||||
public static boolean isWeed(IBlockAccess world, int x, int y, int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
public static boolean isWeed(IBlockAccess world, int x, int y, int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
return type == Type.Weeds
|
||||
|| type == Type.WeedsLong
|
||||
|| type == Type.WeedsVeryLong;
|
||||
}
|
||||
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (Type t : Type.values()) {
|
||||
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (Type t : Type.values()) {
|
||||
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return super.canPlaceBlockOn(block) || Gardening.isSoil(block);
|
||||
}
|
||||
@Override
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return super.canPlaceBlockOn(block) || Gardening.isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Type.values()[meta % Type.values().length].icon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Type.values()[meta % Type.values().length].icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int damage) {
|
||||
return damage;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (Type type : Type.values()) {
|
||||
list.add(type.get());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (Type type : Type.values()) {
|
||||
list.add(type.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
if (random.nextInt(4) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||
} else if (type == Type.WeedsLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
||||
} else if (type == Type.DeadFlower) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
||||
} else if (type == Type.DecayingFlower) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
if (random.nextInt(4) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||
} else if (type == Type.WeedsLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
||||
} else if (type == Type.DeadFlower) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
||||
} else if (type == Type.DecayingFlower) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (random.nextInt(6) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else if (type == Type.WeedsLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
||||
} else if (type == Type.WeedsVeryLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
if (random.nextInt(6) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
} else if (type == Type.WeedsLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
||||
} else if (type == Type.WeedsVeryLong) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
Block below = world.getBlock(x, y - 1, z);
|
||||
if (!Gardening.isSoil(below)) {
|
||||
return;
|
||||
}
|
||||
Block below = world.getBlock(x, y - 1, z);
|
||||
if (!Gardening.isSoil(below)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBlockSoil soil = (IBlockSoil) below;
|
||||
if (random.nextInt(3) != 0) {
|
||||
return;
|
||||
}
|
||||
IBlockSoil soil = (IBlockSoil) below;
|
||||
if (random.nextInt(3) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
||||
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
||||
}
|
||||
} else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
||||
}
|
||||
}
|
||||
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
||||
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
||||
}
|
||||
} else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
Weeds("weeds"),
|
||||
WeedsLong("longWeeds"),
|
||||
WeedsVeryLong("veryLongWeeds"),
|
||||
DeadFlower("deadFlower"),
|
||||
DecayingFlower("decayingFlower");
|
||||
public enum Type {
|
||||
Weeds("weeds"),
|
||||
WeedsLong("longWeeds"),
|
||||
WeedsVeryLong("veryLongWeeds"),
|
||||
DeadFlower("deadFlower"),
|
||||
DecayingFlower("decayingFlower");
|
||||
|
||||
public IIcon icon;
|
||||
public IIcon icon;
|
||||
|
||||
protected String name;
|
||||
protected String name;
|
||||
|
||||
Type(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
Type(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Type get(int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
public static Type get(int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, ordinal());
|
||||
}
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, ordinal());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return I18N.localise("botany.plant." + name);
|
||||
}
|
||||
}
|
||||
public String getName() {
|
||||
return I18N.localise("botany.plant." + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -22,193 +24,192 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil {
|
||||
protected boolean weedKilled;
|
||||
protected IIcon[] iconsTop;
|
||||
protected IIcon[] iconsSide;
|
||||
protected IIcon[] iconsNoWeed;
|
||||
protected EnumSoilType type;
|
||||
protected boolean weedKilled;
|
||||
protected IIcon[] iconsTop;
|
||||
protected IIcon[] iconsSide;
|
||||
protected IIcon[] iconsNoWeed;
|
||||
protected EnumSoilType type;
|
||||
|
||||
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||
super(Material.ground);
|
||||
this.type = type;
|
||||
this.weedKilled = weedKilled;
|
||||
iconsTop = new IIcon[9];
|
||||
iconsSide = new IIcon[9];
|
||||
iconsNoWeed = new IIcon[9];
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setBlockName(blockName);
|
||||
setTickRandomly(true);
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||
setLightOpacity(255);
|
||||
setHardness(0.5f);
|
||||
setStepSound(Block.soundTypeGravel);
|
||||
}
|
||||
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||
super(Material.ground);
|
||||
this.type = type;
|
||||
this.weedKilled = weedKilled;
|
||||
iconsTop = new IIcon[9];
|
||||
iconsSide = new IIcon[9];
|
||||
iconsNoWeed = new IIcon[9];
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setBlockName(blockName);
|
||||
setTickRandomly(true);
|
||||
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||
setLightOpacity(255);
|
||||
setHardness(0.5f);
|
||||
setStepSound(Block.soundTypeGravel);
|
||||
}
|
||||
|
||||
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = ((meta >= 9) ? 8 : meta);
|
||||
if (side == 1) {
|
||||
return weedKilled ? iconsNoWeed[meta] : iconsTop[meta];
|
||||
}
|
||||
return (side == 0) ? Blocks.dirt.getIcon(side, 0) : iconsSide[meta];
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = ((meta >= 9) ? 8 : meta);
|
||||
if (side == 1) {
|
||||
return weedKilled ? iconsNoWeed[meta] : iconsTop[meta];
|
||||
}
|
||||
return (side == 0) ? Blocks.dirt.getIcon(side, 0) : iconsSide[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||
for (EnumAcidity pH : EnumAcidity.values()) {
|
||||
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||
iconsSide[index] = Botany.proxy.getIcon(register, id + ".1");
|
||||
iconsNoWeed[index] = Botany.proxy.getIcon(register, id + ".2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||
for (EnumAcidity pH : EnumAcidity.values()) {
|
||||
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||
iconsSide[index] = Botany.proxy.getIcon(register, id + ".1");
|
||||
iconsNoWeed[index] = Botany.proxy.getIcon(register, id + ".2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EnumSoilType getType() {
|
||||
return type;
|
||||
}
|
||||
public EnumSoilType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int damage) {
|
||||
return damage;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||
}
|
||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||
}
|
||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
||||
}
|
||||
|
||||
int meta2 = getMeta(acidity, moisture);
|
||||
if (meta != meta2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
||||
}
|
||||
if (!weedKilled && random.nextInt(5 - getType(world, x, y, z).ordinal()) == 0 && world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
int meta2 = getMeta(acidity, moisture);
|
||||
if (meta != meta2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
||||
}
|
||||
if (!weedKilled
|
||||
&& random.nextInt(5 - getType(world, x, y, z).ordinal()) == 0
|
||||
&& world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||
}
|
||||
@Override
|
||||
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||
}
|
||||
@Override
|
||||
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getType(World world, int x, int y, int z) {
|
||||
return type;
|
||||
}
|
||||
@Override
|
||||
public EnumSoilType getType(World world, int x, int y, int z) {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel) {
|
||||
EnumSoilType type = getType(world, x, y, z);
|
||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel) {
|
||||
EnumSoilType type = getType(world, x, y, z);
|
||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, weedKilled), meta, 2);
|
||||
}
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, weedKilled), meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel) {
|
||||
EnumSoilType type = getType(world, x, y, z);
|
||||
if (type.ordinal() <= minLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel) {
|
||||
EnumSoilType type = getType(world, x, y, z);
|
||||
if (type.ordinal() <= minLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, weedKilled), meta, 2);
|
||||
}
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, weedKilled), meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPH(World world, int x, int y, int z, EnumAcidity pH) {
|
||||
int meta = getMeta(pH, getMoisture(world, x, y, z));
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
@Override
|
||||
public boolean setPH(World world, int x, int y, int z, EnumAcidity pH) {
|
||||
int meta = getMeta(pH, getMoisture(world, x, y, z));
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setMoisture(World world, int x, int y, int z, EnumMoisture moisture) {
|
||||
int meta = getMeta(getPH(world, x, y, z), moisture);
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
@Override
|
||||
public boolean setMoisture(World world, int x, int y, int z, EnumMoisture moisture) {
|
||||
int meta = getMeta(getPH(world, x, y, z), moisture);
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
||||
Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||
if (plant == Botany.flower) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canSustainPlant(
|
||||
IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
||||
Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||
if (plant == Botany.flower) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plant == Botany.plant) {
|
||||
return !weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||
}
|
||||
return world instanceof World
|
||||
&& Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||
}
|
||||
if (plant == Botany.plant) {
|
||||
return !weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||
}
|
||||
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resistsWeeds(World world, int x, int y, int z) {
|
||||
return weedKilled;
|
||||
}
|
||||
@Override
|
||||
public boolean resistsWeeds(World world, int x, int y, int z) {
|
||||
return weedKilled;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.BinnieCore;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -20,255 +23,260 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Gardening {
|
||||
public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
||||
public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
||||
public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
||||
public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
||||
public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
||||
public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
||||
|
||||
public static boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
public static boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
public static boolean isSoil(Item item) {
|
||||
return item instanceof ItemBlock
|
||||
&& isSoil(((ItemBlock) item).field_150939_a);
|
||||
}
|
||||
public static boolean isSoil(Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
|
||||
}
|
||||
|
||||
public static EnumMoisture getNaturalMoisture(World world, int x, int y, int z) {
|
||||
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
||||
bias -= 1.5;
|
||||
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
||||
bias += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static EnumMoisture getNaturalMoisture(World world, int x, int y, int z) {
|
||||
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
||||
bias -= 1.5;
|
||||
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
||||
bias += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
||||
bias += 1.5;
|
||||
}
|
||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
||||
bias += 1.5;
|
||||
}
|
||||
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
|
||||
bias *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int dx = -1; dx < 2; ++dx) {
|
||||
for (int dz = -1; dz < 2; ++dz) {
|
||||
if (dx != 0 || dz != 0) {
|
||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
|
||||
bias *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bias <= -1.0f) {
|
||||
return EnumMoisture.DRY;
|
||||
}
|
||||
return (bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL;
|
||||
}
|
||||
if (bias <= -1.0f) {
|
||||
return EnumMoisture.DRY;
|
||||
}
|
||||
return (bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL;
|
||||
}
|
||||
|
||||
public static EnumAcidity getNaturalPH(World world, int x, int y, int z) {
|
||||
float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
||||
if (bias <= -1.0f) {
|
||||
return EnumAcidity.ACID;
|
||||
}
|
||||
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
|
||||
}
|
||||
public static EnumAcidity getNaturalPH(World world, int x, int y, int z) {
|
||||
float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
||||
if (bias <= -1.0f) {
|
||||
return EnumAcidity.ACID;
|
||||
}
|
||||
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
|
||||
}
|
||||
|
||||
public static float getBiomeMoisture(BiomeGenBase biome, int H) {
|
||||
double R = biome.rainfall;
|
||||
double T = biome.temperature;
|
||||
double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
|
||||
if (m == 0.0) {
|
||||
return (float) m;
|
||||
}
|
||||
if (m < 0.0){
|
||||
return (float) -Math.sqrt(m * m);
|
||||
}
|
||||
return (float) Math.sqrt(m * m);
|
||||
}
|
||||
public static float getBiomeMoisture(BiomeGenBase biome, int H) {
|
||||
double R = biome.rainfall;
|
||||
double T = biome.temperature;
|
||||
double m =
|
||||
3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
|
||||
if (m == 0.0) {
|
||||
return (float) m;
|
||||
}
|
||||
if (m < 0.0) {
|
||||
return (float) -Math.sqrt(m * m);
|
||||
}
|
||||
return (float) Math.sqrt(m * m);
|
||||
}
|
||||
|
||||
public static float getBiomePH(BiomeGenBase biome, int H) {
|
||||
double R = biome.rainfall;
|
||||
double T = biome.temperature;
|
||||
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 64) - 0.15000000596046448);
|
||||
}
|
||||
public static float getBiomePH(BiomeGenBase biome, int H) {
|
||||
double R = biome.rainfall;
|
||||
double T = biome.temperature;
|
||||
return (float) (-3.0 * (R - 0.5)
|
||||
+ 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071)
|
||||
+ 0.02f * (H - 64)
|
||||
- 0.15000000596046448);
|
||||
}
|
||||
|
||||
public static void createSoil(World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
||||
}
|
||||
public static void createSoil(
|
||||
World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
||||
}
|
||||
|
||||
public static boolean plant(World world, int x, int y, int z, IFlower flower, GameProfile owner) {
|
||||
boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
public static boolean plant(World world, int x, int y, int z, IFlower flower, GameProfile owner) {
|
||||
boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||
}
|
||||
}
|
||||
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||
}
|
||||
}
|
||||
|
||||
tryGrowSection(world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
tryGrowSection(world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void tryGrowSection(World world, int x, int y, int z) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
public static void tryGrowSection(World world, int x, int y, int z) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
||||
return;
|
||||
}
|
||||
TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||
int section = ((TileEntityFlower) flower).getSection();
|
||||
if (iflower == null || section >= iflower.getGenome().getPrimary().getType().getSections() - 1 || iflower.getAge() <= 0) {
|
||||
return;
|
||||
}
|
||||
IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||
int section = ((TileEntityFlower) flower).getSection();
|
||||
if (iflower == null
|
||||
|| section >= iflower.getGenome().getPrimary().getType().getSections() - 1
|
||||
|| iflower.getAge() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
||||
TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||
}
|
||||
}
|
||||
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
||||
TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onGrowFromSeed(World world, int x, int y, int z) {
|
||||
tryGrowSection(world, x, y, z);
|
||||
}
|
||||
public static void onGrowFromSeed(World world, int x, int y, int z) {
|
||||
tryGrowSection(world, x, y, z);
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getAcidFertilisers() {
|
||||
return Gardening.fertiliserAcid.keySet();
|
||||
}
|
||||
public static Collection<ItemStack> getAcidFertilisers() {
|
||||
return Gardening.fertiliserAcid.keySet();
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getAlkalineFertilisers() {
|
||||
return Gardening.fertiliserAlkaline.keySet();
|
||||
}
|
||||
public static Collection<ItemStack> getAlkalineFertilisers() {
|
||||
return Gardening.fertiliserAlkaline.keySet();
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getNutrientFertilisers() {
|
||||
return Gardening.fertiliserNutrient.keySet();
|
||||
}
|
||||
public static Collection<ItemStack> getNutrientFertilisers() {
|
||||
return Gardening.fertiliserNutrient.keySet();
|
||||
}
|
||||
|
||||
public static boolean isAcidFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getAcidFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isAcidFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getAcidFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAlkalineFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isAlkalineFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isNutrientFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getNutrientFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isNutrientFertiliser(ItemStack itemstack) {
|
||||
for (ItemStack stack : getNutrientFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getFertiliserStrength(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 1;
|
||||
}
|
||||
public static int getFertiliserStrength(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static boolean canTolerate(IFlower flower, World world, int x, int y, int z) {
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return false;
|
||||
}
|
||||
public static boolean canTolerate(IFlower flower, World world, int x, int y, int z) {
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
||||
}
|
||||
int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||
return canTolerate(
|
||||
flower,
|
||||
EnumAcidity.values()[soilMeta / 3 % 3],
|
||||
EnumMoisture.values()[soilMeta % 3],
|
||||
EnumTemperature.getFromValue(biome.temperature));
|
||||
}
|
||||
|
||||
public static EnumSoilType getSoilType(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
||||
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
public static EnumSoilType getSoilType(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
||||
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
|
||||
public static Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
public static Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
||||
switch (type) {
|
||||
case FLOWERBED:
|
||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
||||
switch (type) {
|
||||
case FLOWERBED:
|
||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||
|
||||
case LOAM:
|
||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||
}
|
||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||
}
|
||||
case LOAM:
|
||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||
}
|
||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||
}
|
||||
|
||||
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
||||
return flower.getGenome().canTolerate(ePH)
|
||||
&& flower.getGenome().canTolerate(eMoisture)
|
||||
&& flower.getGenome().canTolerate(eTemp);
|
||||
}
|
||||
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
||||
return flower.getGenome().canTolerate(ePH)
|
||||
&& flower.getGenome().canTolerate(eMoisture)
|
||||
&& flower.getGenome().canTolerate(eTemp);
|
||||
}
|
||||
|
||||
public static boolean isWeedkiller(ItemStack heldItem) {
|
||||
return heldItem != null
|
||||
&& heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||
}
|
||||
public static boolean isWeedkiller(ItemStack heldItem) {
|
||||
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||
}
|
||||
|
||||
public static boolean addWeedKiller(World world, int x, int y, int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
public static boolean addWeedKiller(World world, int x, int y, int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumSoilType type = getSoilType(world, x, y, z);
|
||||
Block block = getSoilBlock(type, true);
|
||||
boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
||||
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
||||
world.setBlockToAir(x, y + 1, z);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
EnumSoilType type = getSoilType(world, x, y, z);
|
||||
Block block = getSoilBlock(type, true);
|
||||
boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
||||
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
||||
world.setBlockToAir(x, y + 1, z);
|
||||
}
|
||||
return done;
|
||||
}
|
||||
}
|
||||
@@ -6,81 +6,72 @@ import binnie.botany.api.EnumSoilType;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ItemSoil extends ItemBlock {
|
||||
protected EnumSoilType type;
|
||||
protected EnumSoilType type;
|
||||
|
||||
private boolean noWeed;
|
||||
private boolean noWeed;
|
||||
|
||||
public ItemSoil(Block block) {
|
||||
super(block);
|
||||
type = ((BlockSoil) field_150939_a).getType();
|
||||
noWeed = ((BlockSoil) field_150939_a).weedKilled;
|
||||
hasSubtypes = true;
|
||||
}
|
||||
public ItemSoil(Block block) {
|
||||
super(block);
|
||||
type = ((BlockSoil) field_150939_a).getType();
|
||||
noWeed = ((BlockSoil) field_150939_a).weedKilled;
|
||||
hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
String info = "";
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
String info = "";
|
||||
|
||||
if (moisture == EnumMoisture.DRY) {
|
||||
info += EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.moisture.dry")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
info += EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.moisture.damp")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (moisture == EnumMoisture.DRY) {
|
||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.dry") + EnumChatFormatting.RESET;
|
||||
}
|
||||
if (moisture == EnumMoisture.DAMP) {
|
||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.moisture.damp") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (acidity == EnumAcidity.ACID) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.ph.acid")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (acidity == EnumAcidity.ACID) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (acidity == EnumAcidity.ALKALINE) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.YELLOW
|
||||
+ I18N.localise("botany.ph.alkaline")
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
if (acidity == EnumAcidity.ALKALINE) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
if (info.length() > 0) {
|
||||
tooltip.add(info);
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
tooltip.add(info);
|
||||
}
|
||||
|
||||
if (noWeed) {
|
||||
tooltip.add(I18N.localise("botany.soil.weedkiller"));
|
||||
}
|
||||
}
|
||||
if (noWeed) {
|
||||
tooltip.add(I18N.localise("botany.soil.weedkiller"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
String soilName = type.name().toLowerCase(Locale.ENGLISH);
|
||||
return I18N.localise("botany.soil." + soilName);
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
String soilName = type.name().toLowerCase(Locale.ENGLISH);
|
||||
return I18N.localise("botany.soil." + soilName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
@@ -22,63 +22,67 @@ import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSoilMeter extends Item {
|
||||
public ItemSoilMeter() {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("soilMeter");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemSoilMeter() {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("soilMeter");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float blockX, float blockY, float blockZ) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!Gardening.isSoil(block)) {
|
||||
y--;
|
||||
block = world.getBlock(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float blockX,
|
||||
float blockY,
|
||||
float blockZ) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!Gardening.isSoil(block)) {
|
||||
y--;
|
||||
block = world.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
EnumSoilType type = soil.getType(world, x, y, z);
|
||||
EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||
EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||
IBlockSoil soil = (IBlockSoil) block;
|
||||
EnumSoilType type = soil.getType(world, x, y, z);
|
||||
EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||
EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||
|
||||
EnumChatFormatting[] colors = new EnumChatFormatting[]{
|
||||
EnumChatFormatting.DARK_GRAY,
|
||||
EnumChatFormatting.GOLD,
|
||||
EnumChatFormatting.LIGHT_PURPLE,
|
||||
};
|
||||
String info = I18N.localise("botany.soil.tooltip.type") + " ";
|
||||
info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET;
|
||||
EnumChatFormatting[] colors = new EnumChatFormatting[] {
|
||||
EnumChatFormatting.DARK_GRAY, EnumChatFormatting.GOLD, EnumChatFormatting.LIGHT_PURPLE,
|
||||
};
|
||||
String info = I18N.localise("botany.soil.tooltip.type") + " ";
|
||||
info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET;
|
||||
|
||||
colors = new EnumChatFormatting[]{
|
||||
EnumChatFormatting.YELLOW,
|
||||
EnumChatFormatting.GRAY,
|
||||
EnumChatFormatting.BLUE,
|
||||
};
|
||||
info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " ";
|
||||
info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET;
|
||||
colors = new EnumChatFormatting[] {
|
||||
EnumChatFormatting.YELLOW, EnumChatFormatting.GRAY, EnumChatFormatting.BLUE,
|
||||
};
|
||||
info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " ";
|
||||
info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET;
|
||||
|
||||
colors = new EnumChatFormatting[]{
|
||||
EnumChatFormatting.RED,
|
||||
EnumChatFormatting.GREEN,
|
||||
EnumChatFormatting.AQUA,
|
||||
};
|
||||
info += ", " + I18N.localise("botany.soil.tooltip.pH") + " ";
|
||||
info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET;
|
||||
IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, blockX, blockY, blockZ);
|
||||
}
|
||||
colors = new EnumChatFormatting[] {
|
||||
EnumChatFormatting.RED, EnumChatFormatting.GREEN, EnumChatFormatting.AQUA,
|
||||
};
|
||||
info += ", " + I18N.localise("botany.soil.tooltip.pH") + " ";
|
||||
info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET;
|
||||
IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, side, blockX, blockY, blockZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("botany.item.soilMeter.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("botany.item.soilMeter.name");
|
||||
}
|
||||
}
|
||||
@@ -16,52 +16,69 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemTrowel extends Item {
|
||||
protected Item.ToolMaterial theToolMaterial;
|
||||
String locName;
|
||||
protected Item.ToolMaterial theToolMaterial;
|
||||
String locName;
|
||||
|
||||
public ItemTrowel(Item.ToolMaterial toolMaterial, String material) {
|
||||
theToolMaterial = toolMaterial;
|
||||
maxStackSize = 1;
|
||||
setMaxDamage(toolMaterial.getMaxUses());
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("trowel" + material);
|
||||
locName = "trowel" + material;
|
||||
}
|
||||
public ItemTrowel(Item.ToolMaterial toolMaterial, String material) {
|
||||
theToolMaterial = toolMaterial;
|
||||
maxStackSize = 1;
|
||||
setMaxDamage(toolMaterial.getMaxUses());
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("trowel" + material);
|
||||
locName = "trowel" + material;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "tools/" + locName);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "tools/" + locName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float blockX, float blockY, float blockZ) {
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||
return false;
|
||||
}
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (side == 0 ||
|
||||
(!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && world.getBlock(x, y + 1, z) != Botany.flower) ||
|
||||
(block != Blocks.grass && block != Blocks.dirt)) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float blockX,
|
||||
float blockY,
|
||||
float blockZ) {
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||
return false;
|
||||
}
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (side == 0
|
||||
|| (!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z)
|
||||
&& world.getBlock(x, y + 1, z) != Botany.flower)
|
||||
|| (block != Blocks.grass && block != Blocks.dirt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block block2 = Botany.soil;
|
||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, block2.stepSound.getStepResourcePath(), (block2.stepSound.getVolume() + 1.0f) / 2.0f, block2.stepSound.getPitch() * 0.8f);
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
Block block2 = Botany.soil;
|
||||
world.playSoundEffect(
|
||||
x + 0.5f,
|
||||
y + 0.5f,
|
||||
z + 0.5f,
|
||||
block2.stepSound.getStepResourcePath(),
|
||||
(block2.stepSound.getVolume() + 1.0f) / 2.0f,
|
||||
block2.stepSound.getPitch() * 0.8f);
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
||||
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
||||
stack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
||||
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
||||
stack.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,25 +8,25 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class ItemWeed extends ItemBlock {
|
||||
public ItemWeed(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
hasSubtypes = true;
|
||||
}
|
||||
public ItemWeed(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return field_150939_a.getIcon(2, damage);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return field_150939_a.getIcon(2, damage);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import binnie.core.block.ItemMetadataRenderer;
|
||||
import binnie.core.block.MultipassItemRenderer;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -35,336 +37,317 @@ import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModuleGardening implements IInitializable {
|
||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
Botany.plant = new BlockPlant();
|
||||
GameRegistry.registerBlock(Botany.plant, ItemWeed.class, "plant");
|
||||
@Override
|
||||
public void preInit() {
|
||||
Botany.plant = new BlockPlant();
|
||||
GameRegistry.registerBlock(Botany.plant, ItemWeed.class, "plant");
|
||||
|
||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
||||
|
||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
||||
|
||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
||||
|
||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
||||
|
||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
||||
|
||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
||||
|
||||
Botany.soilMeter = new ItemSoilMeter();
|
||||
Botany.insulatedTube = new ItemInsulatedTube();
|
||||
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
||||
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
|
||||
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
||||
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
||||
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
||||
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
||||
Botany.pigment = new ItemPigment();
|
||||
Botany.clay = new ItemClay();
|
||||
Botany.soilMeter = new ItemSoilMeter();
|
||||
Botany.insulatedTube = new ItemInsulatedTube();
|
||||
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
||||
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
|
||||
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
||||
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
||||
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
||||
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
||||
Botany.pigment = new ItemPigment();
|
||||
Botany.clay = new ItemClay();
|
||||
|
||||
Botany.ceramic = new BlockCeramic();
|
||||
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
Botany.ceramic = new BlockCeramic();
|
||||
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
|
||||
Botany.stained = new BlockStained();
|
||||
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
Botany.stained = new BlockStained();
|
||||
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
|
||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(
|
||||
Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(
|
||||
Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
OreDictionary.registerOre("pigment", Botany.pigment);
|
||||
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
||||
ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
||||
ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
||||
@Override
|
||||
public void init() {
|
||||
OreDictionary.registerOre("pigment", Botany.pigment);
|
||||
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||
ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
||||
ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
||||
ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
||||
|
||||
for (boolean manual : new boolean[]{true, false}) {
|
||||
for (boolean fertilised : new boolean[]{true, false}) {
|
||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow : ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||
int insulate = 2 - moist.ordinal();
|
||||
if (fertilised) {
|
||||
insulate += 3;
|
||||
}
|
||||
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (boolean manual : new boolean[] {true, false}) {
|
||||
for (boolean fertilised : new boolean[] {true, false}) {
|
||||
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||
ItemStack icon =
|
||||
(moist == EnumMoisture.DRY) ? yellow : ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||
int insulate = 2 - moist.ordinal();
|
||||
if (fertilised) {
|
||||
insulate += 3;
|
||||
}
|
||||
new CircuitGarden(
|
||||
moist,
|
||||
null,
|
||||
manual,
|
||||
fertilised,
|
||||
new ItemStack(Botany.insulatedTube, 1, 128 * insulate),
|
||||
icon);
|
||||
new CircuitGarden(
|
||||
moist,
|
||||
EnumAcidity.ACID,
|
||||
manual,
|
||||
fertilised,
|
||||
new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate),
|
||||
icon);
|
||||
new CircuitGarden(
|
||||
moist,
|
||||
EnumAcidity.NEUTRAL,
|
||||
manual,
|
||||
fertilised,
|
||||
new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate),
|
||||
icon);
|
||||
new CircuitGarden(
|
||||
moist,
|
||||
EnumAcidity.ALKALINE,
|
||||
manual,
|
||||
fertilised,
|
||||
new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate),
|
||||
icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||
for (int mat = 0; mat < 4; ++mat) {
|
||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||
ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||
ItemStack forestryTube = new ItemStack(Mods.forestry.item("thermionicTubes"), 1, mat);
|
||||
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||
for (int mat = 0; mat < 4; ++mat) {
|
||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||
ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||
ItemStack forestryTube = new ItemStack(Mods.forestry.item("thermionicTubes"), 1, mat);
|
||||
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
|
||||
}
|
||||
}
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(Blocks.dirt), new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(Blocks.dirt), new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(Blocks.dirt), new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(Blocks.dirt), new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelWood,
|
||||
new Object[]{
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.dirt,
|
||||
's', "stickWood",
|
||||
'x', "plankWood"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelStone,
|
||||
new Object[]{
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.dirt,
|
||||
's', "stickWood",
|
||||
'x', "cobblestone"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelIron,
|
||||
new Object[]{
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.dirt,
|
||||
's', "stickWood",
|
||||
'x', "ingotIron"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelGold,
|
||||
new Object[]{
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.dirt,
|
||||
's', "stickWood",
|
||||
'x', "ingotGold"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelDiamond,
|
||||
new Object[]{
|
||||
"d ", " x ", " s",
|
||||
'd', Blocks.dirt,
|
||||
's', "stickWood",
|
||||
'x', "gemDiamond"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.soilMeter,
|
||||
new Object[]{
|
||||
" gg", " rg", "i ",
|
||||
'g', "ingotGold",
|
||||
'r', "dustRedstone",
|
||||
'i', "ingotIron"
|
||||
}
|
||||
));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.Weedkiller.get(4),
|
||||
new ItemStack(Items.spider_eye),
|
||||
new ItemStack(Items.wheat_seeds),
|
||||
new ItemStack(Items.wheat_seeds),
|
||||
new ItemStack(Items.wheat_seeds)
|
||||
);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelWood,
|
||||
new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelStone,
|
||||
new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelIron,
|
||||
new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelGold,
|
||||
new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.trowelDiamond,
|
||||
new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
Botany.soilMeter,
|
||||
new Object[] {" gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron"}));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
BotanyItems.Weedkiller.get(4),
|
||||
new ItemStack(Items.spider_eye),
|
||||
new ItemStack(Items.wheat_seeds),
|
||||
new ItemStack(Items.wheat_seeds),
|
||||
new ItemStack(Items.wheat_seeds));
|
||||
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.forestry.stack("ash"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.forestry.stack("mulch"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
BotanyItems.SulphurPowder.get(4),
|
||||
new Object[]{"dustSulphur"}
|
||||
));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.forestry.stack("ash"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.forestry.stack("mulch"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] {"dustSulphur"}));
|
||||
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
|
||||
new Object[]{
|
||||
"pigment",
|
||||
"pigment",
|
||||
"dyeBlack"
|
||||
}
|
||||
));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
|
||||
new Object[] {"pigment", "pigment", "dyeBlack"}));
|
||||
|
||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
||||
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
||||
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
||||
|
||||
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
||||
}
|
||||
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
||||
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
||||
}
|
||||
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(
|
||||
new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
||||
ModuleGardening.queuedNutrientFertilisers.put(
|
||||
new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||
addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||
addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||
addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||
addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||
addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||
addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
BotanyItems.Mortar.get(6),
|
||||
" c ", "cgc", " c ",
|
||||
'c', Items.clay_ball,
|
||||
'g', Blocks.gravel
|
||||
);
|
||||
GameRegistry.addRecipe(
|
||||
BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
||||
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||
ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||
glass.stackSize = 4;
|
||||
GameRegistry.addShapedRecipe(
|
||||
glass,
|
||||
" g ", "gpg", " g ",
|
||||
'g', Blocks.glass,
|
||||
'p', pigment
|
||||
);
|
||||
}
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||
ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||
glass.stackSize = 4;
|
||||
GameRegistry.addShapedRecipe(glass, " g ", "gpg", " g ", 'g', Blocks.glass, 'p', pigment);
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(new PigmentRecipe());
|
||||
}
|
||||
GameRegistry.addRecipe(new PigmentRecipe());
|
||||
}
|
||||
|
||||
private ItemStack getStack(int type, int pH, int moisture) {
|
||||
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack(Gardening.getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||
}
|
||||
private ItemStack getStack(int type, int pH, int moisture) {
|
||||
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
||||
return null;
|
||||
}
|
||||
return new ItemStack(
|
||||
Gardening.getSoilBlock(EnumSoilType.values()[type]),
|
||||
1,
|
||||
BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||
}
|
||||
|
||||
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gardening.fertiliserAcid.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type, pH - strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Gardening.fertiliserAcid.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type, pH - strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addAlkalineFertiliser(ItemStack stack, int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
private void addAlkalineFertiliser(ItemStack stack, int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type, pH + strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type, pH + strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addNutrientFertiliser(ItemStack stack, int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
private void addNutrientFertiliser(ItemStack stack, int strengthMax) {
|
||||
if (stack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type + strength, pH, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||
for (int pH = 0; pH < 3; ++pH) {
|
||||
for (int type = 0; type < 3; ++type) {
|
||||
int numOfBlocks = strengthMax * strengthMax;
|
||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||
ItemStack start = getStack(type, pH, moisture);
|
||||
ItemStack end = getStack(type + strength, pH, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
Object[] stacks = new Object[numOfBlocks + 1];
|
||||
for (int i = 0; i < numOfBlocks; ++i) {
|
||||
stacks[i] = start;
|
||||
}
|
||||
stacks[numOfBlocks] = stack.copy();
|
||||
GameRegistry.addShapelessRecipe(end, stacks);
|
||||
}
|
||||
numOfBlocks /= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,43 +3,43 @@ package binnie.botany.genetics;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public class AlleleColor implements IAlleleInteger {
|
||||
private String uid;
|
||||
private int value;
|
||||
private EnumFlowerColor color;
|
||||
private boolean dominant = true;
|
||||
private String uid;
|
||||
private int value;
|
||||
private EnumFlowerColor color;
|
||||
private boolean dominant = true;
|
||||
|
||||
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.value = value;
|
||||
}
|
||||
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return dominant;
|
||||
}
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return dominant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return color.getName();
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
@Override
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColor() {
|
||||
return color;
|
||||
}
|
||||
public EnumFlowerColor getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return getUID();
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return getUID();
|
||||
}
|
||||
}
|
||||
@@ -7,38 +7,38 @@ import forestry.api.genetics.IEffectData;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectNone implements IAlleleFlowerEffect {
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.flowerEffectNone";
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.flowerEffectNone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("forestry.allele.effect.none");
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return I18N.localise("forestry.allele.effect.none");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z) {
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return getUID();
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return getUID();
|
||||
}
|
||||
}
|
||||
@@ -8,23 +8,22 @@ import forestry.core.genetics.BreedingTracker;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker {
|
||||
public BotanistTracker(String s) {
|
||||
super(s);
|
||||
}
|
||||
public BotanistTracker(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPickup(IIndividual individual) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void registerPickup(IIndividual individual) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||
return Binnie.Genetics.getFlowerRoot()
|
||||
.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||
return Binnie.Genetics.getFlowerRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String speciesRootUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
@Override
|
||||
protected String speciesRootUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
}
|
||||
@@ -4,41 +4,40 @@ import binnie.botany.api.IColourMix;
|
||||
import binnie.botany.api.IFlowerColor;
|
||||
|
||||
public class ColorMix implements IColourMix {
|
||||
protected IFlowerColor color1;
|
||||
protected IFlowerColor color2;
|
||||
protected IFlowerColor result;
|
||||
protected int chance;
|
||||
protected IFlowerColor color1;
|
||||
protected IFlowerColor color2;
|
||||
protected IFlowerColor result;
|
||||
protected int chance;
|
||||
|
||||
public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColor1() {
|
||||
return color1;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColor getColor1() {
|
||||
return color1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColor2() {
|
||||
return color2;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColor getColor2() {
|
||||
return color2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(IFlowerColor color1, IFlowerColor color2) {
|
||||
return (color1 == this.color1 && color2 == this.color2)
|
||||
|| (color1 == this.color2 && color2 == this.color1);
|
||||
}
|
||||
@Override
|
||||
public boolean isMutation(IFlowerColor color1, IFlowerColor color2) {
|
||||
return (color1 == this.color1 && color2 == this.color2) || (color1 == this.color2 && color2 == this.color1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
@Override
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getResult() {
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColor getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -7,146 +7,146 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public enum EnumFlowerType implements IFlowerType {
|
||||
DANDELION,
|
||||
POPPY,
|
||||
ORCHID,
|
||||
ALLIUM,
|
||||
BLUET,
|
||||
TULIP,
|
||||
DAISY,
|
||||
CORNFLOWER,
|
||||
PANSY,
|
||||
IRIS,
|
||||
LAVENDER(2),
|
||||
VIOLA,
|
||||
DAFFODIL,
|
||||
DAHLIA,
|
||||
PEONY(2),
|
||||
ROSE(2),
|
||||
LILAC(2),
|
||||
HYDRANGEA(2),
|
||||
FOXGLOVE(2),
|
||||
ZINNIA,
|
||||
MUMS,
|
||||
MARIGOLD,
|
||||
GERANIUM,
|
||||
AZALEA,
|
||||
PRIMROSE,
|
||||
ASTER,
|
||||
CARNATION,
|
||||
LILY,
|
||||
YARROW,
|
||||
PETUNIA,
|
||||
AGAPANTHUS,
|
||||
FUCHSIA,
|
||||
DIANTHUS,
|
||||
FORGET,
|
||||
ANEMONE,
|
||||
AQUILEGIA,
|
||||
EDELWEISS,
|
||||
SCABIOUS,
|
||||
CONEFLOWER,
|
||||
GAILLARDIA,
|
||||
AURICULA,
|
||||
CAMELLIA(2),
|
||||
GOLDENROD(2),
|
||||
ALTHEA(2),
|
||||
PENSTEMON(2),
|
||||
DELPHINIUM(2),
|
||||
HOLLYHOCK(2);
|
||||
DANDELION,
|
||||
POPPY,
|
||||
ORCHID,
|
||||
ALLIUM,
|
||||
BLUET,
|
||||
TULIP,
|
||||
DAISY,
|
||||
CORNFLOWER,
|
||||
PANSY,
|
||||
IRIS,
|
||||
LAVENDER(2),
|
||||
VIOLA,
|
||||
DAFFODIL,
|
||||
DAHLIA,
|
||||
PEONY(2),
|
||||
ROSE(2),
|
||||
LILAC(2),
|
||||
HYDRANGEA(2),
|
||||
FOXGLOVE(2),
|
||||
ZINNIA,
|
||||
MUMS,
|
||||
MARIGOLD,
|
||||
GERANIUM,
|
||||
AZALEA,
|
||||
PRIMROSE,
|
||||
ASTER,
|
||||
CARNATION,
|
||||
LILY,
|
||||
YARROW,
|
||||
PETUNIA,
|
||||
AGAPANTHUS,
|
||||
FUCHSIA,
|
||||
DIANTHUS,
|
||||
FORGET,
|
||||
ANEMONE,
|
||||
AQUILEGIA,
|
||||
EDELWEISS,
|
||||
SCABIOUS,
|
||||
CONEFLOWER,
|
||||
GAILLARDIA,
|
||||
AURICULA,
|
||||
CAMELLIA(2),
|
||||
GOLDENROD(2),
|
||||
ALTHEA(2),
|
||||
PENSTEMON(2),
|
||||
DELPHINIUM(2),
|
||||
HOLLYHOCK(2);
|
||||
|
||||
protected int sections;
|
||||
protected IIcon[] stem;
|
||||
protected IIcon[] petal;
|
||||
protected IIcon[] variant;
|
||||
protected IIcon[] unflowered;
|
||||
protected IIcon seedStem;
|
||||
protected IIcon seedPetal;
|
||||
protected IIcon seedVariant;
|
||||
protected IIcon pollenStem;
|
||||
protected IIcon pollenPetal;
|
||||
protected IIcon pollenVariant;
|
||||
protected IIcon blank;
|
||||
protected int sections;
|
||||
protected IIcon[] stem;
|
||||
protected IIcon[] petal;
|
||||
protected IIcon[] variant;
|
||||
protected IIcon[] unflowered;
|
||||
protected IIcon seedStem;
|
||||
protected IIcon seedPetal;
|
||||
protected IIcon seedVariant;
|
||||
protected IIcon pollenStem;
|
||||
protected IIcon pollenPetal;
|
||||
protected IIcon pollenVariant;
|
||||
protected IIcon blank;
|
||||
|
||||
EnumFlowerType() {
|
||||
this(1);
|
||||
}
|
||||
EnumFlowerType() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
EnumFlowerType(int sections) {
|
||||
this.sections = sections;
|
||||
stem = new IIcon[sections];
|
||||
petal = new IIcon[sections];
|
||||
variant = new IIcon[sections];
|
||||
unflowered = new IIcon[sections];
|
||||
}
|
||||
EnumFlowerType(int sections) {
|
||||
this.sections = sections;
|
||||
stem = new IIcon[sections];
|
||||
petal = new IIcon[sections];
|
||||
variant = new IIcon[sections];
|
||||
unflowered = new IIcon[sections];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getStem(EnumFlowerStage stage, boolean flowered, int section) {
|
||||
if (stage == EnumFlowerStage.SEED) {
|
||||
return seedStem;
|
||||
}
|
||||
if (stage == EnumFlowerStage.POLLEN) {
|
||||
return pollenStem;
|
||||
}
|
||||
return stem[section % sections];
|
||||
}
|
||||
@Override
|
||||
public IIcon getStem(EnumFlowerStage stage, boolean flowered, int section) {
|
||||
if (stage == EnumFlowerStage.SEED) {
|
||||
return seedStem;
|
||||
}
|
||||
if (stage == EnumFlowerStage.POLLEN) {
|
||||
return pollenStem;
|
||||
}
|
||||
return stem[section % sections];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||
if (stage == EnumFlowerStage.SEED) {
|
||||
return seedPetal;
|
||||
}
|
||||
if (stage == EnumFlowerStage.POLLEN){
|
||||
return pollenPetal;
|
||||
}
|
||||
if (flowered) {
|
||||
return petal[section % sections];
|
||||
}
|
||||
return unflowered[section % sections];
|
||||
}
|
||||
@Override
|
||||
public IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||
if (stage == EnumFlowerStage.SEED) {
|
||||
return seedPetal;
|
||||
}
|
||||
if (stage == EnumFlowerStage.POLLEN) {
|
||||
return pollenPetal;
|
||||
}
|
||||
if (flowered) {
|
||||
return petal[section % sections];
|
||||
}
|
||||
return unflowered[section % sections];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||
if (stage == EnumFlowerStage.SEED) {
|
||||
return seedVariant;
|
||||
}
|
||||
if (stage == EnumFlowerStage.POLLEN) {
|
||||
return pollenVariant;
|
||||
}
|
||||
return flowered ? variant[section % sections] : blank;
|
||||
}
|
||||
@Override
|
||||
public IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||
if (stage == EnumFlowerStage.SEED) {
|
||||
return seedVariant;
|
||||
}
|
||||
if (stage == EnumFlowerStage.POLLEN) {
|
||||
return pollenVariant;
|
||||
}
|
||||
return flowered ? variant[section % sections] : blank;
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (int i = 0; i < sections; ++i) {
|
||||
String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||
String pre = (sections == 1) ? "" : "double/";
|
||||
String id = pre + toString().toLowerCase() + suf;
|
||||
stem[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".0");
|
||||
petal[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".1");
|
||||
variant[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".2");
|
||||
unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".3");
|
||||
}
|
||||
public void registerIcons(IIconRegister register) {
|
||||
for (int i = 0; i < sections; ++i) {
|
||||
String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||
String pre = (sections == 1) ? "" : "double/";
|
||||
String id = pre + toString().toLowerCase() + suf;
|
||||
stem[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".0");
|
||||
petal[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".1");
|
||||
variant[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".2");
|
||||
unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".3");
|
||||
}
|
||||
|
||||
blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||
seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||
seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||
seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||
pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||
pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||
pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||
}
|
||||
blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||
seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||
seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||
seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||
pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||
pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||
pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return ordinal();
|
||||
}
|
||||
@Override
|
||||
public int getID() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSections() {
|
||||
return sections;
|
||||
}
|
||||
@Override
|
||||
public int getSections() {
|
||||
return sections;
|
||||
}
|
||||
|
||||
public IIcon getBlank() {
|
||||
return blank;
|
||||
}
|
||||
public IIcon getBlank() {
|
||||
return blank;
|
||||
}
|
||||
}
|
||||
@@ -15,249 +15,265 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import java.util.List;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Flower extends Individual implements IFlower {
|
||||
public IFlowerGenome genome;
|
||||
public IFlowerGenome mate;
|
||||
public IFlowerGenome genome;
|
||||
public IFlowerGenome mate;
|
||||
|
||||
protected int age;
|
||||
protected boolean wilting;
|
||||
protected boolean flowered;
|
||||
protected int age;
|
||||
protected boolean wilting;
|
||||
protected boolean flowered;
|
||||
|
||||
public Flower(NBTTagCompound nbttagcompound) {
|
||||
age = 0;
|
||||
wilting = false;
|
||||
readFromNBT(nbttagcompound);
|
||||
}
|
||||
public Flower(NBTTagCompound nbttagcompound) {
|
||||
age = 0;
|
||||
wilting = false;
|
||||
readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public Flower(IFlowerGenome genome, int age) {
|
||||
this.genome = genome;
|
||||
this.age = age;
|
||||
wilting = false;
|
||||
flowered = age > 0;
|
||||
}
|
||||
public Flower(IFlowerGenome genome, int age) {
|
||||
this.genome = genome;
|
||||
this.age = age;
|
||||
wilting = false;
|
||||
flowered = age > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
IAlleleFlowerSpecies species = getGenome().getPrimary();
|
||||
String name = "";
|
||||
if (species != null) {
|
||||
name += species.getName();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
IAlleleFlowerSpecies species = getGenome().getPrimary();
|
||||
String name = "";
|
||||
if (species != null) {
|
||||
name += species.getName();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
IAlleleFlowerSpecies primary = genome.getPrimary();
|
||||
IAlleleFlowerSpecies secondary = genome.getSecondary();
|
||||
if (!isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||
list.add(EnumChatFormatting.BLUE + I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
|
||||
}
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
IAlleleFlowerSpecies primary = genome.getPrimary();
|
||||
IAlleleFlowerSpecies secondary = genome.getSecondary();
|
||||
if (!isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||
list.add(EnumChatFormatting.BLUE
|
||||
+ I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
|
||||
}
|
||||
|
||||
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge()));
|
||||
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.temperature", AlleleHelper.toDisplay(primary.getTemperature()), AlleleHelper.toDisplay(genome.getToleranceTemperature())));
|
||||
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.moisture", AlleleHelper.toDisplay(primary.getMoisture()), AlleleHelper.toDisplay(genome.getToleranceMoisture())));
|
||||
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.pH", AlleleHelper.toDisplay(primary.getHumidity()), AlleleHelper.toDisplay(genome.getTolerancePH())));
|
||||
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.fertility", genome.getFertility()));
|
||||
}
|
||||
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge()));
|
||||
list.add(EnumChatFormatting.GREEN
|
||||
+ I18N.localise(
|
||||
"botany.item.tooltip.temperature",
|
||||
AlleleHelper.toDisplay(primary.getTemperature()),
|
||||
AlleleHelper.toDisplay(genome.getToleranceTemperature())));
|
||||
list.add(EnumChatFormatting.GREEN
|
||||
+ I18N.localise(
|
||||
"botany.item.tooltip.moisture",
|
||||
AlleleHelper.toDisplay(primary.getMoisture()),
|
||||
AlleleHelper.toDisplay(genome.getToleranceMoisture())));
|
||||
list.add(EnumChatFormatting.GREEN
|
||||
+ I18N.localise(
|
||||
"botany.item.tooltip.pH",
|
||||
AlleleHelper.toDisplay(primary.getHumidity()),
|
||||
AlleleHelper.toDisplay(genome.getTolerancePH())));
|
||||
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.fertility", genome.getFertility()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdent() {
|
||||
return getGenome().getPrimary().getUID();
|
||||
}
|
||||
@Override
|
||||
public String getIdent() {
|
||||
return getGenome().getPrimary().getUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
genome = BotanyCore.getFlowerRoot()
|
||||
.templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
return;
|
||||
}
|
||||
|
||||
age = nbttagcompound.getInteger("Age");
|
||||
wilting = nbttagcompound.getBoolean("Wilt");
|
||||
flowered = nbttagcompound.getBoolean("Flowered");
|
||||
if (nbttagcompound.hasKey("Genome")) {
|
||||
genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
}
|
||||
if (nbttagcompound.hasKey("Mate")) {
|
||||
mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||
}
|
||||
}
|
||||
age = nbttagcompound.getInteger("Age");
|
||||
wilting = nbttagcompound.getBoolean("Wilt");
|
||||
flowered = nbttagcompound.getBoolean("Flowered");
|
||||
if (nbttagcompound.hasKey("Genome")) {
|
||||
genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
}
|
||||
if (nbttagcompound.hasKey("Mate")) {
|
||||
mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setInteger("Age", age);
|
||||
nbttagcompound.setBoolean("Wilt", wilting);
|
||||
nbttagcompound.setBoolean("Flowered", flowered);
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setInteger("Age", age);
|
||||
nbttagcompound.setBoolean("Wilt", wilting);
|
||||
nbttagcompound.setBoolean("Flowered", flowered);
|
||||
|
||||
if (genome != null) {
|
||||
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
genome.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Genome", NBTmachine);
|
||||
}
|
||||
if (genome != null) {
|
||||
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
genome.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Genome", NBTmachine);
|
||||
}
|
||||
|
||||
if (mate != null) {
|
||||
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
mate.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Mate", NBTmachine);
|
||||
}
|
||||
}
|
||||
if (mate != null) {
|
||||
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
mate.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Mate", NBTmachine);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMetadata() {
|
||||
return 0;
|
||||
}
|
||||
public int getMetadata() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome getGenome() {
|
||||
return genome;
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome getGenome() {
|
||||
return genome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mate(IFlower other) {
|
||||
mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||
}
|
||||
@Override
|
||||
public void mate(IFlower other) {
|
||||
mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome getMate() {
|
||||
return mate;
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome getMate() {
|
||||
return mate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower copy() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
return new Flower(nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public IFlower copy() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeToNBT(nbttagcompound);
|
||||
return new Flower(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
@Override
|
||||
public int getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
@Override
|
||||
public void setAge(int age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void age() {
|
||||
if (age < 15) {
|
||||
age++;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void age() {
|
||||
if (age < 15) {
|
||||
age++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAge() {
|
||||
return getGenome().getLifespan();
|
||||
}
|
||||
@Override
|
||||
public int getMaxAge() {
|
||||
return getGenome().getLifespan();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWilted() {
|
||||
return wilting;
|
||||
}
|
||||
@Override
|
||||
public boolean isWilted() {
|
||||
return wilting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWilted(boolean value) {
|
||||
wilting = value;
|
||||
}
|
||||
@Override
|
||||
public void setWilted(boolean value) {
|
||||
wilting = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFlowered() {
|
||||
return flowered;
|
||||
}
|
||||
@Override
|
||||
public boolean hasFlowered() {
|
||||
return flowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlowered(boolean value) {
|
||||
flowered = value;
|
||||
}
|
||||
@Override
|
||||
public void setFlowered(boolean value) {
|
||||
flowered = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMate() {
|
||||
mate = null;
|
||||
}
|
||||
@Override
|
||||
public void removeMate() {
|
||||
mate = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getOffspring(World world) {
|
||||
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = mutateSpecies(world, genome, mate);
|
||||
IChromosome[] parent2 = mutateSpecies(world, mate, genome);
|
||||
for (int i = 0; i < parent1.length; ++i) {
|
||||
if (parent1[i] != null && parent2[i] != null) {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||
}
|
||||
}
|
||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||
}
|
||||
@Override
|
||||
public IFlower getOffspring(World world) {
|
||||
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = mutateSpecies(world, genome, mate);
|
||||
IChromosome[] parent2 = mutateSpecies(world, mate, genome);
|
||||
for (int i = 0; i < parent1.length; ++i) {
|
||||
if (parent1[i] != null && parent2[i] != null) {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||
}
|
||||
}
|
||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||
}
|
||||
|
||||
private IChromosome[] mutateSpecies(World world, IFlowerGenome genomeOne, IFlowerGenome genomeTwo) {
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||
IAllele allele0;
|
||||
IAllele allele2;
|
||||
IFlowerGenome genome0;
|
||||
IFlowerGenome genome2;
|
||||
private IChromosome[] mutateSpecies(World world, IFlowerGenome genomeOne, IFlowerGenome genomeTwo) {
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||
IAllele allele0;
|
||||
IAllele allele2;
|
||||
IFlowerGenome genome0;
|
||||
IFlowerGenome genome2;
|
||||
|
||||
if (world.rand.nextBoolean()) {
|
||||
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeOne;
|
||||
genome2 = genomeTwo;
|
||||
} else {
|
||||
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeTwo;
|
||||
genome2 = genomeOne;
|
||||
}
|
||||
if (world.rand.nextBoolean()) {
|
||||
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeOne;
|
||||
genome2 = genomeTwo;
|
||||
} else {
|
||||
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
genome0 = genomeTwo;
|
||||
genome2 = genomeOne;
|
||||
}
|
||||
|
||||
IFlowerColor colour1 = genome0.getPrimaryColor();
|
||||
IFlowerColor colour2 = genome2.getPrimaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
IFlowerColor colour1 = genome0.getPrimaryColor();
|
||||
IFlowerColor colour2 = genome2.getPrimaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] =
|
||||
new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
colour1 = genome0.getSecondaryColor();
|
||||
colour2 = genome2.getSecondaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
colour1 = genome0.getSecondaryColor();
|
||||
colour2 = genome2.getSecondaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] =
|
||||
new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
colour1 = genome0.getStemColor();
|
||||
colour2 = genome2.getStemColor();
|
||||
if (colour1 != colour2) {
|
||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
colour1 = genome0.getStemColor();
|
||||
colour2 = genome2.getStemColor();
|
||||
if (colour1 != colour2) {
|
||||
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||
parent1[EnumFlowerChromosome.STEM.ordinal()] =
|
||||
new Chromosome(mutation.getResult().getAllele());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IChromosome[] template = null;
|
||||
for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||
float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
||||
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
||||
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
||||
}
|
||||
}
|
||||
IChromosome[] template = null;
|
||||
for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||
float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
||||
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
||||
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
if (template != null) {
|
||||
parent1 = template;
|
||||
}
|
||||
return parent1;
|
||||
}
|
||||
if (template != null) {
|
||||
parent1 = template;
|
||||
}
|
||||
return parent1;
|
||||
}
|
||||
}
|
||||
@@ -19,112 +19,110 @@ import forestry.core.genetics.Genome;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
|
||||
public FlowerGenome(IChromosome[] chromosomes) {
|
||||
super(chromosomes);
|
||||
}
|
||||
public FlowerGenome(IChromosome[] chromosomes) {
|
||||
super(chromosomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getPrimary() {
|
||||
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getPrimary() {
|
||||
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getSecondary() {
|
||||
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getSecondary() {
|
||||
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getPrimaryColor() {
|
||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerColor getPrimaryColor() {
|
||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getSecondaryColor() {
|
||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerColor getSecondaryColor() {
|
||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getStemColor() {
|
||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerColor getStemColor() {
|
||||
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||
}
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerType getType() {
|
||||
return getPrimary().getType();
|
||||
}
|
||||
@Override
|
||||
public IFlowerType getType() {
|
||||
return getPrimary().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemperature() {
|
||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemperature() {
|
||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceMoisture() {
|
||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
@Override
|
||||
public EnumTolerance getToleranceMoisture() {
|
||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTolerancePH() {
|
||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||
}
|
||||
@Override
|
||||
public EnumTolerance getTolerancePH() {
|
||||
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAgeChance() {
|
||||
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
||||
}
|
||||
@Override
|
||||
public float getAgeChance() {
|
||||
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
return ((IAlleleFloat) getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
return ((IAlleleFloat) getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(EnumAcidity ePH) {
|
||||
int pH = ePH.ordinal();
|
||||
int[] pHTol = Binnie.Genetics.getTolerance(getTolerancePH());
|
||||
int fPH = getPrimary().getPH().ordinal();
|
||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||
}
|
||||
@Override
|
||||
public boolean canTolerate(EnumAcidity ePH) {
|
||||
int pH = ePH.ordinal();
|
||||
int[] pHTol = Binnie.Genetics.getTolerance(getTolerancePH());
|
||||
int fPH = getPrimary().getPH().ordinal();
|
||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(EnumMoisture eMoisture) {
|
||||
int moisture = eMoisture.ordinal();
|
||||
int[] moistTol = Binnie.Genetics.getTolerance(getToleranceMoisture());
|
||||
int fMoisture = getPrimary().getMoisture().ordinal();
|
||||
return moisture >= fMoisture + moistTol[0]
|
||||
&& moisture <= fMoisture + moistTol[1];
|
||||
}
|
||||
@Override
|
||||
public boolean canTolerate(EnumMoisture eMoisture) {
|
||||
int moisture = eMoisture.ordinal();
|
||||
int[] moistTol = Binnie.Genetics.getTolerance(getToleranceMoisture());
|
||||
int fMoisture = getPrimary().getMoisture().ordinal();
|
||||
return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(EnumTemperature eTemp) {
|
||||
int temp = eTemp.ordinal();
|
||||
int[] tempTol = Binnie.Genetics.getTolerance(getToleranceTemperature());
|
||||
int fTemp = getPrimary().getTemperature().ordinal();
|
||||
return temp >= fTemp + tempTol[0]
|
||||
&& temp <= fTemp + tempTol[1];
|
||||
}
|
||||
@Override
|
||||
public boolean canTolerate(EnumTemperature eTemp) {
|
||||
int temp = eTemp.ordinal();
|
||||
int[] tempTol = Binnie.Genetics.getTolerance(getToleranceTemperature());
|
||||
int fTemp = getPrimary().getTemperature().ordinal();
|
||||
return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1];
|
||||
}
|
||||
}
|
||||
@@ -18,257 +18,261 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
||||
public static int flowerSpeciesCount = -1;
|
||||
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||
public static int flowerSpeciesCount = -1;
|
||||
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||
|
||||
protected static String UID = "rootFlowers";
|
||||
protected static String UID = "rootFlowers";
|
||||
|
||||
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||
|
||||
protected Map<ItemStack, IFlower> conversions;
|
||||
protected Map<ItemStack, IFlower> conversions;
|
||||
|
||||
public FlowerHelper() {
|
||||
conversions = new HashMap<>();
|
||||
}
|
||||
public FlowerHelper() {
|
||||
conversions = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return UID;
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeciesCount() {
|
||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||
FlowerHelper.flowerSpeciesCount = 0;
|
||||
for (Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
||||
if (entry.getValue() instanceof IAlleleFlowerSpecies && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
||||
FlowerHelper.flowerSpeciesCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FlowerHelper.flowerSpeciesCount;
|
||||
}
|
||||
@Override
|
||||
public int getSpeciesCount() {
|
||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||
FlowerHelper.flowerSpeciesCount = 0;
|
||||
for (Map.Entry<String, IAllele> entry :
|
||||
AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
||||
if (entry.getValue() instanceof IAlleleFlowerSpecies
|
||||
&& ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
||||
FlowerHelper.flowerSpeciesCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FlowerHelper.flowerSpeciesCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(ItemStack stack) {
|
||||
return stack != null
|
||||
&& getStageType(stack) != EnumFlowerStage.NONE;
|
||||
}
|
||||
@Override
|
||||
public boolean isMember(ItemStack stack) {
|
||||
return stack != null && getStageType(stack) != EnumFlowerStage.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(ItemStack stack, int type) {
|
||||
return getStageType(stack).ordinal() == type;
|
||||
}
|
||||
@Override
|
||||
public boolean isMember(ItemStack stack, int type) {
|
||||
return getStageType(stack).ordinal() == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
}
|
||||
@Override
|
||||
public boolean isMember(IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getMemberStack(IIndividual flower, int type) {
|
||||
if (!isMember(flower)) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getMemberStack(IIndividual flower, int type) {
|
||||
if (!isMember(flower)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item flowerItem = Botany.flowerItem;
|
||||
if (type == EnumFlowerStage.SEED.ordinal()) {
|
||||
flowerItem = Botany.seed;
|
||||
}
|
||||
Item flowerItem = Botany.flowerItem;
|
||||
if (type == EnumFlowerStage.SEED.ordinal()) {
|
||||
flowerItem = Botany.seed;
|
||||
}
|
||||
|
||||
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
||||
flowerItem = Botany.pollen;
|
||||
}
|
||||
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
||||
flowerItem = Botany.pollen;
|
||||
}
|
||||
|
||||
if (flowerItem != Botany.flowerItem) {
|
||||
((IFlower) flower).setAge(0);
|
||||
}
|
||||
if (flowerItem != Botany.flowerItem) {
|
||||
((IFlower) flower).setAge(0);
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
flower.writeToNBT(nbttagcompound);
|
||||
ItemStack flowerStack = new ItemStack(flowerItem);
|
||||
flowerStack.setTagCompound(nbttagcompound);
|
||||
return flowerStack;
|
||||
}
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
flower.writeToNBT(nbttagcompound);
|
||||
ItemStack flowerStack = new ItemStack(flowerItem);
|
||||
flowerStack.setTagCompound(nbttagcompound);
|
||||
return flowerStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStageType(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return EnumFlowerStage.NONE;
|
||||
}
|
||||
if (stack.getItem() == Botany.flowerItem) {
|
||||
return EnumFlowerStage.FLOWER;
|
||||
}
|
||||
if (stack.getItem() == Botany.pollen) {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
if (stack.getItem() == Botany.seed) {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
return EnumFlowerStage.NONE;
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStageType(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return EnumFlowerStage.NONE;
|
||||
}
|
||||
if (stack.getItem() == Botany.flowerItem) {
|
||||
return EnumFlowerStage.FLOWER;
|
||||
}
|
||||
if (stack.getItem() == Botany.pollen) {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
if (stack.getItem() == Botany.seed) {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
return EnumFlowerStage.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getMember(ItemStack stack) {
|
||||
if (!isMember(stack)) {
|
||||
return null;
|
||||
}
|
||||
return new Flower(stack.getTagCompound());
|
||||
}
|
||||
@Override
|
||||
public IFlower getMember(ItemStack stack) {
|
||||
if (!isMember(stack)) {
|
||||
return null;
|
||||
}
|
||||
return new Flower(stack.getTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getFlower(World world, IFlowerGenome genome) {
|
||||
return new Flower(genome, 2);
|
||||
}
|
||||
@Override
|
||||
public IFlower getFlower(World world, IFlowerGenome genome) {
|
||||
return new Flower(genome, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(IAllele[] template) {
|
||||
return new FlowerGenome(templateAsChromosomes(template));
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(IAllele[] template) {
|
||||
return new FlowerGenome(templateAsChromosomes(template));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||
return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive));
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||
return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower templateAsIndividual(IAllele[] template) {
|
||||
return new Flower(templateAsGenome(template), 2);
|
||||
}
|
||||
@Override
|
||||
public IFlower templateAsIndividual(IAllele[] template) {
|
||||
return new Flower(templateAsGenome(template), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||
return new Flower(templateAsGenome(templateActive, templateInactive), 2);
|
||||
}
|
||||
@Override
|
||||
public IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||
return new Flower(templateAsGenome(templateActive, templateInactive), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<IFlower> getIndividualTemplates() {
|
||||
return FlowerHelper.flowerTemplates;
|
||||
}
|
||||
@Override
|
||||
public ArrayList<IFlower> getIndividualTemplates() {
|
||||
return FlowerHelper.flowerTemplates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(IAllele[] template) {
|
||||
registerTemplate(template[0].getUID(), template);
|
||||
}
|
||||
@Override
|
||||
public void registerTemplate(IAllele[] template) {
|
||||
registerTemplate(template[0].getUID(), template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(String identifier, IAllele[] template) {
|
||||
FlowerHelper.flowerTemplates.add(new Flower(templateAsGenome(template), 2));
|
||||
if (!speciesTemplates.containsKey(identifier)) {
|
||||
speciesTemplates.put(identifier, template);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void registerTemplate(String identifier, IAllele[] template) {
|
||||
FlowerHelper.flowerTemplates.add(new Flower(templateAsGenome(template), 2));
|
||||
if (!speciesTemplates.containsKey(identifier)) {
|
||||
speciesTemplates.put(identifier, template);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate(String identifier) {
|
||||
return speciesTemplates.get(identifier);
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getTemplate(String identifier) {
|
||||
return speciesTemplates.get(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return FlowerTemplates.getDefaultTemplate();
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return FlowerTemplates.getDefaultTemplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getRandomTemplate(Random rand) {
|
||||
return speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(speciesTemplates.values().size())];
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getRandomTemplate(Random rand) {
|
||||
return speciesTemplates.values()
|
||||
.toArray(new IAllele[0][])[
|
||||
rand.nextInt(speciesTemplates.values().size())];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IFlowerMutation> getMutations(boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||
}
|
||||
return FlowerHelper.flowerMutations;
|
||||
}
|
||||
@Override
|
||||
public Collection<IFlowerMutation> getMutations(boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||
}
|
||||
return FlowerHelper.flowerMutations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMutation(IMutation mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID()) ||
|
||||
AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID()) ||
|
||||
AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||
return;
|
||||
}
|
||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||
}
|
||||
@Override
|
||||
public void registerMutation(IMutation mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())
|
||||
|| AlleleManager.alleleRegistry.isBlacklisted(
|
||||
mutation.getAllele0().getUID())
|
||||
|| AlleleManager.alleleRegistry.isBlacklisted(
|
||||
mutation.getAllele1().getUID())) {
|
||||
return;
|
||||
}
|
||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBotanistTracker getBreedingTracker(World world, GameProfile player) {
|
||||
String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
||||
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
||||
if (tracker == null) {
|
||||
tracker = new BotanistTracker(filename);
|
||||
world.setItemData(filename, tracker);
|
||||
}
|
||||
return tracker;
|
||||
}
|
||||
@Override
|
||||
public IBotanistTracker getBreedingTracker(World world, GameProfile player) {
|
||||
String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
||||
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
||||
if (tracker == null) {
|
||||
tracker = new BotanistTracker(filename);
|
||||
world.setItemData(filename, tracker);
|
||||
}
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getMember(NBTTagCompound compound) {
|
||||
return new Flower(compound);
|
||||
}
|
||||
@Override
|
||||
public IIndividual getMember(NBTTagCompound compound) {
|
||||
return new Flower(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getMemberClass() {
|
||||
return IFlower.class;
|
||||
}
|
||||
@Override
|
||||
public Class getMemberClass() {
|
||||
return IFlower.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumFlowerChromosome.values();
|
||||
}
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumFlowerChromosome.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getKaryotypeKey() {
|
||||
return EnumFlowerChromosome.SPECIES;
|
||||
}
|
||||
@Override
|
||||
public IChromosomeType getKaryotypeKey() {
|
||||
return EnumFlowerChromosome.SPECIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConversion(ItemStack stack, IAllele[] template) {
|
||||
IFlower flower = getFlower(null, templateAsGenome(template));
|
||||
conversions.put(stack, flower);
|
||||
}
|
||||
@Override
|
||||
public void addConversion(ItemStack stack, IAllele[] template) {
|
||||
IFlower flower = getFlower(null, templateAsGenome(template));
|
||||
conversions.put(stack, flower);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getConversion(ItemStack stack) {
|
||||
for (Map.Entry<ItemStack, IFlower> entry : conversions.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return (IFlower) entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IFlower getConversion(ItemStack stack) {
|
||||
for (Map.Entry<ItemStack, IFlower> entry : conversions.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return (IFlower) entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerColourMix(IColourMix colorMix) {
|
||||
FlowerHelper.colourMixes.add(colorMix);
|
||||
}
|
||||
@Override
|
||||
public void registerColourMix(IColourMix colorMix) {
|
||||
FlowerHelper.colourMixes.add(colorMix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IColourMix> getColourMixes(boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.colourMixes);
|
||||
}
|
||||
return FlowerHelper.colourMixes;
|
||||
}
|
||||
@Override
|
||||
public Collection<IColourMix> getColourMixes(boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.colourMixes);
|
||||
}
|
||||
return FlowerHelper.colourMixes;
|
||||
}
|
||||
|
||||
// ??
|
||||
@Override
|
||||
public ISpeciesType getType(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
// ??
|
||||
@Override
|
||||
public ISpeciesType getType(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,80 +6,80 @@ import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class FlowerMutation implements IFlowerMutation {
|
||||
protected IAlleleFlowerSpecies allele0;
|
||||
protected IAlleleFlowerSpecies allele1;
|
||||
protected IAllele[] template;
|
||||
protected int chance;
|
||||
protected IAlleleFlowerSpecies allele0;
|
||||
protected IAlleleFlowerSpecies allele1;
|
||||
protected IAllele[] template;
|
||||
protected int chance;
|
||||
|
||||
FlowerMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] template, int chance) {
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
}
|
||||
FlowerMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] template, int chance) {
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele0() {
|
||||
return allele0;
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele0() {
|
||||
return allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele1() {
|
||||
return allele1;
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele1() {
|
||||
return allele1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return template;
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBaseChance() {
|
||||
return chance;
|
||||
}
|
||||
@Override
|
||||
public float getBaseChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartner(IAllele allele) {
|
||||
return allele.getUID().equals(allele0.getUID())
|
||||
|| allele.getUID().equals(allele1.getUID());
|
||||
}
|
||||
@Override
|
||||
public boolean isPartner(IAllele allele) {
|
||||
return allele.getUID().equals(allele0.getUID()) || allele.getUID().equals(allele1.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getPartner(IAllele allele) {
|
||||
return allele.getUID().equals(allele0.getUID()) ? allele1 : allele0;
|
||||
}
|
||||
@Override
|
||||
public IAllele getPartner(IAllele allele) {
|
||||
return allele.getUID().equals(allele0.getUID()) ? allele1 : allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
if (allele0 == null || allele1 == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
return getBaseChance();
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
return getBaseChance();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@Override
|
||||
public float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
if (allele0 == null || allele1 == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.allele0.getUID().equals(allele0.getUID())
|
||||
&& this.allele1.getUID().equals(allele1.getUID())) {
|
||||
return getBaseChance();
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID())
|
||||
&& this.allele0.getUID().equals(allele1.getUID())) {
|
||||
return getBaseChance();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getRoot() {
|
||||
return BotanyCore.getFlowerRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getSpecialConditions() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@Override
|
||||
public Collection<String> getSpecialConditions() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -7,20 +7,20 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
public class FlowerTemplates {
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Fertility.NORMAL);
|
||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Territory.AVERAGE);
|
||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleHelper.getAllele(EnumAllele.Lifespan.NORMAL);
|
||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
||||
return alleles;
|
||||
}
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Fertility.NORMAL);
|
||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Territory.AVERAGE);
|
||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleHelper.getAllele(EnumAllele.Lifespan.NORMAL);
|
||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
||||
return alleles;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import binnie.botany.core.BotanyGUI;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -14,54 +15,52 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemDictionary extends Item {
|
||||
protected IIcon iconMaster;
|
||||
protected IIcon iconMaster;
|
||||
|
||||
public ItemDictionary() {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("database");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
public ItemDictionary() {
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setUnlocalizedName("database");
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||
iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||
iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return (damage == 0) ? itemIcon : iconMaster;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return (damage == 0) ? itemIcon : iconMaster;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
super.getSubItems(item, tab, list);
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
super.getSubItems(item, tab, list);
|
||||
list.add(new ItemStack(item, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
BotanyGUI guiId = (stack.getItemDamage() == 0) ? BotanyGUI.Database : BotanyGUI.DatabaseNEI;
|
||||
Botany.proxy.openGui(guiId, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
BotanyGUI guiId = (stack.getItemDamage() == 0) ? BotanyGUI.Database : BotanyGUI.DatabaseNEI;
|
||||
Botany.proxy.openGui(guiId, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return (stack.getItemDamage() == 0)
|
||||
? I18N.localise("botany.item.database.0.name")
|
||||
: I18N.localise("botany.item.database.1.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return (stack.getItemDamage() == 0)
|
||||
? I18N.localise("botany.item.database.0.name")
|
||||
: I18N.localise("botany.item.database.1.name");
|
||||
}
|
||||
}
|
||||
@@ -22,56 +22,63 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ModuleGenetics implements IInitializable {
|
||||
static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
|
||||
static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
EnumFlowerColor.setupMutations();
|
||||
Botany.flower = new BlockFlower();
|
||||
Botany.flowerItem = new ItemFlower();
|
||||
Botany.pollen = new ItemPollen();
|
||||
Botany.seed = new ItemSeed();
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.speciesRoot);
|
||||
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
|
||||
GameRegistry.registerBlock(Botany.flower, "flower");
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
Botany.database = new ItemDictionary();
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
EnumFlowerColor.setupMutations();
|
||||
Botany.flower = new BlockFlower();
|
||||
Botany.flowerItem = new ItemFlower();
|
||||
Botany.pollen = new ItemPollen();
|
||||
Botany.seed = new ItemSeed();
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(BotanyCore.speciesRoot);
|
||||
AlleleManager.alleleRegistry.registerAllele(ModuleGenetics.alleleEffectNone);
|
||||
GameRegistry.registerBlock(Botany.flower, "flower");
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
Botany.database = new ItemDictionary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||
}
|
||||
|
||||
FlowerSpecies.setupVariants();
|
||||
for (FlowerSpecies species : FlowerSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||
for (IAllele[] variant : species.getVariants()) {
|
||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||
}
|
||||
}
|
||||
FlowerSpecies.setupVariants();
|
||||
for (FlowerSpecies species : FlowerSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||
for (IAllele[] variant : species.getVariants()) {
|
||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||
}
|
||||
}
|
||||
|
||||
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||
}
|
||||
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
||||
RecipeManagers.carpenterManager.addRecipe(
|
||||
100,
|
||||
Binnie.Liquid.getLiquidStack("water", 2000),
|
||||
null,
|
||||
new ItemStack(Botany.database),
|
||||
"X#X", "YEY", "RDR",
|
||||
'#', Blocks.glass_pane,
|
||||
'X', Items.gold_ingot,
|
||||
'Y', Items.gold_nugget,
|
||||
'R', Items.redstone,
|
||||
'D', Items.diamond,
|
||||
'E', Items.emerald
|
||||
);
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
||||
RecipeManagers.carpenterManager.addRecipe(
|
||||
100,
|
||||
Binnie.Liquid.getLiquidStack("water", 2000),
|
||||
null,
|
||||
new ItemStack(Botany.database),
|
||||
"X#X",
|
||||
"YEY",
|
||||
"RDR",
|
||||
'#',
|
||||
Blocks.glass_pane,
|
||||
'X',
|
||||
Items.gold_ingot,
|
||||
'Y',
|
||||
Items.gold_nugget,
|
||||
'R',
|
||||
Items.redstone,
|
||||
'D',
|
||||
Items.diamond,
|
||||
'E',
|
||||
Items.emerald);
|
||||
}
|
||||
}
|
||||
@@ -3,58 +3,57 @@ package binnie.botany.items;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.item.IItemMisc;
|
||||
import binnie.core.util.I18N;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public enum BotanyItems implements IItemMisc {
|
||||
AshPowder("powderAsh"),
|
||||
PulpPowder("powderPulp"),
|
||||
MulchPowder("powderMulch"),
|
||||
SulphurPowder("powderSulphur"),
|
||||
FertiliserPowder("powderFertiliser"),
|
||||
CompostPowder("powderCompost"),
|
||||
Mortar("mortar"),
|
||||
Weedkiller("weedkiller");
|
||||
AshPowder("powderAsh"),
|
||||
PulpPowder("powderPulp"),
|
||||
MulchPowder("powderMulch"),
|
||||
SulphurPowder("powderSulphur"),
|
||||
FertiliserPowder("powderFertiliser"),
|
||||
CompostPowder("powderCompost"),
|
||||
Mortar("mortar"),
|
||||
Weedkiller("weedkiller");
|
||||
|
||||
protected IIcon icon;
|
||||
protected String name;
|
||||
protected String iconPath;
|
||||
protected IIcon icon;
|
||||
protected String name;
|
||||
protected String iconPath;
|
||||
|
||||
BotanyItems(String name) {
|
||||
this.name = name;
|
||||
this.iconPath = name;
|
||||
}
|
||||
BotanyItems(String name) {
|
||||
this.name = name;
|
||||
this.iconPath = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack itemStack) {
|
||||
return icon;
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack itemStack) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icon = Botany.proxy.getIcon(register, iconPath);
|
||||
}
|
||||
@Override
|
||||
public void registerIcons(IIconRegister register) {
|
||||
icon = Botany.proxy.getIcon(register, iconPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(List data) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addInformation(List data) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(ItemStack itemStack) {
|
||||
return I18N.localise("botany.item." + name + ".name");
|
||||
}
|
||||
@Override
|
||||
public String getName(ItemStack itemStack) {
|
||||
return I18N.localise("botany.item." + name + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(int count) {
|
||||
return new ItemStack(Botany.misc, count, ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack get(int count) {
|
||||
return new ItemStack(Botany.misc, count, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,44 +14,43 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemClay extends Item {
|
||||
public ItemClay() {
|
||||
setUnlocalizedName("clay");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
public ItemClay() {
|
||||
setUnlocalizedName("clay");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(EnumChatFormatting.GRAY
|
||||
+ EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||
int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||
int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("botany.item.clay.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("botany.item.clay.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,44 +14,43 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPigment extends Item {
|
||||
public ItemPigment() {
|
||||
setUnlocalizedName("pigment");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
public ItemPigment() {
|
||||
setUnlocalizedName("pigment");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
tooltip.add(EnumChatFormatting.GRAY
|
||||
+ EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||
int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||
int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("botany.item.pigment.name");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return I18N.localise("botany.item.pigment.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||
}
|
||||
}
|
||||
@@ -6,45 +6,44 @@ import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.network.packet.MessageCoordinates;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class MessageFlowerUpdate extends MessageCoordinates {
|
||||
public TileEntityFlower.RenderInfo render;
|
||||
public TileEntityFlower.RenderInfo render;
|
||||
|
||||
public MessageFlowerUpdate(int posX, int posY, int posZ, TileEntityFlower.RenderInfo render) {
|
||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||
this.render = render;
|
||||
}
|
||||
public MessageFlowerUpdate(int posX, int posY, int posZ, TileEntityFlower.RenderInfo render) {
|
||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||
this.render = render;
|
||||
}
|
||||
|
||||
public MessageFlowerUpdate(MessageBinnie message) {
|
||||
super(message);
|
||||
}
|
||||
public MessageFlowerUpdate(MessageBinnie message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(ByteBuf data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeByte(render.primary.getID());
|
||||
data.writeByte(render.secondary.getID());
|
||||
data.writeByte(render.stem.getID());
|
||||
data.writeByte(render.type.ordinal());
|
||||
data.writeByte(render.age);
|
||||
data.writeByte(render.section);
|
||||
data.writeBoolean(render.wilted);
|
||||
data.writeBoolean(render.flowered);
|
||||
}
|
||||
@Override
|
||||
public void writeData(ByteBuf data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeByte(render.primary.getID());
|
||||
data.writeByte(render.secondary.getID());
|
||||
data.writeByte(render.stem.getID());
|
||||
data.writeByte(render.type.ordinal());
|
||||
data.writeByte(render.age);
|
||||
data.writeByte(render.section);
|
||||
data.writeBoolean(render.wilted);
|
||||
data.writeBoolean(render.flowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
render = new TileEntityFlower.RenderInfo();
|
||||
render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
render.type = EnumFlowerType.values()[data.readByte()];
|
||||
render.age = data.readByte();
|
||||
render.section = data.readByte();
|
||||
render.wilted = data.readBoolean();
|
||||
render.flowered = data.readBoolean();
|
||||
}
|
||||
@Override
|
||||
public void readData(ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
render = new TileEntityFlower.RenderInfo();
|
||||
render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
render.type = EnumFlowerType.values()[data.readByte()];
|
||||
render.age = data.readByte();
|
||||
render.section = data.readByte();
|
||||
render.wilted = data.readBoolean();
|
||||
render.flowered = data.readBoolean();
|
||||
}
|
||||
}
|
||||
@@ -17,74 +17,76 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
public enum PacketID implements IPacketID {
|
||||
FieldKit,
|
||||
FlowerUpdate;
|
||||
FieldKit,
|
||||
FlowerUpdate;
|
||||
|
||||
@Override
|
||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||
if (this == PacketID.FieldKit && context.side == Side.CLIENT) {
|
||||
onFieldKitPacket(message);
|
||||
} else if (this == PacketID.FlowerUpdate) {
|
||||
onFlowerUpdatePacket(message);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||
if (this == PacketID.FieldKit && context.side == Side.CLIENT) {
|
||||
onFieldKitPacket(message);
|
||||
} else if (this == PacketID.FlowerUpdate) {
|
||||
onFlowerUpdatePacket(message);
|
||||
}
|
||||
}
|
||||
|
||||
private void onFlowerUpdatePacket(MessageBinnie message) {
|
||||
MessageFlowerUpdate packet = new MessageFlowerUpdate(message);
|
||||
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).setRender(packet.render);
|
||||
}
|
||||
}
|
||||
private void onFlowerUpdatePacket(MessageBinnie message) {
|
||||
MessageFlowerUpdate packet = new MessageFlowerUpdate(message);
|
||||
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).setRender(packet.render);
|
||||
}
|
||||
}
|
||||
|
||||
private void onFieldKitPacket(MessageBinnie message) {
|
||||
MessageNBT packet = new MessageNBT(message);
|
||||
NBTTagCompound data = packet.getTagCompound();
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
String info = "";
|
||||
if (data.hasNoTags()) {
|
||||
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
||||
} else {
|
||||
IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
float age = data.getFloat("Age");
|
||||
EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||
if (primary == null || secondary == null) {
|
||||
return;
|
||||
}
|
||||
private void onFieldKitPacket(MessageBinnie message) {
|
||||
MessageNBT packet = new MessageNBT(message);
|
||||
NBTTagCompound data = packet.getTagCompound();
|
||||
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||
String info = "";
|
||||
if (data.hasNoTags()) {
|
||||
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
||||
} else {
|
||||
IAlleleFlowerSpecies primary =
|
||||
(IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
IAlleleFlowerSpecies secondary =
|
||||
(IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
float age = data.getFloat("Age");
|
||||
EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||
if (primary == null || secondary == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
info += "A";
|
||||
if (age == 0.0f) {
|
||||
info += "";
|
||||
} else if (age < 0.25f) {
|
||||
info += " Young";
|
||||
} else if (age < 0.75f) {
|
||||
info += " Mature";
|
||||
} else {
|
||||
info += " Old";
|
||||
}
|
||||
info += "A";
|
||||
if (age == 0.0f) {
|
||||
info += "";
|
||||
} else if (age < 0.25f) {
|
||||
info += " Young";
|
||||
} else if (age < 0.75f) {
|
||||
info += " Mature";
|
||||
} else {
|
||||
info += " Old";
|
||||
}
|
||||
|
||||
if (color1 == color2) {
|
||||
info = info + " " + color1.getName();
|
||||
} else {
|
||||
info = info + " " + color1.getName() + " & " + color2.getName();
|
||||
}
|
||||
if (color1 == color2) {
|
||||
info = info + " " + color1.getName();
|
||||
} else {
|
||||
info = info + " " + color1.getName() + " & " + color2.getName();
|
||||
}
|
||||
|
||||
if (primary == secondary) {
|
||||
info = info + " " + primary.getName();
|
||||
} else {
|
||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
||||
}
|
||||
if (primary == secondary) {
|
||||
info = info + " " + primary.getName();
|
||||
} else {
|
||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
||||
}
|
||||
|
||||
if (age == 0.0f) {
|
||||
info += " Germling";
|
||||
}
|
||||
if (data.getBoolean("Wilting")) {
|
||||
info += ". Shame it is Wilting!";
|
||||
}
|
||||
}
|
||||
IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
if (age == 0.0f) {
|
||||
info += " Germling";
|
||||
}
|
||||
if (data.getBoolean("Wilting")) {
|
||||
info += ". Shame it is Wilting!";
|
||||
}
|
||||
}
|
||||
IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
}
|
||||
@@ -2,5 +2,4 @@ package binnie.botany.proxy;
|
||||
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
|
||||
public interface IBotanyProxy extends IProxyCore {
|
||||
}
|
||||
public interface IBotanyProxy extends IProxyCore {}
|
||||
@@ -4,7 +4,7 @@ import binnie.botany.Botany;
|
||||
import binnie.core.proxy.BinnieModProxy;
|
||||
|
||||
public class Proxy extends BinnieModProxy implements IBotanyProxy {
|
||||
public Proxy() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
public Proxy() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
package binnie.botany.proxy;
|
||||
|
||||
public class ProxyClient extends Proxy implements IBotanyProxy {
|
||||
}
|
||||
public class ProxyClient extends Proxy implements IBotanyProxy {}
|
||||
@@ -1,4 +1,3 @@
|
||||
package binnie.botany.proxy;
|
||||
|
||||
public class ProxyServer extends Proxy implements IBotanyProxy {
|
||||
}
|
||||
public class ProxyServer extends Proxy implements IBotanyProxy {}
|
||||
@@ -11,133 +11,132 @@ import binnie.core.proxy.IProxyCore;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
private final LinkedHashSet<Field> fields;
|
||||
protected final List<IInitializable> modules;
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
private final LinkedHashSet<Field> fields;
|
||||
protected final List<IInitializable> modules;
|
||||
|
||||
public AbstractMod() {
|
||||
fields = new LinkedHashSet<>();
|
||||
modules = new ArrayList<>();
|
||||
BinnieCore.registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
public AbstractMod() {
|
||||
fields = new LinkedHashSet<>();
|
||||
modules = new ArrayList<>();
|
||||
BinnieCore.registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public abstract boolean isActive();
|
||||
public abstract boolean isActive();
|
||||
|
||||
@Override
|
||||
public abstract String getChannel();
|
||||
@Override
|
||||
public abstract String getChannel();
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return new IPacketID[0];
|
||||
}
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return new IPacketID[0];
|
||||
}
|
||||
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return new IBinnieGUID[0];
|
||||
}
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return new IBinnieGUID[0];
|
||||
}
|
||||
|
||||
public Class[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
public Class[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
public abstract IProxyCore getProxy();
|
||||
public abstract IProxyCore getProxy();
|
||||
|
||||
public abstract String getModID();
|
||||
public abstract String getModID();
|
||||
|
||||
public SimpleNetworkWrapper getNetworkWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
public SimpleNetworkWrapper getNetworkWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
|
||||
protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getConfigs() != null) {
|
||||
for (Class cls : getConfigs()) {
|
||||
Binnie.Configuration.registerConfiguration(cls, this);
|
||||
}
|
||||
}
|
||||
if (getConfigs() != null) {
|
||||
for (Class cls : getConfigs()) {
|
||||
Binnie.Configuration.registerConfiguration(cls, this);
|
||||
}
|
||||
}
|
||||
|
||||
getProxy().preInit();
|
||||
for (IInitializable module : modules) {
|
||||
module.preInit();
|
||||
}
|
||||
|
||||
// TODO what does it mean?
|
||||
Collections.addAll(fields, getClass().getFields());
|
||||
for (Class cls : getClass().getClasses()) {
|
||||
Collections.addAll(fields, getClass().getFields());
|
||||
}
|
||||
for (IInitializable module : modules) {
|
||||
Collections.addAll(fields, module.getClass().getFields());
|
||||
}
|
||||
for (Field field4 : fields) {
|
||||
try {
|
||||
FieldParser.preInitParse(field4, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
getProxy().preInit();
|
||||
for (IInitializable module : modules) {
|
||||
module.preInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
getProxy().init();
|
||||
// TODO what does it mean?
|
||||
Collections.addAll(fields, getClass().getFields());
|
||||
for (Class cls : getClass().getClasses()) {
|
||||
Collections.addAll(fields, getClass().getFields());
|
||||
}
|
||||
for (IInitializable module : modules) {
|
||||
Collections.addAll(fields, module.getClass().getFields());
|
||||
}
|
||||
for (Field field4 : fields) {
|
||||
try {
|
||||
FieldParser.preInitParse(field4, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(getChannel());
|
||||
wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.CLIENT);
|
||||
wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.SERVER);
|
||||
for (IInitializable module : modules) {
|
||||
module.init();
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
getProxy().init();
|
||||
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
FieldParser.initParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(getChannel());
|
||||
wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.CLIENT);
|
||||
wrapper.registerMessage(getPacketHandler(), MessageBinnie.class, 1, Side.SERVER);
|
||||
for (IInitializable module : modules) {
|
||||
module.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
FieldParser.initParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getProxy().postInit();
|
||||
for (IInitializable module : modules) {
|
||||
module.postInit();
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
if (!isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
FieldParser.postInitParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
getProxy().postInit();
|
||||
for (IInitializable module : modules) {
|
||||
module.postInit();
|
||||
}
|
||||
|
||||
protected void addModule(IInitializable init) {
|
||||
modules.add(init);
|
||||
MinecraftForge.EVENT_BUS.register(init);
|
||||
}
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
FieldParser.postInitParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addModule(IInitializable init) {
|
||||
modules.add(init);
|
||||
MinecraftForge.EVENT_BUS.register(init);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package binnie.core;
|
||||
|
||||
import static binnie.core.BinnieCore.*;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
@@ -38,194 +40,199 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.plugins.PluginManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static binnie.core.BinnieCore.*;
|
||||
|
||||
@Mod(modid = "BinnieCore", name = "Binnie Core", version = VERSION, useMetadata = true, dependencies = "after:Forestry@[4.2,)")
|
||||
@Mod(
|
||||
modid = "BinnieCore",
|
||||
name = "Binnie Core",
|
||||
version = VERSION,
|
||||
useMetadata = true,
|
||||
dependencies = "after:Forestry@[4.2,)")
|
||||
public class BinnieCore extends AbstractMod {
|
||||
@Mod.Instance("BinnieCore")
|
||||
public static BinnieCore instance;
|
||||
@SidedProxy(clientSide = "binnie.core.proxy.BinnieProxyClient", serverSide = "binnie.core.proxy.BinnieProxyServer")
|
||||
public static BinnieProxy proxy;
|
||||
public static int multipassRenderID;
|
||||
private static List<AbstractMod> modList = new ArrayList<>();
|
||||
public static MachineGroup packageCompartment;
|
||||
public static ItemGenesis genesis;
|
||||
public static ItemFieldKit fieldKit;
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
@Mod.Instance("BinnieCore")
|
||||
public static BinnieCore instance;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (ManagerBase baseManager : Binnie.Managers) {
|
||||
addModule(baseManager);
|
||||
}
|
||||
@SidedProxy(clientSide = "binnie.core.proxy.BinnieProxyClient", serverSide = "binnie.core.proxy.BinnieProxyServer")
|
||||
public static BinnieProxy proxy;
|
||||
|
||||
addModule(new ModuleCraftGUI());
|
||||
addModule(new ModuleStorage());
|
||||
addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
addModule(new ModuleTrigger());
|
||||
}
|
||||
preInit();
|
||||
}
|
||||
public static int multipassRenderID;
|
||||
private static List<AbstractMod> modList = new ArrayList<>();
|
||||
public static MachineGroup packageCompartment;
|
||||
public static ItemGenesis genesis;
|
||||
public static ItemFieldKit fieldKit;
|
||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
init();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (ManagerBase baseManager : Binnie.Managers) {
|
||||
addModule(baseManager);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
postInit();
|
||||
}
|
||||
addModule(new ModuleCraftGUI());
|
||||
addModule(new ModuleStorage());
|
||||
addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
addModule(new ModuleTrigger());
|
||||
}
|
||||
preInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BinnieCoreGUI.values();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
instance = this;
|
||||
for (FluidContainer container : FluidContainer.values()) {
|
||||
Item item = new ItemFluidContainer(container);
|
||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
||||
}
|
||||
FieldParser.parsers.add(new ItemParser());
|
||||
super.preInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
postInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
for (AbstractMod mod : getActiveMods()) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod));
|
||||
}
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BinnieCoreGUI.values();
|
||||
}
|
||||
|
||||
multipassRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer());
|
||||
GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata");
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
instance = this;
|
||||
for (FluidContainer container : FluidContainer.values()) {
|
||||
Item item = new ItemFluidContainer(container);
|
||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
||||
}
|
||||
FieldParser.parsers.add(new ItemParser());
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.Module.LEPIDOPTEROLOGY.isEnabled();
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
for (AbstractMod mod : getActiveMods()) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod));
|
||||
}
|
||||
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.Module.APICULTURE.isEnabled();
|
||||
}
|
||||
multipassRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer());
|
||||
GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata");
|
||||
}
|
||||
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
||||
}
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.Module.LEPIDOPTEROLOGY.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.Module.APICULTURE.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
||||
}
|
||||
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ConfigurationMods.extraBees && isApicultureActive();
|
||||
}
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
}
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ConfigurationMods.extraBees && isApicultureActive();
|
||||
}
|
||||
|
||||
static void registerMod(AbstractMod mod) {
|
||||
modList.add(mod);
|
||||
}
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
List<AbstractMod> list = new ArrayList<>();
|
||||
for (AbstractMod mod : modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) {
|
||||
try {
|
||||
EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(event.username.getName());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
event.tracker.synchToPlayer(player);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("species", event.species.getUID());
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
static void registerMod(AbstractMod mod) {
|
||||
modList.add(mod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BIN";
|
||||
}
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
List<AbstractMod> list = new ArrayList<>();
|
||||
for (AbstractMod mod : modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieProxy getProxy() {
|
||||
return proxy;
|
||||
}
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) {
|
||||
try {
|
||||
EntityPlayerMP player =
|
||||
MinecraftServer.getServer().getConfigurationManager().func_152612_a(event.username.getName());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
event.tracker.synchToPlayer(player);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("species", event.species.getUID());
|
||||
} catch (Exception ex) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "binniecore";
|
||||
}
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BIN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return BinnieCorePacketID.values();
|
||||
}
|
||||
@Override
|
||||
public IBinnieProxy getProxy() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
||||
if (event.map.getTextureType() == 0) {
|
||||
Binnie.Liquid.reloadIcons(event.map);
|
||||
}
|
||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||
}
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "binniecore";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[]{ConfigurationMain.class};
|
||||
}
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return BinnieCorePacketID.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
||||
if (event.map.getTextureType() == 0) {
|
||||
Binnie.Liquid.reloadIcons(event.map);
|
||||
}
|
||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[] {ConfigurationMain.class};
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(instance);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package binnie.core;
|
||||
|
||||
public interface IInitializable {
|
||||
void preInit();
|
||||
void preInit();
|
||||
|
||||
void init();
|
||||
void init();
|
||||
|
||||
void postInit();
|
||||
void postInit();
|
||||
}
|
||||
@@ -3,22 +3,22 @@ package binnie.core;
|
||||
import binnie.Binnie;
|
||||
|
||||
public abstract class ManagerBase implements IInitializable {
|
||||
public ManagerBase() {
|
||||
Binnie.Managers.add(this);
|
||||
}
|
||||
public ManagerBase() {
|
||||
Binnie.Managers.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -7,69 +7,69 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class Mods {
|
||||
public static Mod forestry;
|
||||
public static Mod ic2;
|
||||
public static Mod botania;
|
||||
public static Mod forestry;
|
||||
public static Mod ic2;
|
||||
public static Mod botania;
|
||||
|
||||
private static Item findItem(String modId, String name) {
|
||||
Item stack = GameRegistry.findItem(modId, name);
|
||||
if (stack == null && modId.equals("Forestry")) {
|
||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
private static Item findItem(String modId, String name) {
|
||||
Item stack = GameRegistry.findItem(modId, name);
|
||||
if (stack == null && modId.equals("Forestry")) {
|
||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static ItemStack findItemStack(String modId, String name, int stackSize) {
|
||||
ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
||||
if (stack == null && modId.equals("Forestry")) {
|
||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
private static ItemStack findItemStack(String modId, String name, int stackSize) {
|
||||
ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
||||
if (stack == null && modId.equals("Forestry")) {
|
||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static Block findBlock(String modId, String name) {
|
||||
Block stack = GameRegistry.findBlock(modId, name);
|
||||
if (stack == null && modId.equals("Forestry")) {
|
||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
private static Block findBlock(String modId, String name) {
|
||||
Block stack = GameRegistry.findBlock(modId, name);
|
||||
if (stack == null && modId.equals("Forestry")) {
|
||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
static {
|
||||
Mods.forestry = new Mod("Forestry");
|
||||
Mods.ic2 = new Mod("IC2");
|
||||
Mods.botania = new Mod("Botania");
|
||||
}
|
||||
static {
|
||||
Mods.forestry = new Mod("Forestry");
|
||||
Mods.ic2 = new Mod("IC2");
|
||||
Mods.botania = new Mod("Botania");
|
||||
}
|
||||
|
||||
public static class Mod {
|
||||
private String id;
|
||||
public static class Mod {
|
||||
private String id;
|
||||
|
||||
private Mod(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
private Mod(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Item item(String name) {
|
||||
return findItem(id, name);
|
||||
}
|
||||
public Item item(String name) {
|
||||
return findItem(id, name);
|
||||
}
|
||||
|
||||
public Block block(String name) {
|
||||
return findBlock(id, name);
|
||||
}
|
||||
public Block block(String name) {
|
||||
return findBlock(id, name);
|
||||
}
|
||||
|
||||
public ItemStack stack(String name, int stackSize) {
|
||||
return findItemStack(id, name, stackSize);
|
||||
}
|
||||
public ItemStack stack(String name, int stackSize) {
|
||||
return findItemStack(id, name, stackSize);
|
||||
}
|
||||
|
||||
public ItemStack stack(String name) {
|
||||
return stack(name, 1);
|
||||
}
|
||||
public ItemStack stack(String name) {
|
||||
return stack(name, 1);
|
||||
}
|
||||
|
||||
public ItemStack stack(String string, int i, int j) {
|
||||
return new ItemStack(item(string), i, j);
|
||||
}
|
||||
public ItemStack stack(String string, int i, int j) {
|
||||
return new ItemStack(item(string), i, j);
|
||||
}
|
||||
|
||||
public boolean active() {
|
||||
return Loader.isModLoaded(id);
|
||||
}
|
||||
}
|
||||
public boolean active() {
|
||||
return Loader.isModLoaded(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package binnie.core.block;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -13,114 +15,115 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
public BlockMetadata(Material material) {
|
||||
super(material);
|
||||
}
|
||||
public BlockMetadata(Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||
return getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(int meta) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int par5, int par6) {
|
||||
super.onBlockEventReceived(world, x, y, z, par5, par6);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
@Override
|
||||
public boolean onBlockEventReceived(World world, int x, int y, int z, int par5, int par6) {
|
||||
super.onBlockEventReceived(world, x, y, z, par5, par6);
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess block, int x, int y, int z, int par5) {
|
||||
int metadata = TileEntityMetadata.getTileMetadata(block, x, y, z);
|
||||
return getIcon(par5, metadata);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess block, int x, int y, int z, int par5) {
|
||||
int metadata = TileEntityMetadata.getTileMetadata(block, x, y, z);
|
||||
return getIcon(par5, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
return getLocalizedName();
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(ItemStack itemStack) {
|
||||
return getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||
return TileEntityMetadata.getItemDamage(itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return blockMeta;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||
return blockMeta;
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getBlockDropped(IBlockMetadata block, World world, int x, int y, int z, int blockMeta) {
|
||||
ArrayList<ItemStack> array = new ArrayList<>();
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata());
|
||||
array.add(TileEntityMetadata.getItemStack((Block) block, meta));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
public static ArrayList<ItemStack> getBlockDropped(
|
||||
IBlockMetadata block, World world, int x, int y, int z, int blockMeta) {
|
||||
ArrayList<ItemStack> array = new ArrayList<>();
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata());
|
||||
array.add(TileEntityMetadata.getItemStack((Block) block, meta));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static boolean breakBlock(IBlockMetadata block, EntityPlayer player, World world, int i, int j, int k) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
Block block2 = (Block) block;
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, i, j, k);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
}
|
||||
public static boolean breakBlock(IBlockMetadata block, EntityPlayer player, World world, int i, int j, int k) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
Block block2 = (Block) block;
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, i, j, k);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
}
|
||||
|
||||
boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
block.dropAsStack(world, i, j, k, drop);
|
||||
}
|
||||
tile.dropBlock();
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
||||
if (hasBeenBroken
|
||||
&& BinnieCore.proxy.isSimulating(world)
|
||||
&& drops.size() > 0
|
||||
&& (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
block.dropAsStack(world, i, j, k, drop);
|
||||
}
|
||||
tile.dropBlock();
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||
dropBlockAsItem(world, x, y, z, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
public static ItemStack getPickBlock(World world, int x, int y, int z) {
|
||||
IBlockMetadata block = (IBlockMetadata) world.getBlock(x, y, z);
|
||||
List<ItemStack> list = getBlockDropped(block, world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
public static ItemStack getPickBlock(World world, int x, int y, int z) {
|
||||
IBlockMetadata block = (IBlockMetadata) world.getBlock(x, y, z);
|
||||
List<ItemStack> list = getBlockDropped(block, world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return getPickBlock(world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return getPickBlock(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
package binnie.core.block;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IBlockMetadata extends ITileEntityProvider {
|
||||
int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction);
|
||||
int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction);
|
||||
|
||||
int getDroppedMeta(int blockMeta, int tileMeta);
|
||||
int getDroppedMeta(int blockMeta, int tileMeta);
|
||||
|
||||
String getBlockName(ItemStack itemStack);
|
||||
String getBlockName(ItemStack itemStack);
|
||||
|
||||
void addBlockTooltip(ItemStack itemStack, List tooltip);
|
||||
void addBlockTooltip(ItemStack itemStack, List tooltip);
|
||||
|
||||
void dropAsStack(World world, int x, int y, int z, ItemStack itemStack);
|
||||
void dropAsStack(World world, int x, int y, int z, ItemStack itemStack);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package binnie.core.block;
|
||||
|
||||
public interface IMultipassBlock {
|
||||
int getNumberOfPasses();
|
||||
int getNumberOfPasses();
|
||||
|
||||
int colorMultiplier(int meta);
|
||||
int colorMultiplier(int meta);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package binnie.core.block;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
@@ -10,55 +11,64 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemMetadata extends ItemBlock {
|
||||
public ItemMetadata(Block block) {
|
||||
super(block);
|
||||
}
|
||||
public ItemMetadata(Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
Block block = field_150939_a;
|
||||
if (!(block instanceof IBlockMetadata)) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean placeBlockAt(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ,
|
||||
int metadata) {
|
||||
Block block = field_150939_a;
|
||||
if (!(block instanceof IBlockMetadata)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int placedMeta = ((IBlockMetadata) block).getPlacedMeta(stack, world, x, y, z, ForgeDirection.values()[side]);
|
||||
if (placedMeta < 0 || !world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
int placedMeta = ((IBlockMetadata) block).getPlacedMeta(stack, world, x, y, z, ForgeDirection.values()[side]);
|
||||
if (placedMeta < 0 || !world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(placedMeta, false);
|
||||
}
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setTileMetadata(placedMeta, false);
|
||||
}
|
||||
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getItemStackDisplayName(ItemStack par1ItemStack) {
|
||||
return ((IBlockMetadata) field_150939_a).getBlockName(par1ItemStack);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getItemStackDisplayName(ItemStack par1ItemStack) {
|
||||
return ((IBlockMetadata) field_150939_a).getBlockName(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return field_150939_a.getIcon(1, damage);
|
||||
}
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage) {
|
||||
return field_150939_a.getIcon(1, damage);
|
||||
}
|
||||
}
|
||||
@@ -8,43 +8,45 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ItemMetadataRenderer implements IItemRenderer {
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY
|
||||
|| type == IItemRenderer.ItemRenderType.ENTITY
|
||||
|| type == IItemRenderer.ItemRenderType.EQUIPPED
|
||||
|| type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY
|
||||
|| type == IItemRenderer.ItemRenderType.ENTITY
|
||||
|| type == IItemRenderer.ItemRenderType.EQUIPPED
|
||||
|| type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING
|
||||
|| helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
return (type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
&& helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(
|
||||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING
|
||||
|| helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
return (type == IItemRenderer.ItemRenderType.EQUIPPED
|
||||
|| type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
&& helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
Block block = Block.getBlockFromItem(item.getItem());
|
||||
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslated(0.5, 0.5, 0.5);
|
||||
}
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
Block block = Block.getBlockFromItem(item.getItem());
|
||||
if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslated(0.5, 0.5, 0.5);
|
||||
}
|
||||
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY && block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY && block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -9,91 +9,92 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
public static MultipassBlockRenderer instance;
|
||||
private static int layer = 0;
|
||||
public static MultipassBlockRenderer instance;
|
||||
private static int layer = 0;
|
||||
|
||||
public MultipassBlockRenderer() {
|
||||
MultipassBlockRenderer.instance = this;
|
||||
}
|
||||
public MultipassBlockRenderer() {
|
||||
MultipassBlockRenderer.instance = this;
|
||||
}
|
||||
|
||||
public static int getLayer() {
|
||||
return MultipassBlockRenderer.layer;
|
||||
}
|
||||
public static int getLayer() {
|
||||
return MultipassBlockRenderer.layer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
renderItem(block, renderer, meta);
|
||||
MultipassBlockRenderer.layer++;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
renderItem(block, renderer, meta);
|
||||
MultipassBlockRenderer.layer++;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
boolean r = true;
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
r = renderer.renderStandardBlock(block, x, y, z);
|
||||
MultipassBlockRenderer.layer++;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
return r;
|
||||
}
|
||||
@Override
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
boolean r = true;
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
r = renderer.renderStandardBlock(block, x, y, z);
|
||||
MultipassBlockRenderer.layer++;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
public void renderItem(Block block, RenderBlocks renderer, int meta) {
|
||||
setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
|
||||
tessellator.draw();
|
||||
public void renderItem(Block block, RenderBlocks renderer, int meta) {
|
||||
setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||
renderer.renderFaceYNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 0, meta));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 1.0f, 0.0f);
|
||||
renderer.renderFaceYPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 1, meta));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, -1.0f);
|
||||
renderer.renderFaceZNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 2, meta));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0f, 0.0f, 1.0f);
|
||||
renderer.renderFaceZPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 3, meta));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceXNeg(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 4, meta));
|
||||
tessellator.draw();
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
|
||||
tessellator.draw();
|
||||
}
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0f, 0.0f, 0.0f);
|
||||
renderer.renderFaceXPos(block, 0.0, 0.0, 0.0, renderer.getBlockIconFromSideAndMetadata(block, 5, meta));
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void setColor(int l) {
|
||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
float f3 = (l & 0xFF) / 255.0f;
|
||||
GL11.glColor3f(f, f2, f3);
|
||||
}
|
||||
public void setColor(int l) {
|
||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
float f3 = (l & 0xFF) / 255.0f;
|
||||
GL11.glColor3f(f, f2, f3);
|
||||
}
|
||||
}
|
||||
@@ -9,55 +9,57 @@ import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class MultipassItemRenderer implements IItemRenderer {
|
||||
private void render(RenderBlocks renderer, ItemStack item, float f, float g, float h) {
|
||||
GL11.glTranslatef(f, g, h);
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
GL11.glEnable(3008);
|
||||
if (block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
} else {
|
||||
GL11.glAlphaFunc(516, 0.5f);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
private void render(RenderBlocks renderer, ItemStack item, float f, float g, float h) {
|
||||
GL11.glTranslatef(f, g, h);
|
||||
Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
GL11.glEnable(3008);
|
||||
if (block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
} else {
|
||||
GL11.glAlphaFunc(516, 0.5f);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
MultipassBlockRenderer.instance.renderInventoryBlock(block, TileEntityMetadata.getItemDamage(item), 0, renderer);
|
||||
if (block.getRenderBlockPass() == 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
}
|
||||
GL11.glTranslatef(-f, -g, -h);
|
||||
}
|
||||
MultipassBlockRenderer.instance.renderInventoryBlock(
|
||||
block, TileEntityMetadata.getItemDamage(item), 0, renderer);
|
||||
if (block.getRenderBlockPass() == 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
}
|
||||
GL11.glTranslatef(-f, -g, -h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
case EQUIPPED:
|
||||
case INVENTORY:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(
|
||||
IItemRenderer.ItemRenderType type, ItemStack item, IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case INVENTORY:
|
||||
case ENTITY:
|
||||
render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
@Override
|
||||
public void renderItem(IItemRenderer.ItemRenderType type, ItemStack item, Object... data) {
|
||||
switch (type) {
|
||||
case INVENTORY:
|
||||
case ENTITY:
|
||||
render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
render((RenderBlocks) data[0], item, 0.5f, 0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
render((RenderBlocks) data[0], item, 0.5f, 0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,96 +10,96 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class TileEntityMetadata extends TileEntity {
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
|
||||
public TileEntityMetadata() {
|
||||
droppedBlock = false;
|
||||
}
|
||||
public TileEntityMetadata() {
|
||||
droppedBlock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent(int id, int meta) {
|
||||
// TODO fix magic const
|
||||
if (id == 42) {
|
||||
this.meta = meta;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean receiveClientEvent(int id, int meta) {
|
||||
// TODO fix magic const
|
||||
if (id == 42) {
|
||||
this.meta = meta;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
meta = nbt.getInteger("meta");
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("meta", meta);
|
||||
}
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("meta", meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getTileMetadata() {
|
||||
return meta;
|
||||
}
|
||||
public int getTileMetadata() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setTileMetadata(int meta, boolean notify) {
|
||||
if (this.meta == meta) {
|
||||
return;
|
||||
}
|
||||
public void setTileMetadata(int meta, boolean notify) {
|
||||
if (this.meta == meta) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
MessageMetadata message = new MessageMetadata(xCoord, yCoord, zCoord, meta);
|
||||
return BinnieCore.instance.getNetworkWrapper().getPacketFrom(message.getMessage());
|
||||
}
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
MessageMetadata message = new MessageMetadata(xCoord, yCoord, zCoord, meta);
|
||||
return BinnieCore.instance.getNetworkWrapper().getPacketFrom(message.getMessage());
|
||||
}
|
||||
|
||||
public static TileEntityMetadata getTile(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityMetadata) {
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static TileEntityMetadata getTile(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityMetadata) {
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(Block block, int damage) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", damage);
|
||||
public static ItemStack getItemStack(Block block, int damage) {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", damage);
|
||||
|
||||
ItemStack item = new ItemStack(block, 1, 0);
|
||||
item.setItemDamage(Math.min(damage, 16387));
|
||||
item.setTagCompound(tag);
|
||||
return item;
|
||||
}
|
||||
ItemStack item = new ItemStack(block, 1, 0);
|
||||
item.setItemDamage(Math.min(damage, 16387));
|
||||
item.setTagCompound(tag);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static int getItemDamage(ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
public static int getItemDamage(ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityMetadata tile = getTile(world, x, y, z);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
public static int getTileMetadata(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntityMetadata tile = getTile(world, x, y, z);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
public boolean hasDroppedBlock() {
|
||||
return droppedBlock;
|
||||
}
|
||||
public boolean hasDroppedBlock() {
|
||||
return droppedBlock;
|
||||
}
|
||||
|
||||
public void dropBlock() {
|
||||
droppedBlock = true;
|
||||
}
|
||||
public void dropBlock() {
|
||||
droppedBlock = true;
|
||||
}
|
||||
}
|
||||
@@ -3,85 +3,84 @@ package binnie.core.circuits;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BinnieCircuit implements ICircuit {
|
||||
private String uid;
|
||||
private int limit;
|
||||
private List<String> tooltips;
|
||||
private String uid;
|
||||
private int limit;
|
||||
private List<String> tooltips;
|
||||
|
||||
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack) {
|
||||
tooltips = new ArrayList<>();
|
||||
this.uid = "binnie.circuit." + uid;
|
||||
this.limit = limit;
|
||||
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack) {
|
||||
tooltips = new ArrayList<>();
|
||||
this.uid = "binnie.circuit." + uid;
|
||||
this.limit = limit;
|
||||
|
||||
ChipsetManager.circuitRegistry.registerCircuit(this);
|
||||
if (itemStack != null) {
|
||||
ChipsetManager.solderManager.addRecipe(layout, itemStack, this);
|
||||
}
|
||||
}
|
||||
ChipsetManager.circuitRegistry.registerCircuit(this);
|
||||
if (itemStack != null) {
|
||||
ChipsetManager.solderManager.addRecipe(layout, itemStack, this);
|
||||
}
|
||||
}
|
||||
|
||||
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, Item item, int itemMeta) {
|
||||
this(uid, limit, layout, new ItemStack(item, 1, itemMeta));
|
||||
}
|
||||
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, Item item, int itemMeta) {
|
||||
this(uid, limit, layout, new ItemStack(item, 1, itemMeta));
|
||||
}
|
||||
|
||||
public void addTooltipString(String string) {
|
||||
tooltips.add(string);
|
||||
}
|
||||
public void addTooltipString(String string) {
|
||||
tooltips.add(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresDiscovery() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean requiresDiscovery() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
@Override
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return uid;
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
for (String string : tooltips) {
|
||||
list.add(" - " + string);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
for (String string : tooltips) {
|
||||
list.add(" - " + string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(Object arg0) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isCircuitable(Object arg0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onInsertion(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onLoad(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onRemoval(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
Loaded 100 of 818 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user