mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 04:10:07 +00:00
start 1.10.2
This commit is contained in:
1 parent
f969f63b66
commit
6a7c4bf67d
826 files changed
+60550
-63758
No files matched your search
@@ -1,39 +1,35 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import binnie.core.resource.ManagerResource;
|
||||
import binnie.core.item.ManagerItem;
|
||||
import binnie.core.machines.ManagerMachine;
|
||||
import binnie.core.liquid.ManagerLiquid;
|
||||
import binnie.core.mod.config.ManagerConfig;
|
||||
import binnie.core.genetics.ManagerGenetics;
|
||||
import binnie.core.language.ManagerLanguage;
|
||||
import binnie.core.ManagerBase;
|
||||
import binnie.core.genetics.ManagerGenetics;
|
||||
import binnie.core.item.ManagerItem;
|
||||
import binnie.core.language.ManagerLanguage;
|
||||
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 final List<ManagerBase> Managers;
|
||||
public static final ManagerLanguage Language;
|
||||
public static final ManagerGenetics Genetics;
|
||||
public static final ManagerConfig Configuration;
|
||||
public static final ManagerLiquid Liquid;
|
||||
public static final ManagerMachine Machine;
|
||||
public static final ManagerItem Item;
|
||||
public static final ManagerResource Resource;
|
||||
public final class Binnie {
|
||||
public static final List<ManagerBase> Managers;
|
||||
public static final ManagerLanguage Language;
|
||||
public static final ManagerGenetics Genetics;
|
||||
public static final ManagerConfig Configuration;
|
||||
public static final ManagerLiquid Liquid;
|
||||
public static final ManagerMachine Machine;
|
||||
public static final ManagerItem Item;
|
||||
public static final ManagerResource Resource;
|
||||
|
||||
static {
|
||||
Managers = new ArrayList<ManagerBase>();
|
||||
Language = new ManagerLanguage();
|
||||
Genetics = new ManagerGenetics();
|
||||
Configuration = new ManagerConfig();
|
||||
Liquid = new ManagerLiquid();
|
||||
Machine = new ManagerMachine();
|
||||
Item = new ManagerItem();
|
||||
Resource = new ManagerResource();
|
||||
}
|
||||
static {
|
||||
Managers = new ArrayList<ManagerBase>();
|
||||
Language = new ManagerLanguage();
|
||||
Genetics = new ManagerGenetics();
|
||||
Configuration = new ManagerConfig();
|
||||
Liquid = new ManagerLiquid();
|
||||
Machine = new ManagerMachine();
|
||||
Item = new ManagerItem();
|
||||
Resource = new ManagerResource();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie;
|
||||
|
||||
public final class Constants
|
||||
{
|
||||
public static final String LiquidJuice = "juice";
|
||||
public static final String LiquidWater = "water";
|
||||
public static final String LiquidSeedOil = "seedoil";
|
||||
public static final String LiquidCreosote = "Creosote Oil";
|
||||
public static final String LiquidEthanol = "bioethanol";
|
||||
public static final String LiquidHoney = "for.honey";
|
||||
public final class Constants {
|
||||
public static final String LiquidJuice = "juice";
|
||||
public static final String LiquidWater = "water";
|
||||
public static final String LiquidSeedOil = "seedoil";
|
||||
public static final String LiquidCreosote = "Creosote Oil";
|
||||
public static final String LiquidEthanol = "bioethanol";
|
||||
public static final String LiquidHoney = "for.honey";
|
||||
}
|
||||
@@ -1,334 +1,306 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.api.IFlower;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import binnie.botany.gardening.ModuleGardening;
|
||||
import binnie.botany.genetics.ModuleGenetics;
|
||||
import binnie.botany.core.ModuleCore;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.BlockStained;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import binnie.botany.ceramic.BlockStained;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import binnie.botany.core.ModuleCore;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import binnie.botany.flower.ItemFlower;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.gardening.*;
|
||||
import binnie.botany.genetics.ItemDictionary;
|
||||
import binnie.botany.genetics.ItemEncyclopedia;
|
||||
import binnie.botany.items.ItemClay;
|
||||
import binnie.botany.items.ItemPigment;
|
||||
import binnie.botany.flower.ItemFlower;
|
||||
import binnie.botany.genetics.ItemEncyclopedia;
|
||||
import binnie.core.item.ItemMisc;
|
||||
import binnie.botany.gardening.ItemSoilMeter;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import binnie.botany.gardening.BlockSoil;
|
||||
import binnie.botany.gardening.ItemTrowel;
|
||||
import binnie.botany.gardening.BlockPlant;
|
||||
import binnie.botany.genetics.ItemDictionary;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.proxy.Proxy;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.item.ItemMisc;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = "Botany", name = "Botany", useMetadata = true, dependencies = "after:BinnieCore")
|
||||
public class Botany extends AbstractMod
|
||||
{
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
@Mod.Instance("Botany")
|
||||
public static Botany instance;
|
||||
@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 ItemEncyclopedia encyclopedia;
|
||||
public static ItemEncyclopedia encyclopediaIron;
|
||||
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 class Botany extends AbstractMod {
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
@Mod.Instance("Botany")
|
||||
public static Botany instance;
|
||||
@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 ItemEncyclopedia encyclopedia;
|
||||
public static ItemEncyclopedia encyclopediaIron;
|
||||
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;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
this.addModule(new ModuleCore());
|
||||
this.addModule(new ModuleGenetics());
|
||||
this.addModule(new ModuleGardening());
|
||||
this.preInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
this.addModule(new ModuleCore());
|
||||
//this.addModule(new ModuleGenetics());
|
||||
this.addModule(new ModuleGardening());
|
||||
this.preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
this.init();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
this.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
this.postInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
this.postInit();
|
||||
}
|
||||
|
||||
public Botany() {
|
||||
Botany.instance = this;
|
||||
}
|
||||
public Botany() {
|
||||
Botany.instance = this;
|
||||
}
|
||||
|
||||
@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(final 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) {
|
||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final 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) {
|
||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
final IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||
if (pollen != null && flower.canMateWith(pollen)) {
|
||||
flower.mateWith(pollen);
|
||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onShearFlower(final PlayerInteractEvent.RightClickBlock event) {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onFertiliseSoil(final PlayerInteractEvent event) {
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.world == null) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
if (Gardening.isSoil(block)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||
final EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||
final 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) {
|
||||
final 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) {
|
||||
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
final 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) {
|
||||
final 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) {
|
||||
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||
final 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) {
|
||||
final 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) {
|
||||
final ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||
--heldItem4.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getEntityPlayer() != null && event.getEntityPlayer().getHeldItemMainhand() != null && event.getEntityPlayer().getHeldItemMainhand().getItem() == Items.SHEARS) {
|
||||
final TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
flower.onShear();
|
||||
event.getEntityPlayer().getHeldItemMainhand().damageItem(1, event.getEntityPlayer());
|
||||
}
|
||||
}
|
||||
if (event.getEntityPlayer() != null && event.getEntityPlayer().getHeldItemMainhand() != null && event.getEntityPlayer().getHeldItemMainhand().getItem() == Botany.pollen) {
|
||||
final TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
// final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
// final IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.getEntityPlayer().getHeldItemMainhand());
|
||||
// if (pollen != null && flower.canMateWith(pollen)) {
|
||||
// flower.mateWith(pollen);
|
||||
// if (!event.getEntityPlayer().capabilities.isCreativeMode) {
|
||||
// final ItemStack heldItem = event.getEntityPlayer().getHeldItemMainhand();
|
||||
// --heldItem.stackSize;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void plantVanilla(final BlockEvent.PlaceEvent event) {
|
||||
final World world = event.world;
|
||||
final int x = event.x;
|
||||
final int y = event.y;
|
||||
final int z = event.z;
|
||||
final Block block = world.getBlock(x, y - 1, z);
|
||||
if (!(block instanceof IBlockSoil)) {
|
||||
return;
|
||||
}
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||
if (flower != null) {
|
||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onFertiliseSoil(final PlayerInteractEvent.RightClickBlock event) {
|
||||
if (event.getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
if (event.getEntityPlayer() != null && event.getEntityPlayer().getHeldItemMainhand() != null) {
|
||||
BlockPos down = event.getPos();
|
||||
Block block = event.getWorld().getBlockState(event.getPos()).getBlock();
|
||||
if (block == null || !Gardening.isSoil(block)) {
|
||||
down = down.down();
|
||||
block = event.getWorld().getBlockState(down).getBlock();
|
||||
}
|
||||
if (block == null) {
|
||||
return;
|
||||
}
|
||||
if (Gardening.isSoil(block)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
// if (Gardening.isNutrientFertiliser(event.getEntityPlayer().getHeldItemMainhand()) && soil.getType(event.getWorld(), down) != EnumSoilType.FLOWERBED) {
|
||||
// final EnumSoilType type = soil.getType(event.getWorld(), down);
|
||||
// final int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.getEntityPlayer().getHeldItemMainhand()), 2);
|
||||
// if (soil.fertilise(event.getWorld(), down, EnumSoilType.values()[next]) && !event.getEntityPlayer().capabilities.isCreativeMode) {
|
||||
// final ItemStack heldItem = event.getEntityPlayer().getHeldItemMainhand();
|
||||
// --heldItem.stackSize;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if (Gardening.isAcidFertiliser(event.getEntityPlayer().getHeldItemMainhand()) && soil.getPH(event.getWorld(), down) != EnumAcidity.Acid) {
|
||||
// final EnumAcidity pH = soil.getPH(event.getWorld(), down);
|
||||
// final int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.getEntityPlayer().getHeldItemMainhand()), 0);
|
||||
// if (soil.setPH(event.getWorld(), down, EnumAcidity.values()[next]) && !event.getEntityPlayer().capabilities.isCreativeMode) {
|
||||
// final ItemStack heldItem2 = event.getEntityPlayer().getHeldItemMainhand();
|
||||
// --heldItem2.stackSize;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if (Gardening.isAlkalineFertiliser(event.getEntityPlayer().getHeldItemMainhand()) && soil.getPH(event.getWorld(), down) != EnumAcidity.Alkaline) {
|
||||
// final EnumAcidity pH = soil.getPH(event.getWorld(), down);
|
||||
// final int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.getEntityPlayer().getHeldItemMainhand()), 2);
|
||||
// if (soil.setPH(event.getWorld(), down, EnumAcidity.values()[next]) && !event.getEntityPlayer().capabilities.isCreativeMode) {
|
||||
// final ItemStack heldItem3 = event.getEntityPlayer().getHeldItemMainhand();
|
||||
// --heldItem3.stackSize;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if (Gardening.isWeedkiller(event.getEntityPlayer().getHeldItemMainhand()) && Gardening.addWeedKiller(event.getWorld(), down) && !event.getEntityPlayer().capabilities.isCreativeMode) {
|
||||
// final ItemStack heldItem4 = event.getEntityPlayer().getHeldItemMainhand();
|
||||
// --heldItem4.stackSize;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void onPlantVanilla(final PlayerInteractEvent event) {
|
||||
if (!BinnieCore.proxy.isSimulating(event.world)) {
|
||||
return;
|
||||
}
|
||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
return;
|
||||
}
|
||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
||||
final World world = event.world;
|
||||
final int x = event.x;
|
||||
final int y = event.y;
|
||||
final int z = event.z;
|
||||
final 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) {
|
||||
final 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) {
|
||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void plantVanilla(final BlockEvent.PlaceEvent event) {
|
||||
final World world = event.getWorld();
|
||||
final Block block = world.getBlockState(event.getPos().down()).getBlock();
|
||||
if (!(block instanceof IBlockSoil)) {
|
||||
return;
|
||||
}
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.getItemInHand());
|
||||
if (flower != null) {
|
||||
Gardening.plant(world, event.getPos(), flower, event.getPlayer().getGameProfile());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBonemeal(final BonemealEvent event) {
|
||||
final Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
if (Gardening.isSoil(block)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
@Deprecated
|
||||
public void onPlantVanilla(final PlayerInteractEvent.RightClickBlock event) {
|
||||
if (!BinnieCore.proxy.isSimulating(event.getWorld())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
if (event.getEntityPlayer() != null && event.getEntityPlayer().getHeldItemMainhand() != null) {
|
||||
final World world = event.getWorld();
|
||||
final Block block = world.getBlockState(event.getPos()).getBlock();
|
||||
int py = -1;
|
||||
if (block instanceof IBlockSoil && (world.isAirBlock(event.getPos().up()) || block.isReplaceable(world, event.getPos()))) {
|
||||
py = 1;
|
||||
}
|
||||
if (py >= 0) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.getEntityPlayer().getHeldItemMainhand());
|
||||
if (flower != null && Gardening.plant(world, event.getPos().add(0, py, 0), flower, event.getEntityPlayer().getGameProfile()) && !event.getEntityPlayer().capabilities.isCreativeMode) {
|
||||
final ItemStack heldItem = event.getEntityPlayer().getHeldItemMainhand();
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onIMC(final FMLInterModComms.IMCEvent event) {
|
||||
for (final 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onBonemeal(final BonemealEvent event) {
|
||||
final Block block = event.getBlock().getBlock();
|
||||
if (Gardening.isSoil(block)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
// if (soil.fertilise(event.getWorld(), event.getPos(), EnumSoilType.LOAM)) {
|
||||
// event.setResult(Event.Result.ALLOW);
|
||||
// }
|
||||
}
|
||||
final TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler
|
||||
{
|
||||
public PacketHandler() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onIMC(final FMLInterModComms.IMCEvent event) {
|
||||
for (final 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,42 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class CreativeTabBotany extends CreativeTabs
|
||||
{
|
||||
public static CreativeTabs instance;
|
||||
public class CreativeTabBotany extends CreativeTabs {
|
||||
public static CreativeTabs instance;
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return this.getTabLabel();
|
||||
}
|
||||
@Override
|
||||
public String getTranslatedTabLabel() {
|
||||
return this.getTabLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return Botany.proxy.localise("tab.botany");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return Botany.proxy.localise("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);
|
||||
}
|
||||
|
||||
static {
|
||||
CreativeTabBotany.instance = new CreativeTabBotany();
|
||||
}
|
||||
static {
|
||||
CreativeTabBotany.instance = new CreativeTabBotany();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumAcidity
|
||||
{
|
||||
Acid,
|
||||
Neutral,
|
||||
Alkaline;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
public enum EnumAcidity implements IStringSerializable {
|
||||
Acid,
|
||||
Neutral,
|
||||
Alkaline;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,39 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.*;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
private Class<? extends IAllele> cls;
|
||||
private Class<? extends IAllele> cls;
|
||||
|
||||
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return this.cls;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return this.cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase();
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers");
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,25 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumFlowerStage
|
||||
{
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen"),
|
||||
NONE("NONE");
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
public static final EnumFlowerStage[] VALUES;
|
||||
String name;
|
||||
public enum EnumFlowerStage implements ISpeciesType {
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen"),
|
||||
NONE("NONE");
|
||||
|
||||
private EnumFlowerStage(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public static final EnumFlowerStage[] VALUES;
|
||||
String name;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
private EnumFlowerStage(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
static {
|
||||
VALUES = values();
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
static {
|
||||
VALUES = values();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumMoisture
|
||||
{
|
||||
Dry,
|
||||
Normal,
|
||||
Damp;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
public enum EnumMoisture implements IStringSerializable {
|
||||
Dry,
|
||||
Normal,
|
||||
Damp;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,11 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public enum EnumSoilType
|
||||
{
|
||||
SOIL,
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
public enum EnumSoilType {
|
||||
SOIL,
|
||||
LOAM,
|
||||
FLOWERBED;
|
||||
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
public String getID() {
|
||||
return this.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IAlleleFlowerEffect extends IAlleleEffect
|
||||
{
|
||||
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
|
||||
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
|
||||
}
|
||||
@@ -1,16 +1,11 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies
|
||||
{
|
||||
IFlowerType getType();
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies {
|
||||
IFlowerType getType();
|
||||
|
||||
EnumAcidity getPH();
|
||||
EnumAcidity getPH();
|
||||
|
||||
EnumMoisture getMoisture();
|
||||
EnumMoisture getMoisture();
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IBotanistTracker extends IBreedingTracker
|
||||
{
|
||||
public interface IBotanistTracker extends IBreedingTracker {
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
public interface IColourMix
|
||||
{
|
||||
IFlowerColour getColour1();
|
||||
public interface IColourMix {
|
||||
IFlowerColour getColour1();
|
||||
|
||||
IFlowerColour getColour2();
|
||||
IFlowerColour getColour2();
|
||||
|
||||
boolean isMutation(final IFlowerColour p0, final IFlowerColour p1);
|
||||
boolean isMutation(final IFlowerColour p0, final IFlowerColour p1);
|
||||
|
||||
int getChance();
|
||||
int getChance();
|
||||
|
||||
IFlowerColour getResult();
|
||||
IFlowerColour getResult();
|
||||
}
|
||||
@@ -1,38 +1,33 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFlower extends IIndividual
|
||||
{
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
public interface IFlower extends IIndividual {
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
IFlowerGenome getMate();
|
||||
IFlowerGenome getMate();
|
||||
|
||||
void mate(final IFlower p0);
|
||||
void mate(final IFlower p0);
|
||||
|
||||
int getAge();
|
||||
int getAge();
|
||||
|
||||
void age();
|
||||
void age();
|
||||
|
||||
void setAge(final int p0);
|
||||
void setAge(final int p0);
|
||||
|
||||
IFlower getOffspring(final World p0);
|
||||
IFlower getOffspring(final World p0);
|
||||
|
||||
int getMaxAge();
|
||||
int getMaxAge();
|
||||
|
||||
boolean isWilted();
|
||||
boolean isWilted();
|
||||
|
||||
void setWilted(final boolean p0);
|
||||
void setWilted(final boolean p0);
|
||||
|
||||
boolean hasFlowered();
|
||||
boolean hasFlowered();
|
||||
|
||||
void setFlowered(final boolean p0);
|
||||
void setFlowered(final boolean p0);
|
||||
|
||||
void removeMate();
|
||||
void removeMate();
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IFlowerColour
|
||||
{
|
||||
int getColor(final boolean p0);
|
||||
public interface IFlowerColour {
|
||||
int getColor(final boolean p0);
|
||||
|
||||
IAlleleInteger getAllele();
|
||||
IAlleleInteger getAllele();
|
||||
|
||||
int getID();
|
||||
int getID();
|
||||
|
||||
String getName();
|
||||
String getName();
|
||||
}
|
||||
@@ -1,46 +1,41 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface IFlowerGenome extends IGenome
|
||||
{
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
public interface IFlowerGenome extends IGenome {
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
|
||||
IFlowerColour getPrimaryColor();
|
||||
IFlowerColour getPrimaryColor();
|
||||
|
||||
IFlowerColour getSecondaryColor();
|
||||
IFlowerColour getSecondaryColor();
|
||||
|
||||
IFlowerColour getStemColor();
|
||||
IFlowerColour 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(final EnumAcidity p0);
|
||||
boolean canTolerate(final EnumAcidity p0);
|
||||
|
||||
boolean canTolerate(final EnumMoisture p0);
|
||||
boolean canTolerate(final EnumMoisture p0);
|
||||
|
||||
boolean canTolerate(final EnumTemperature p0);
|
||||
boolean canTolerate(final EnumTemperature p0);
|
||||
}
|
||||
@@ -1,14 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IFlowerMutation extends IMutation
|
||||
{
|
||||
float getChance(final IAllele p0, final IAllele p1, final IGenome p2, final IGenome p3);
|
||||
public interface IFlowerMutation extends IMutation {
|
||||
float getChance(final IAllele p0, final IAllele p1, final IGenome p2, final IGenome p3);
|
||||
}
|
||||
@@ -1,48 +1,45 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFlowerRoot extends ISpeciesRoot
|
||||
{
|
||||
@Override
|
||||
IFlower getMember(final ItemStack p0);
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(final IAllele[] p0);
|
||||
public interface IFlowerRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
IFlower getMember(final ItemStack p0);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(final IAllele[] p0, final IAllele[] p1);
|
||||
@Override
|
||||
IFlower templateAsIndividual(final IAllele[] p0);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(final IAllele[] p0);
|
||||
@Override
|
||||
IFlower templateAsIndividual(final IAllele[] p0, final IAllele[] p1);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(final IAllele[] p0, final IAllele[] p1);
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(final IAllele[] p0);
|
||||
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(final World p0, final GameProfile p1);
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(final IAllele[] p0, final IAllele[] p1);
|
||||
|
||||
@Override
|
||||
Collection<IFlowerMutation> getMutations(final boolean p0);
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(final World p0, final GameProfile p1);
|
||||
|
||||
EnumFlowerStage getStageType(final ItemStack p0);
|
||||
@Override
|
||||
List<? extends IFlowerMutation> getMutations(boolean shuffle);
|
||||
|
||||
IFlower getFlower(final World p0, final IFlowerGenome p1);
|
||||
EnumFlowerStage getStageType(final ItemStack p0);
|
||||
|
||||
void addConversion(final ItemStack p0, final IAllele[] p1);
|
||||
IFlower getFlower(final World p0, final IFlowerGenome p1);
|
||||
|
||||
IFlower getConversion(final ItemStack p0);
|
||||
void addConversion(final ItemStack p0, final IAllele[] p1);
|
||||
|
||||
Collection<IColourMix> getColourMixes(final boolean p0);
|
||||
IFlower getConversion(final ItemStack p0);
|
||||
|
||||
void registerColourMix(final IColourMix p0);
|
||||
Collection<IColourMix> getColourMixes(final boolean p0);
|
||||
|
||||
void registerColourMix(final IColourMix p0);
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
//import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IFlowerType
|
||||
{
|
||||
IIcon getStem(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
public interface IFlowerType {
|
||||
// IIcon getStem(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
//
|
||||
// IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
//
|
||||
// IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
|
||||
IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
int getID();
|
||||
|
||||
IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
||||
int getSections();
|
||||
|
||||
int getID();
|
||||
|
||||
int getSections();
|
||||
|
||||
int ordinal();
|
||||
int ordinal();
|
||||
}
|
||||
@@ -1,29 +1,25 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockSoil
|
||||
{
|
||||
EnumAcidity getPH(final World p0, final int p1, final int p2, final int p3);
|
||||
public interface IBlockSoil {
|
||||
EnumAcidity getPH(final World p0, final BlockPos pos);
|
||||
|
||||
EnumMoisture getMoisture(final World p0, final int p1, final int p2, final int p3);
|
||||
EnumMoisture getMoisture(final World p0, final BlockPos pos);
|
||||
|
||||
EnumSoilType getType(final World p0, final int p1, final int p2, final int p3);
|
||||
EnumSoilType getType(final World p0, final BlockPos pos);
|
||||
|
||||
boolean fertilise(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
||||
boolean fertilise(final World p0, final BlockPos pos, final EnumSoilType p4);
|
||||
|
||||
boolean degrade(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
||||
boolean degrade(final World p0, final BlockPos pos, final EnumSoilType p4);
|
||||
|
||||
boolean setPH(final World p0, final int p1, final int p2, final int p3, final EnumAcidity p4);
|
||||
boolean setPH(final World p0, final BlockPos pos, final EnumAcidity p4);
|
||||
|
||||
boolean setMoisture(final World p0, final int p1, final int p2, final int p3, final EnumMoisture p4);
|
||||
boolean setMoisture(final World p0, final BlockPos pos, final EnumMoisture p4);
|
||||
|
||||
boolean resistsWeeds(final World p0, final int p1, final int p2, final int p3);
|
||||
boolean resistsWeeds(final World p0, final BlockPos pos);
|
||||
}
|
||||
@@ -1,147 +1,135 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockCeramic extends Block implements IBlockMetadata
|
||||
{
|
||||
public BlockCeramic() {
|
||||
super(Material.rock);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setBlockName("ceramic");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
public class BlockCeramic extends Block implements IBlockMetadata {
|
||||
public BlockCeramic() {
|
||||
super(Material.ROCK);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setRegistryName("ceramic");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final BlockPos pos, final int blockMeta, final int fortune) {
|
||||
// return BlockMetadata.getBlockDropped(this, world, pos, blockMeta);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
// @Override
|
||||
// public boolean hasTileEntity(final int meta) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return EnumFlowerColor.get(meta).getName() + " Ceramic Block";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return EnumFlowerColor.get(meta).getName() + " Ceramic Block";
|
||||
}
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(final World world, final BlockPos pos, final ItemStack drop) {
|
||||
//TODO IMPLEMENT
|
||||
// this.dropBlockAsItem(world, pos, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(final int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getIcon(side, tile.getTileMetadata());
|
||||
// }
|
||||
// return super.getIcon(world, x, y, z, side);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getIcon(final int side, final int meta) {
|
||||
// return this.blockIcon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getRenderColor(tile.getTileMetadata());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderColor(final int meta) {
|
||||
// return EnumFlowerColor.get(meta).getColor(false);
|
||||
// }
|
||||
}
|
||||
@@ -1,529 +1,502 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock
|
||||
{
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.rock);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setBlockName("ceramicBrick");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
import java.util.List;
|
||||
|
||||
private static BlockType getType(final int meta) {
|
||||
return new BlockType(meta);
|
||||
}
|
||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock {
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.ROCK);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setRegistryName("ceramicBrick");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
private static BlockType getType(final int meta) {
|
||||
return new BlockType(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
// return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
// @Override
|
||||
// public boolean hasTileEntity(final int meta) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return getType(meta).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return getType(meta).getName();
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(final World world, final BlockPos pos, final ItemStack drop) {
|
||||
//TODO IMPLEMENT
|
||||
//this.dropBlockAsItem(world, pos, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
final BlockType type = new BlockType(c, c, TileType.Tile);
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||
}
|
||||
for (final TileType type2 : TileType.values()) {
|
||||
if (type2.canDouble()) {
|
||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type2).getStack(1));
|
||||
}
|
||||
}
|
||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Gold, TileType.Split).getStack(1));
|
||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Brown, TileType.Chequered).getStack(1));
|
||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Brown, TileType.LargeBrick).getStack(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getIcon(side, tile.getTileMetadata());
|
||||
// }
|
||||
// return super.getIcon(world, x, y, z, side);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getIcon(final int side, final int meta) {
|
||||
// return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// for (final TileType type : TileType.values()) {
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
final BlockType type = new BlockType(c, c, TileType.Tile);
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||
}
|
||||
for (final TileType type2 : TileType.values()) {
|
||||
if (type2.canDouble()) {
|
||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type2).getStack(1));
|
||||
}
|
||||
}
|
||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Gold, TileType.Split).getStack(1));
|
||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Brown, TileType.Chequered).getStack(1));
|
||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Brown, TileType.LargeBrick).getStack(1));
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getRenderColor(tile.getTileMetadata());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderColor(final int meta) {
|
||||
// return this.colorMultiplier(meta);
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||
}
|
||||
@Override
|
||||
public int colorMultiplier(final int meta) {
|
||||
final BlockType type = getType(meta);
|
||||
// if (MultipassBlockRenderer.getLayer() == 0) {
|
||||
// return 16777215;
|
||||
// }
|
||||
// if (MultipassBlockRenderer.getLayer() == 1) {
|
||||
// return type.color1.getColor(false);
|
||||
// }
|
||||
return type.color2.getColor(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
for (final TileType type : TileType.values()) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// public int getRenderType() {
|
||||
// return BinnieCore.multipassRenderID;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
public enum TileType {
|
||||
Tile("tile", "Ceramic Tile"),
|
||||
Brick("brick", "Ceramic Bricks"),
|
||||
StripeBrick("brickstripe", "Striped Ceramic Bricks"),
|
||||
LargeBrick("bricklarge", "Large Ceramic Bricks"),
|
||||
Split("split", "Split Ceramic Tile"),
|
||||
Chequered("cheque", "Chequered Ceramic Tile"),
|
||||
Mixed("mixed", "Mixed Ceramic Tile"),
|
||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"),
|
||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"),
|
||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks");
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
String id;
|
||||
String name;
|
||||
//IIcon[] icons;
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
private TileType(final String id, final String name) {
|
||||
//this.icons = new IIcon[3];
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(final int meta) {
|
||||
return this.colorMultiplier(meta);
|
||||
}
|
||||
public static TileType get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfPasses() {
|
||||
return 3;
|
||||
}
|
||||
public boolean canDouble() {
|
||||
return this != TileType.Tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(final int meta) {
|
||||
final BlockType type = getType(meta);
|
||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
||||
return 16777215;
|
||||
}
|
||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
||||
return type.color1.getColor(false);
|
||||
}
|
||||
return type.color2.getColor(false);
|
||||
}
|
||||
public ItemStack getRecipe(final List<ItemStack> stacks) {
|
||||
switch (this) {
|
||||
case Tile: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
int mortars = 0;
|
||||
int blocks = 0;
|
||||
int blockColor = -1;
|
||||
for (final ItemStack stack : stacks) {
|
||||
if (this.isMortar(stack)) {
|
||||
++mortars;
|
||||
} else {
|
||||
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
||||
return null;
|
||||
}
|
||||
++blocks;
|
||||
final int color = TileEntityMetadata.getItemDamage(stack);
|
||||
if (blockColor == -1) {
|
||||
blockColor = color;
|
||||
} else {
|
||||
if (blockColor != color) {
|
||||
return null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mortars != 1) {
|
||||
return null;
|
||||
}
|
||||
final EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
||||
return new BlockType(c, c, TileType.Tile).getStack(3);
|
||||
}
|
||||
case Split: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = {-1, -1};
|
||||
int altCounter = 0;
|
||||
for (final ItemStack stack2 : stacks) {
|
||||
final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type = new BlockType(stack2);
|
||||
if (type.type != TileType.Tile) {
|
||||
return null;
|
||||
}
|
||||
final int color2 = type.color1.ordinal();
|
||||
if (colors[alt] == -1) {
|
||||
colors[alt] = color2;
|
||||
} else if (colors[alt] != color2) {
|
||||
return null;
|
||||
}
|
||||
++altCounter;
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Split).getStack(4);
|
||||
}
|
||||
case Chequered: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = {-1, -1};
|
||||
for (final ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type2 = new BlockType(stack2);
|
||||
if (type2.type != TileType.Split) {
|
||||
return null;
|
||||
}
|
||||
final int color3 = type2.color1.ordinal();
|
||||
final int color4 = type2.color2.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
colors[1] = color4;
|
||||
} else {
|
||||
if (colors[0] != color3 || colors[1] != color4) {
|
||||
return null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Chequered).getStack(4);
|
||||
}
|
||||
case Mixed: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = {-1, -1};
|
||||
for (int index = 0; index < stacks.size(); ++index) {
|
||||
final ItemStack stack2 = stacks.get(index);
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type2 = new BlockType(stack2);
|
||||
if (type2.isTwoColors()) {
|
||||
return null;
|
||||
}
|
||||
final int color3 = type2.color1.ordinal();
|
||||
if (type2.type == TileType.Split) {
|
||||
if (colors[1] != -1) {
|
||||
return null;
|
||||
}
|
||||
colors[1] = color3;
|
||||
} else {
|
||||
if (type2.type != TileType.Chequered) {
|
||||
return null;
|
||||
}
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
} else if (colors[0] != color3) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
final int color4 = type2.color2.ordinal();
|
||||
}
|
||||
if (colors[0] == -1 || colors[1] == -1) {
|
||||
return null;
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Mixed).getStack(4);
|
||||
}
|
||||
case LargeBrick: {
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack3 = stacks.get(0);
|
||||
final BlockType type3 = new BlockType(stack3);
|
||||
if (type3.type == TileType.VerticalLargeBrick) {
|
||||
type3.type = this;
|
||||
return type3.getStack(1);
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
if (stacks.size() != 3) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = {-1, -1};
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
final ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type4 = new BlockType(stack4);
|
||||
if (type4.type != TileType.Tile) {
|
||||
return null;
|
||||
}
|
||||
final int color5 = type4.color1.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color5;
|
||||
++a;
|
||||
} else if (colors[0] == color5) {
|
||||
++a;
|
||||
} else if (colors[1] == -1) {
|
||||
colors[1] = color5;
|
||||
++b;
|
||||
} else {
|
||||
if (colors[1] != color5) {
|
||||
return null;
|
||||
}
|
||||
++b;
|
||||
}
|
||||
}
|
||||
if (colors[1] == -1) {
|
||||
colors[1] = colors[0];
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.LargeBrick).getStack(3);
|
||||
}
|
||||
}
|
||||
case Brick:
|
||||
case StripeBrick: {
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
final BlockType type = new BlockType(stack5);
|
||||
if (type.type == TileType.VerticalBrick) {
|
||||
type.type = this;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.StripeBrick) {
|
||||
type.type = this;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = {-1, -1};
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
final ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type4 = new BlockType(stack4);
|
||||
if (type4.type != TileType.LargeBrick) {
|
||||
return null;
|
||||
}
|
||||
final int color5 = type4.color1.ordinal();
|
||||
final int color6 = type4.color2.ordinal();
|
||||
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
||||
if (this == TileType.StripeBrick) {
|
||||
alt2 = 0;
|
||||
}
|
||||
if (colors[alt2] == -1) {
|
||||
colors[alt2] = color5;
|
||||
colors[1 - alt2] = color6;
|
||||
} else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), this).getStack(4);
|
||||
}
|
||||
}
|
||||
case VerticalLargeBrick:
|
||||
case VerticalBrick:
|
||||
case VerticalStripeBrick: {
|
||||
if (stacks.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
final BlockType type = new BlockType(stack5);
|
||||
if (type.type == TileType.LargeBrick) {
|
||||
type.type = TileType.VerticalLargeBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.Brick) {
|
||||
type.type = TileType.VerticalBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.StripeBrick) {
|
||||
type.type = TileType.VerticalStripeBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
private boolean isMortar(final ItemStack stack) {
|
||||
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
public enum TileType
|
||||
{
|
||||
Tile("tile", "Ceramic Tile"),
|
||||
Brick("brick", "Ceramic Bricks"),
|
||||
StripeBrick("brickstripe", "Striped Ceramic Bricks"),
|
||||
LargeBrick("bricklarge", "Large Ceramic Bricks"),
|
||||
Split("split", "Split Ceramic Tile"),
|
||||
Chequered("cheque", "Chequered Ceramic Tile"),
|
||||
Mixed("mixed", "Mixed Ceramic Tile"),
|
||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"),
|
||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"),
|
||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks");
|
||||
public static class BlockType {
|
||||
EnumFlowerColor color1;
|
||||
EnumFlowerColor color2;
|
||||
TileType type;
|
||||
|
||||
String id;
|
||||
String name;
|
||||
IIcon[] icons;
|
||||
private BlockType(final EnumFlowerColor color1, final EnumFlowerColor color2, final TileType type) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private TileType(final String id, final String name) {
|
||||
this.icons = new IIcon[3];
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
public boolean isTwoColors() {
|
||||
return this.type.canDouble() && this.color2 != this.color1;
|
||||
}
|
||||
|
||||
public static TileType get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
public BlockType(final ItemStack stack) {
|
||||
this(TileEntityMetadata.getItemDamage(stack));
|
||||
}
|
||||
|
||||
public boolean canDouble() {
|
||||
return this != TileType.Tile;
|
||||
}
|
||||
public ItemStack getStack(final int i) {
|
||||
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
|
||||
s.stackSize = i;
|
||||
return s;
|
||||
}
|
||||
|
||||
public ItemStack getRecipe(final List<ItemStack> stacks) {
|
||||
switch (this) {
|
||||
case Tile: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
int mortars = 0;
|
||||
int blocks = 0;
|
||||
int blockColor = -1;
|
||||
for (final ItemStack stack : stacks) {
|
||||
if (this.isMortar(stack)) {
|
||||
++mortars;
|
||||
}
|
||||
else {
|
||||
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
||||
return null;
|
||||
}
|
||||
++blocks;
|
||||
final int color = TileEntityMetadata.getItemDamage(stack);
|
||||
if (blockColor == -1) {
|
||||
blockColor = color;
|
||||
}
|
||||
else {
|
||||
if (blockColor != color) {
|
||||
return null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mortars != 1) {
|
||||
return null;
|
||||
}
|
||||
final EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
||||
return new BlockType(c, c, TileType.Tile).getStack(3);
|
||||
}
|
||||
case Split: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
int altCounter = 0;
|
||||
for (final ItemStack stack2 : stacks) {
|
||||
final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type = new BlockType(stack2);
|
||||
if (type.type != TileType.Tile) {
|
||||
return null;
|
||||
}
|
||||
final int color2 = type.color1.ordinal();
|
||||
if (colors[alt] == -1) {
|
||||
colors[alt] = color2;
|
||||
}
|
||||
else if (colors[alt] != color2) {
|
||||
return null;
|
||||
}
|
||||
++altCounter;
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Split).getStack(4);
|
||||
}
|
||||
case Chequered: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
for (final ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type2 = new BlockType(stack2);
|
||||
if (type2.type != TileType.Split) {
|
||||
return null;
|
||||
}
|
||||
final int color3 = type2.color1.ordinal();
|
||||
final int color4 = type2.color2.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
colors[1] = color4;
|
||||
}
|
||||
else {
|
||||
if (colors[0] != color3 || colors[1] != color4) {
|
||||
return null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Chequered).getStack(4);
|
||||
}
|
||||
case Mixed: {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
for (int index = 0; index < stacks.size(); ++index) {
|
||||
final ItemStack stack2 = stacks.get(index);
|
||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type2 = new BlockType(stack2);
|
||||
if (type2.isTwoColors()) {
|
||||
return null;
|
||||
}
|
||||
final int color3 = type2.color1.ordinal();
|
||||
if (type2.type == TileType.Split) {
|
||||
if (colors[1] != -1) {
|
||||
return null;
|
||||
}
|
||||
colors[1] = color3;
|
||||
}
|
||||
else {
|
||||
if (type2.type != TileType.Chequered) {
|
||||
return null;
|
||||
}
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
}
|
||||
else if (colors[0] != color3) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
final int color4 = type2.color2.ordinal();
|
||||
}
|
||||
if (colors[0] == -1 || colors[1] == -1) {
|
||||
return null;
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Mixed).getStack(4);
|
||||
}
|
||||
case LargeBrick: {
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack3 = stacks.get(0);
|
||||
final BlockType type3 = new BlockType(stack3);
|
||||
if (type3.type == TileType.VerticalLargeBrick) {
|
||||
type3.type = this;
|
||||
return type3.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (stacks.size() != 3) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
final ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type4 = new BlockType(stack4);
|
||||
if (type4.type != TileType.Tile) {
|
||||
return null;
|
||||
}
|
||||
final int color5 = type4.color1.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color5;
|
||||
++a;
|
||||
}
|
||||
else if (colors[0] == color5) {
|
||||
++a;
|
||||
}
|
||||
else if (colors[1] == -1) {
|
||||
colors[1] = color5;
|
||||
++b;
|
||||
}
|
||||
else {
|
||||
if (colors[1] != color5) {
|
||||
return null;
|
||||
}
|
||||
++b;
|
||||
}
|
||||
}
|
||||
if (colors[1] == -1) {
|
||||
colors[1] = colors[0];
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.LargeBrick).getStack(3);
|
||||
}
|
||||
}
|
||||
case Brick:
|
||||
case StripeBrick: {
|
||||
if (stacks.size() == 1) {
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
final BlockType type = new BlockType(stack5);
|
||||
if (type.type == TileType.VerticalBrick) {
|
||||
type.type = this;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.StripeBrick) {
|
||||
type.type = this;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
if (stacks.size() != 4) {
|
||||
return null;
|
||||
}
|
||||
final int[] colors = { -1, -1 };
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
final ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||
return null;
|
||||
}
|
||||
final BlockType type4 = new BlockType(stack4);
|
||||
if (type4.type != TileType.LargeBrick) {
|
||||
return null;
|
||||
}
|
||||
final int color5 = type4.color1.ordinal();
|
||||
final int color6 = type4.color2.ordinal();
|
||||
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
||||
if (this == TileType.StripeBrick) {
|
||||
alt2 = 0;
|
||||
}
|
||||
if (colors[alt2] == -1) {
|
||||
colors[alt2] = color5;
|
||||
colors[1 - alt2] = color6;
|
||||
}
|
||||
else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), this).getStack(4);
|
||||
}
|
||||
}
|
||||
case VerticalLargeBrick:
|
||||
case VerticalBrick:
|
||||
case VerticalStripeBrick: {
|
||||
if (stacks.size() != 1) {
|
||||
return null;
|
||||
}
|
||||
final ItemStack stack5 = stacks.get(0);
|
||||
final BlockType type = new BlockType(stack5);
|
||||
if (type.type == TileType.LargeBrick) {
|
||||
type.type = TileType.VerticalLargeBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.Brick) {
|
||||
type.type = TileType.VerticalBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
if (type.type == TileType.StripeBrick) {
|
||||
type.type = TileType.VerticalStripeBrick;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public BlockType(final int id) {
|
||||
this.color1 = EnumFlowerColor.get(id & 0xFF);
|
||||
this.color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||
this.type = TileType.get(id >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
private boolean isMortar(final ItemStack stack) {
|
||||
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
||||
}
|
||||
}
|
||||
public String getName() {
|
||||
String name = this.color1.getName();
|
||||
if (this.type.canDouble() && this.color2 != this.color1) {
|
||||
name = name + " & " + this.color2.getName();
|
||||
}
|
||||
return name + " " + this.type.name;
|
||||
}
|
||||
|
||||
public static class BlockType
|
||||
{
|
||||
EnumFlowerColor color1;
|
||||
EnumFlowerColor color2;
|
||||
TileType type;
|
||||
public int ordinal() {
|
||||
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
private BlockType(final EnumFlowerColor color1, final EnumFlowerColor color2, final TileType type) {
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isTwoColors() {
|
||||
return this.type.canDouble() && this.color2 != this.color1;
|
||||
}
|
||||
|
||||
public BlockType(final ItemStack stack) {
|
||||
this(TileEntityMetadata.getItemDamage(stack));
|
||||
}
|
||||
|
||||
public ItemStack getStack(final int i) {
|
||||
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
|
||||
s.stackSize = i;
|
||||
return s;
|
||||
}
|
||||
|
||||
public BlockType(final int id) {
|
||||
this.color1 = EnumFlowerColor.get(id & 0xFF);
|
||||
this.color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||
this.type = TileType.get(id >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name = this.color1.getName();
|
||||
if (this.type.canDouble() && this.color2 != this.color1) {
|
||||
name = name + " & " + this.color2.getName();
|
||||
}
|
||||
return name + " " + this.type.name;
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
public IIcon getIcon(final int layer) {
|
||||
return this.type.icons[layer];
|
||||
}
|
||||
}
|
||||
// public IIcon getIcon(final int layer) {
|
||||
// return this.type.icons[layer];
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,30 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
import binnie.extratrees.carpentry.DesignBlock;
|
||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlockCeramicPatterned extends BlockDesign
|
||||
{
|
||||
public BlockCeramicPatterned() {
|
||||
super(CeramicDesignSystem.instance, Material.rock);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setBlockName("ceramicPattern");
|
||||
}
|
||||
public class BlockCeramicPatterned extends BlockDesign {
|
||||
public BlockCeramicPatterned() {
|
||||
super(CeramicDesignSystem.instance, Material.ROCK);
|
||||
this.setHardness(1.0f);
|
||||
this.setResistance(5.0f);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setRegistryName("ceramicPattern");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(final IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCreativeStack(final IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
return design.getDesign().getName() + " Ceramic Block";
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(final DesignBlock design) {
|
||||
return design.getDesign().getName() + " Ceramic Block";
|
||||
}
|
||||
}
|
||||
@@ -1,197 +1,187 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.block.BlockMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.extratrees.ExtraTrees;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.core.block.IBlockMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class BlockStained extends Block implements IBlockMetadata
|
||||
{
|
||||
public BlockStained() {
|
||||
super(Material.glass);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setBlockName("stained");
|
||||
}
|
||||
public class BlockStained extends Block implements IBlockMetadata {
|
||||
public BlockStained() {
|
||||
super(Material.GLASS);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setRegistryName("stained");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(final Random p_149745_1_) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int quantityDropped(final Random p_149745_1_) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public boolean isOpaqueCube() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderAsNormalBlock() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderBlockPass() {
|
||||
// return 1;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
|
||||
// final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
|
||||
// final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
// return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
// return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
// @Override
|
||||
// public boolean hasTileEntity(final int meta) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
//
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
|
||||
final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
|
||||
final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
||||
return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return EnumFlowerColor.get(meta).getName() + " Pigmented Glass";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(World p0, BlockPos pos, ItemStack p4) {
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
// @Override
|
||||
// public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
// this.dropBlockAsItem(world, x, y, z, drop);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getIcon(side, tile.getTileMetadata());
|
||||
// }
|
||||
// return super.getIcon(world, x, y, z, side);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
||||
return EnumFlowerColor.get(meta).getName() + " Pigmented Glass";
|
||||
}
|
||||
// @Override
|
||||
// public IIcon getIcon(final int side, final int meta) {
|
||||
// return this.blockIcon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// this.blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
// if (tile != null) {
|
||||
// return this.getRenderColor(tile.getTileMetadata());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getIcon(side, tile.getTileMetadata());
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
this.blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
return this.getRenderColor(tile.getTileMetadata());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor(final int meta) {
|
||||
return EnumFlowerColor.get(meta).getColor(false);
|
||||
}
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
// return 20;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
||||
// return 5;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return BlockMetadata.getPickBlock(world, x, y, z);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getRenderColor(final int meta) {
|
||||
// return EnumFlowerColor.get(meta).getColor(false);
|
||||
// }
|
||||
}
|
||||
@@ -1,49 +1,45 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Map;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial
|
||||
{
|
||||
EnumFlowerColor color;
|
||||
static Map<EnumFlowerColor, CeramicColor> map;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
CeramicColor(final EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
public class CeramicColor implements IDesignMaterial {
|
||||
EnumFlowerColor color;
|
||||
static Map<EnumFlowerColor, CeramicColor> map;
|
||||
|
||||
public static CeramicColor get(final EnumFlowerColor c) {
|
||||
return CeramicColor.map.get(c);
|
||||
}
|
||||
CeramicColor(final EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.ceramic, this.color.ordinal());
|
||||
}
|
||||
public static CeramicColor get(final EnumFlowerColor c) {
|
||||
return CeramicColor.map.get(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(Botany.ceramic, this.color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return this.color.getColor(false);
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
|
||||
static {
|
||||
CeramicColor.map = new LinkedHashMap<EnumFlowerColor, CeramicColor>();
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getColour() {
|
||||
return this.color.getColor(false);
|
||||
}
|
||||
|
||||
static {
|
||||
CeramicColor.map = new LinkedHashMap<EnumFlowerColor, CeramicColor>();
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +1,89 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.extratrees.carpentry.EnumPattern;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.carpentry.DesignerManager;
|
||||
import java.util.HashMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import java.util.Map;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.carpentry.DesignerManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CeramicDesignSystem implements IDesignSystem
|
||||
{
|
||||
public static CeramicDesignSystem instance;
|
||||
Map<Integer, IIcon> primary;
|
||||
Map<Integer, IIcon> secondary;
|
||||
public class CeramicDesignSystem implements IDesignSystem {
|
||||
public static CeramicDesignSystem instance;
|
||||
// Map<Integer, IIcon> primary;
|
||||
// Map<Integer, IIcon> secondary;
|
||||
|
||||
CeramicDesignSystem() {
|
||||
this.primary = new HashMap<Integer, IIcon>();
|
||||
this.secondary = new HashMap<Integer, IIcon>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
CeramicDesignSystem() {
|
||||
// this.primary = new HashMap<Integer, IIcon>();
|
||||
// this.secondary = new HashMap<Integer, IIcon>();
|
||||
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(final int id) {
|
||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||
}
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final int id) {
|
||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialIndex(final IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
}
|
||||
@Override
|
||||
public int getMaterialIndex(final IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
}
|
||||
|
||||
public String getTexturePath() {
|
||||
return "ceramic";
|
||||
}
|
||||
public String getTexturePath() {
|
||||
return "ceramic";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.primary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public IIcon getPrimaryIcon(final IPattern pattern) {
|
||||
// if (pattern instanceof EnumPattern) {
|
||||
// return this.primary.get(((EnumPattern) pattern).ordinal());
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getSecondaryIcon(final IPattern pattern) {
|
||||
// if (pattern instanceof EnumPattern) {
|
||||
// return this.secondary.get(((EnumPattern) pattern).ordinal());
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// for (final EnumPattern pattern : EnumPattern.values()) {
|
||||
// this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
// this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(final IPattern pattern) {
|
||||
if (pattern instanceof EnumPattern) {
|
||||
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
for (final EnumPattern pattern : EnumPattern.values()) {
|
||||
this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||
this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.Mortar.get(1);
|
||||
}
|
||||
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return BotanyItems.Mortar.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
||||
}
|
||||
|
||||
static {
|
||||
CeramicDesignSystem.instance = new CeramicDesignSystem();
|
||||
}
|
||||
static {
|
||||
CeramicDesignSystem.instance = new CeramicDesignSystem();
|
||||
}
|
||||
}
|
||||
@@ -1,72 +1,73 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.world.World;
|
||||
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;
|
||||
|
||||
public class CeramicTileRecipe implements IRecipe
|
||||
{
|
||||
ItemStack cached;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
||||
this.cached = this.getCraftingResult(inv);
|
||||
return this.cached != null;
|
||||
}
|
||||
public class CeramicTileRecipe implements IRecipe {
|
||||
ItemStack cached;
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(final InventoryCrafting inv) {
|
||||
final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||
final Item mortar = Botany.misc;
|
||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
int ix = -1;
|
||||
int iy = -1;
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
final ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
final int x = i / 3;
|
||||
final int y = i % 3;
|
||||
if (ix == -1) {
|
||||
ix = x;
|
||||
iy = y;
|
||||
}
|
||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||
return null;
|
||||
}
|
||||
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
|
||||
return null;
|
||||
}
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||
final ItemStack stack2 = type.getRecipe(stacks);
|
||||
if (stack2 != null) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
||||
this.cached = this.getCraftingResult(inv);
|
||||
return this.cached != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getCraftingResult(final InventoryCrafting inv) {
|
||||
final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||
final Item mortar = Botany.misc;
|
||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
int ix = -1;
|
||||
int iy = -1;
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
final ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack != null) {
|
||||
final int x = i / 3;
|
||||
final int y = i % 3;
|
||||
if (ix == -1) {
|
||||
ix = x;
|
||||
iy = y;
|
||||
}
|
||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||
return null;
|
||||
}
|
||||
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
|
||||
return null;
|
||||
}
|
||||
stacks.add(stack);
|
||||
}
|
||||
}
|
||||
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||
final ItemStack stack2 = type.getRecipe(stacks);
|
||||
if (stack2 != null) {
|
||||
return stack2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return this.cached;
|
||||
}
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return this.cached;
|
||||
}
|
||||
|
||||
//TODO IMPLEMENT
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,16 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class ItemCeramic extends ItemMetadata
|
||||
{
|
||||
public ItemCeramic(final Block block) {
|
||||
super(block);
|
||||
}
|
||||
public class ItemCeramic extends ItemMetadata {
|
||||
public ItemCeramic(final Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
return 16711935;
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
// return 16711935;
|
||||
// }
|
||||
}
|
||||
@@ -1,62 +1,63 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.Binnie;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.IFlower;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PigmentRecipe implements IRecipe
|
||||
{
|
||||
private final ItemStack unknown;
|
||||
ItemStack cached;
|
||||
public class PigmentRecipe implements IRecipe {
|
||||
private final ItemStack unknown;
|
||||
ItemStack cached;
|
||||
|
||||
public PigmentRecipe() {
|
||||
this.unknown = null;
|
||||
}
|
||||
public PigmentRecipe() {
|
||||
this.unknown = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting crafting, final World world) {
|
||||
return this.getCraftingResult(crafting) != null;
|
||||
}
|
||||
@Override
|
||||
public boolean matches(final InventoryCrafting crafting, final World world) {
|
||||
return this.getCraftingResult(crafting) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
if (this.cached != null) {
|
||||
return this.cached;
|
||||
}
|
||||
return this.unknown;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
if (this.cached != null) {
|
||||
return this.cached;
|
||||
}
|
||||
return this.unknown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(final 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))) {
|
||||
final 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 ItemStack getCraftingResult(final 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))) {
|
||||
final 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;
|
||||
}
|
||||
|
||||
|
||||
//TODO IMPLEMENT
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv) {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.genetics.FlowerHelper;
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.genetics.FlowerHelper;
|
||||
|
||||
public class BotanyCore
|
||||
{
|
||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||
public static IFlowerRoot speciesRoot;
|
||||
public class BotanyCore {
|
||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||
public static IFlowerRoot speciesRoot;
|
||||
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
return BotanyCore.speciesRoot;
|
||||
}
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
return BotanyCore.speciesRoot;
|
||||
}
|
||||
|
||||
static {
|
||||
BotanyCore.speciesRoot = new FlowerHelper();
|
||||
}
|
||||
static {
|
||||
BotanyCore.speciesRoot = new FlowerHelper();
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,34 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import binnie.craftgui.botany.WindowBotanistDatabase;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.craftgui.botany.WindowBotanistDatabase;
|
||||
import binnie.craftgui.minecraft.Window;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public enum BotanyGUI implements IBinnieGUID
|
||||
{
|
||||
Database,
|
||||
DatabaseNEI;
|
||||
public enum BotanyGUI implements IBinnieGUID {
|
||||
Database,
|
||||
DatabaseNEI;
|
||||
|
||||
@Override
|
||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
switch (this) {
|
||||
case Database:
|
||||
case DatabaseNEI: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
@Override
|
||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||
Window window = null;
|
||||
final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
|
||||
IInventory object = null;
|
||||
if (tileEntity instanceof IInventory) {
|
||||
object = (IInventory) tileEntity;
|
||||
}
|
||||
switch (this) {
|
||||
case Database:
|
||||
case DatabaseNEI: {
|
||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return window;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,23 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
import binnie.core.resource.ResourceType;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
|
||||
public enum BotanyTexture implements IBinnieTexture
|
||||
{
|
||||
;
|
||||
String texture;
|
||||
ResourceType type;
|
||||
public enum BotanyTexture implements IBinnieTexture {
|
||||
;
|
||||
String texture;
|
||||
ResourceType type;
|
||||
|
||||
private BotanyTexture(final ResourceType base, final String texture) {
|
||||
this.texture = texture;
|
||||
this.type = base;
|
||||
}
|
||||
private BotanyTexture(final ResourceType base, final String texture) {
|
||||
this.texture = texture;
|
||||
this.type = base;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
|
||||
}
|
||||
@Override
|
||||
public BinnieResource getTexture() {
|
||||
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +1,31 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.core.IInitializable;
|
||||
|
||||
public class ModuleCore implements IInitializable
|
||||
{
|
||||
@Override
|
||||
public void preInit() {
|
||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
||||
Binnie.Language.addObjectName(pH, Binnie.Language.unlocalised(Botany.instance, "ph." + pH.getID()));
|
||||
}
|
||||
for (final EnumMoisture pH2 : EnumMoisture.values()) {
|
||||
Binnie.Language.addObjectName(pH2, Binnie.Language.unlocalised(Botany.instance, "moisture." + pH2.getID()));
|
||||
}
|
||||
for (final EnumSoilType pH3 : EnumSoilType.values()) {
|
||||
Binnie.Language.addObjectName(pH3, Binnie.Language.unlocalised(Botany.instance, "soil." + pH3.getID()));
|
||||
}
|
||||
}
|
||||
public class ModuleCore implements IInitializable {
|
||||
@Override
|
||||
public void preInit() {
|
||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
||||
Binnie.Language.addObjectName(pH, Binnie.Language.unlocalised(Botany.instance, "ph." + pH.getID()));
|
||||
}
|
||||
for (final EnumMoisture pH2 : EnumMoisture.values()) {
|
||||
Binnie.Language.addObjectName(pH2, Binnie.Language.unlocalised(Botany.instance, "moisture." + pH2.getID()));
|
||||
}
|
||||
for (final EnumSoilType pH3 : EnumSoilType.values()) {
|
||||
Binnie.Language.addObjectName(pH3, Binnie.Language.unlocalised(Botany.instance, "soil." + pH3.getID()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,92 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.core.circuits.BinnieCircuit;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CircuitGarden extends BinnieCircuit
|
||||
{
|
||||
private Class<? extends FarmLogic> logicClass;
|
||||
private boolean isManual;
|
||||
private boolean isFertilised;
|
||||
private ItemStack icon;
|
||||
private EnumMoisture moisture;
|
||||
private EnumAcidity acidity;
|
||||
public class CircuitGarden extends BinnieCircuit {
|
||||
private Class<? extends FarmLogic> logicClass;
|
||||
private boolean isManual;
|
||||
private boolean isFertilised;
|
||||
private ItemStack icon;
|
||||
private EnumMoisture moisture;
|
||||
private EnumAcidity acidity;
|
||||
|
||||
public CircuitGarden(final EnumMoisture moisture, final EnumAcidity ph, final boolean manual, final boolean fertilised, final ItemStack recipe, final 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.isManual = false;
|
||||
this.isFertilised = false;
|
||||
this.isManual = manual;
|
||||
this.isFertilised = fertilised;
|
||||
this.moisture = moisture;
|
||||
this.acidity = ph;
|
||||
this.icon = icon;
|
||||
String info = "";
|
||||
if (moisture == EnumMoisture.Dry) {
|
||||
info += "§eDry§f";
|
||||
}
|
||||
if (moisture == EnumMoisture.Damp) {
|
||||
info += "§9Damp§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Acid) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§cAcidic§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Neutral) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§aNeutral§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Alkaline) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§bAlkaline§f";
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
info = " (" + info + "§f)";
|
||||
}
|
||||
this.addTooltipString("Flowers" + info);
|
||||
}
|
||||
public CircuitGarden(final EnumMoisture moisture, final EnumAcidity ph, final boolean manual, final boolean fertilised, final ItemStack recipe, final 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.isManual = false;
|
||||
this.isFertilised = false;
|
||||
this.isManual = manual;
|
||||
this.isFertilised = fertilised;
|
||||
this.moisture = moisture;
|
||||
this.acidity = ph;
|
||||
this.icon = icon;
|
||||
String info = "";
|
||||
if (moisture == EnumMoisture.Dry) {
|
||||
info += "§eDry§f";
|
||||
}
|
||||
if (moisture == EnumMoisture.Damp) {
|
||||
info += "§9Damp§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Acid) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§cAcidic§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Neutral) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§aNeutral§f";
|
||||
}
|
||||
if (this.acidity == EnumAcidity.Alkaline) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§bAlkaline§f";
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
info = " (" + info + "§f)";
|
||||
}
|
||||
this.addTooltipString("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 (!this.isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
final GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||
logic.setData(this.moisture, this.acidity, this.isManual, this.isFertilised, this.icon, Binnie.Language.localise(this.getName()));
|
||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
@Override
|
||||
public void onInsertion(int slot, Object tile) {
|
||||
if (!this.isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
final GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||
logic.setData(this.moisture, this.acidity, this.isManual, this.isFertilised, this.icon, Binnie.Language.localise(this.getUnlocalizedName()));
|
||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int slot, Object tile) {
|
||||
this.onInsertion(slot, tile);
|
||||
}
|
||||
@Override
|
||||
public void onLoad(int slot, Object tile) {
|
||||
this.onInsertion(slot, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int slot, Object tile) {
|
||||
if (!this.isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||
}
|
||||
@Override
|
||||
public void onRemoval(int slot, Object tile) {
|
||||
if (!this.isCircuitable(tile)) {
|
||||
return;
|
||||
}
|
||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
}
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +1,55 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
public abstract class FarmLogic implements IFarmLogic {
|
||||
World world;
|
||||
IFarmHousing housing;
|
||||
boolean isManual;
|
||||
|
||||
public abstract class FarmLogic implements IFarmLogic
|
||||
{
|
||||
World world;
|
||||
IFarmHousing housing;
|
||||
boolean isManual;
|
||||
public FarmLogic(final IFarmHousing housing) {
|
||||
this.housing = housing;
|
||||
}
|
||||
|
||||
public FarmLogic(final IFarmHousing housing) {
|
||||
this.housing = housing;
|
||||
}
|
||||
@Override
|
||||
public IFarmLogic setManual(final boolean flag) {
|
||||
this.isManual = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFarmLogic setManual(final boolean flag) {
|
||||
this.isManual = flag;
|
||||
return this;
|
||||
}
|
||||
protected final boolean isAirBlock(final Vect position) {
|
||||
return this.world.isAirBlock(new BlockPos(position.x, position.y, position.z));
|
||||
}
|
||||
|
||||
protected final boolean isAirBlock(final Vect position) {
|
||||
return this.world.isAirBlock(position.x, position.y, position.z);
|
||||
}
|
||||
protected final boolean isWaterBlock(final Vect position) {
|
||||
return this.world.getBlockState(new BlockPos(position.x, position.y, position.z)).getBlock() == Blocks.WATER;
|
||||
}
|
||||
|
||||
protected final boolean isWaterBlock(final Vect position) {
|
||||
return this.world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
||||
}
|
||||
protected final IBlockState getBlock(final Vect position) {
|
||||
return this.world.getBlockState(new BlockPos(position.x, position.y, position.z));
|
||||
}
|
||||
|
||||
protected final Block getBlock(final Vect position) {
|
||||
return this.world.getBlock(position.x, position.y, position.z);
|
||||
}
|
||||
protected final int getBlockMeta(final Vect position) {
|
||||
return this.getBlock(position).getBlock().getMetaFromState(getBlock(position));
|
||||
}
|
||||
|
||||
protected final int getBlockMeta(final Vect position) {
|
||||
return this.world.getBlockMetadata(position.x, position.y, position.z);
|
||||
}
|
||||
protected final ItemStack getAsItemStack(final Vect position) {
|
||||
return new ItemStack(this.getBlock(position).getBlock(), 1, this.getBlockMeta(position));
|
||||
}
|
||||
|
||||
protected final ItemStack getAsItemStack(final Vect position) {
|
||||
return new ItemStack(this.getBlock(position), 1, this.getBlockMeta(position));
|
||||
}
|
||||
protected final Vect translateWithOffset(final int x, final int y, final int z, final FarmDirection direction, final int step) {
|
||||
return new Vect(x + direction.getFacing().getFrontOffsetX() * step, y + direction.getFacing().getFrontOffsetY() * step, z + direction.getFacing().getFrontOffsetZ() * step);
|
||||
}
|
||||
|
||||
protected final Vect translateWithOffset(final int x, final int y, final int z, final FarmDirection direction, final int step) {
|
||||
return new Vect(x + direction.getForgeDirection().offsetX * step, y + direction.getForgeDirection().offsetY * step, z + direction.getForgeDirection().offsetZ * step);
|
||||
}
|
||||
|
||||
protected final void setBlock(final Vect position, final Block block, final int meta) {
|
||||
this.world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
||||
}
|
||||
protected final void setBlock(final Vect position, final Block block, final int meta) {
|
||||
this.world.setBlockState(new BlockPos(position.x, position.y, position.z), getBlock(position), 2);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,49 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.farming.ICrop;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmableFlower implements IFarmable
|
||||
{
|
||||
@Override
|
||||
public boolean isSaplingAt(final World world, final int x, final int y, final int z) {
|
||||
return world.getBlock(x, y, z) == Botany.flower;
|
||||
}
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Override
|
||||
public ICrop getCropAt(final World world, final int x, final int y, final int z) {
|
||||
return null;
|
||||
}
|
||||
public class FarmableFlower implements IFarmable {
|
||||
@Override
|
||||
public boolean isSaplingAt(final World world, final BlockPos pos) {
|
||||
return world.getBlockState(pos) == Botany.flower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(final ItemStack itemstack) {
|
||||
final EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(final ItemStack itemstack) {
|
||||
final EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindfall(final ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final BlockPos pos) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||
Gardening.plant(world, pos, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindfall(final ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,22 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmableVanillaFlower extends FarmableFlower
|
||||
{
|
||||
@Override
|
||||
public boolean isGermling(final ItemStack itemstack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||
}
|
||||
public class FarmableVanillaFlower extends FarmableFlower {
|
||||
@Override
|
||||
public boolean isGermling(final ItemStack itemstack) {
|
||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||
}
|
||||
@Override
|
||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final BlockPos pos) {
|
||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||
return Gardening.plant(world, pos, flower, player.getGameProfile());
|
||||
}
|
||||
}
|
||||
@@ -1,370 +1,360 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import binnie.core.Mods;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import forestry.core.access.IOwnable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import forestry.api.farming.ICrop;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.Binnie;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class GardenLogic extends FarmLogic
|
||||
{
|
||||
EnumMoisture moisture;
|
||||
EnumAcidity acidity;
|
||||
boolean fertilised;
|
||||
String name;
|
||||
ArrayList<ItemStack> produce;
|
||||
private ItemStack icon;
|
||||
List<IFarmable> farmables;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public GardenLogic(final IFarmHousing housing) {
|
||||
super(housing);
|
||||
this.produce = new ArrayList<ItemStack>();
|
||||
(this.farmables = new ArrayList<IFarmable>()).add(new FarmableFlower());
|
||||
this.farmables.add(new FarmableVanillaFlower());
|
||||
}
|
||||
public class GardenLogic extends FarmLogic {
|
||||
EnumMoisture moisture;
|
||||
EnumAcidity acidity;
|
||||
boolean fertilised;
|
||||
String name;
|
||||
ArrayList<ItemStack> produce;
|
||||
private ItemStack icon;
|
||||
List<IFarmable> farmables;
|
||||
|
||||
@Override
|
||||
public int getFertilizerConsumption() {
|
||||
return this.fertilised ? 8 : 2;
|
||||
}
|
||||
public GardenLogic(final IFarmHousing housing) {
|
||||
super(housing);
|
||||
this.produce = new ArrayList<ItemStack>();
|
||||
(this.farmables = new ArrayList<IFarmable>()).add(new FarmableFlower());
|
||||
this.farmables.add(new FarmableVanillaFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterConsumption(final float hydrationModifier) {
|
||||
return (int) (this.moisture.ordinal() * 40 * hydrationModifier);
|
||||
}
|
||||
@Override
|
||||
public int getFertilizerConsumption() {
|
||||
return this.fertilised ? 8 : 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedResource(final ItemStack itemstack) {
|
||||
return Gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.sand) || itemstack.getItem() == Item.getItemFromBlock(Blocks.dirt) || Gardening.isAcidFertiliser(itemstack) || Gardening.isAlkalineFertiliser(itemstack);
|
||||
}
|
||||
@Override
|
||||
public int getWaterConsumption(final float hydrationModifier) {
|
||||
return (int) (this.moisture.ordinal() * 40 * hydrationModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> collect() {
|
||||
final Collection<ItemStack> products = this.produce;
|
||||
this.produce = new ArrayList<ItemStack>();
|
||||
return products;
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedResource(final ItemStack itemstack) {
|
||||
return Gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) || itemstack.getItem() == Item.getItemFromBlock(Blocks.DIRT) || Gardening.isAcidFertiliser(itemstack) || Gardening.isAlkalineFertiliser(itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cultivate(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
this.world = this.housing.getWorld();
|
||||
return this.maintainSoil(x, y, z, direction, extent) || (!this.isManual && this.maintainWater(x, y, z, direction, extent)) || this.maintainCrops(x, y + 1, z, direction, extent);
|
||||
}
|
||||
// @Override
|
||||
// public Collection<ItemStack> collect() {
|
||||
// final Collection<ItemStack> products = this.produce;
|
||||
// this.produce = new ArrayList<ItemStack>();
|
||||
// return products;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean cultivate(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
// this.world = this.housing.getWorld();
|
||||
// return this.maintainSoil(x, y, z, direction, extent) || (!this.isManual && this.maintainWater(x, y, z, direction, extent)) || this.maintainCrops(x, y + 1, z, direction, extent);
|
||||
// }
|
||||
|
||||
private boolean isWaste(final ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
||||
}
|
||||
private boolean isWaste(final ItemStack stack) {
|
||||
return stack.getItem() == Item.getItemFromBlock(Blocks.DIRT);
|
||||
}
|
||||
|
||||
private boolean maintainSoil(final int x2, final int y2, final int z2, final FarmDirection direction, final int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
final Vect position = this.translateWithOffset(x2, y2, z2, direction, i);
|
||||
if (this.fertilised && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
||||
if (soil.fertilise(this.world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (this.world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||
this.world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||
}
|
||||
else {
|
||||
if (this.acidity != null && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
||||
final EnumAcidity pH = soil.getPH(this.world, position.x, position.y, position.z);
|
||||
if (pH.ordinal() < this.acidity.ordinal()) {
|
||||
final ItemStack stack = this.getAvailableAlkaline();
|
||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (pH.ordinal() > this.acidity.ordinal()) {
|
||||
final ItemStack stack = this.getAvailableAcid();
|
||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.isAirBlock(position) && !this.world.getBlock(position.x, position.y, position.z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
final ItemStack block = this.getAsItemStack(position);
|
||||
final ItemStack loam = this.getAvailableLoam();
|
||||
if (this.isWaste(block) && loam != null) {
|
||||
this.produce.addAll(Blocks.dirt.getDrops(this.world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||
this.setBlock(position, Blocks.air, 0);
|
||||
return this.trySetSoil(position, loam);
|
||||
}
|
||||
}
|
||||
else if (!this.isManual) {
|
||||
if (!this.isWaterBlock(position)) {
|
||||
if (i % 2 == 0) {
|
||||
return this.trySetSoil(position);
|
||||
}
|
||||
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;
|
||||
}
|
||||
final Vect previous = this.translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||
final ItemStack soil2 = this.getAsItemStack(previous);
|
||||
if (!Gardening.isSoil(soil2.getItem())) {
|
||||
this.trySetSoil(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean maintainSoil(final int x2, final int y2, final int z2, final FarmDirection direction, final int extent) {
|
||||
// for (int i = 0; i < extent; ++i) {
|
||||
// final Vect position = this.translateWithOffset(x2, y2, z2, direction, i);
|
||||
// if (this.fertilised && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
||||
// final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
||||
// if (soil.fertilise(this.world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// if (this.world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||
// this.world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||
// }
|
||||
// else {
|
||||
// if (this.acidity != null && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
||||
// final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
||||
// final EnumAcidity pH = soil.getPH(this.world, position.x, position.y, position.z);
|
||||
// if (pH.ordinal() < this.acidity.ordinal()) {
|
||||
// final ItemStack stack = this.getAvailableAlkaline();
|
||||
// if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||
// this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// if (pH.ordinal() > this.acidity.ordinal()) {
|
||||
// final ItemStack stack = this.getAvailableAcid();
|
||||
// if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||
// this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!this.isAirBlock(position) && !this.world.getBlock(position.x, position.y, position.z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
// final ItemStack block = this.getAsItemStack(position);
|
||||
// final ItemStack loam = this.getAvailableLoam();
|
||||
// if (this.isWaste(block) && loam != null) {
|
||||
// this.produce.addAll(Blocks.DIRT.getDrops(this.world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||
// this.setBlock(position, Blocks.AIR, 0);
|
||||
// return this.trySetSoil(position, loam);
|
||||
// }
|
||||
// }
|
||||
// else if (!this.isManual) {
|
||||
// if (!this.isWaterBlock(position)) {
|
||||
// if (i % 2 == 0) {
|
||||
// return this.trySetSoil(position);
|
||||
// }
|
||||
// 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;
|
||||
// }
|
||||
// final Vect previous = this.translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||
// final ItemStack soil2 = this.getAsItemStack(previous);
|
||||
// if (!Gardening.isSoil(soil2.getItem())) {
|
||||
// this.trySetSoil(position);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean maintainWater(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
if (!this.isWaterBlock(position)) {
|
||||
boolean isEnclosed = true;
|
||||
if (this.world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
else if (this.world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
else if (this.world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
else if (this.world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||
isEnclosed = false;
|
||||
}
|
||||
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
|
||||
if (isEnclosed) {
|
||||
return this.trySetWater(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean maintainWater(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
// for (int i = 0; i < extent; ++i) {
|
||||
// final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
||||
// if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
// if (!this.isWaterBlock(position)) {
|
||||
// boolean isEnclosed = true;
|
||||
// if (this.world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||
// isEnclosed = false;
|
||||
// }
|
||||
// else if (this.world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||
// isEnclosed = false;
|
||||
// }
|
||||
// else if (this.world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||
// isEnclosed = false;
|
||||
// }
|
||||
// else if (this.world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||
// isEnclosed = false;
|
||||
// }
|
||||
// isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
|
||||
// if (isEnclosed) {
|
||||
// return this.trySetWater(position);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
private ItemStack getAvailableLoam() {
|
||||
EnumMoisture[] moistures;
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[] { EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry };
|
||||
}
|
||||
else if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry };
|
||||
}
|
||||
else {
|
||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp };
|
||||
}
|
||||
final EnumAcidity[] acidities = { EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline };
|
||||
for (final EnumMoisture moist : moistures) {
|
||||
for (final EnumAcidity acid : acidities) {
|
||||
for (final Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) {
|
||||
final int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||
final ItemStack[] resource = { new ItemStack(type, 1, meta) };
|
||||
if (this.housing.getFarmInventory().hasResources(resource)) {
|
||||
return resource[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.housing.getFarmInventory().hasResources(new ItemStack[] { new ItemStack(Blocks.dirt) })) {
|
||||
return new ItemStack(Blocks.dirt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private ItemStack getAvailableLoam() {
|
||||
EnumMoisture[] moistures;
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry};
|
||||
} else if (this.moisture == EnumMoisture.Damp) {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry};
|
||||
} else {
|
||||
moistures = new EnumMoisture[]{EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp};
|
||||
}
|
||||
final EnumAcidity[] acidities = {EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline};
|
||||
for (final EnumMoisture moist : moistures) {
|
||||
for (final EnumAcidity acid : acidities) {
|
||||
for (final Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) {
|
||||
final int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||
final ItemStack[] resource = {new ItemStack(type, 1, meta)};
|
||||
if (this.housing.getFarmInventory().hasResources(resource)) {
|
||||
return resource[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.housing.getFarmInventory().hasResources(new ItemStack[]{new ItemStack(Blocks.DIRT)})) {
|
||||
return new ItemStack(Blocks.DIRT);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean trySetSoil(final Vect position) {
|
||||
return this.trySetSoil(position, this.getAvailableLoam());
|
||||
}
|
||||
private boolean trySetSoil(final Vect position) {
|
||||
return this.trySetSoil(position, this.getAvailableLoam());
|
||||
}
|
||||
|
||||
private boolean trySetSoil(final Vect position, ItemStack loam) {
|
||||
ItemStack copy = loam;
|
||||
if (loam != null) {
|
||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
||||
loam = new ItemStack(Botany.soil, 0, 4);
|
||||
}
|
||||
this.setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { copy });
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private boolean trySetSoil(final Vect position, ItemStack loam) {
|
||||
ItemStack copy = loam;
|
||||
if (loam != null) {
|
||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.DIRT)) {
|
||||
loam = new ItemStack(Botany.soil, 0, 4);
|
||||
}
|
||||
//this.setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||
this.housing.getFarmInventory().removeResources(new ItemStack[]{copy});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean trySetWater(final Vect position) {
|
||||
final FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
if (!this.housing.hasLiquid(water)) {
|
||||
return false;
|
||||
}
|
||||
this.setBlock(position, Blocks.water, 0);
|
||||
this.housing.removeLiquid(water);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (this.moisture != EnumMoisture.Dry) {
|
||||
return this.trySetSoil(position);
|
||||
}
|
||||
final ItemStack[] sand = { new ItemStack(Blocks.sand, 1) };
|
||||
if (!this.housing.getFarmInventory().hasResources(sand)) {
|
||||
return false;
|
||||
}
|
||||
this.setBlock(position, Blocks.sand, 0);
|
||||
this.housing.getFarmInventory().removeResources(sand);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
private boolean trySetWater(final Vect position) {
|
||||
final FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||
if (this.moisture == EnumMoisture.Damp) {
|
||||
if (!this.housing.hasLiquid(water)) {
|
||||
return false;
|
||||
}
|
||||
this.setBlock(position, Blocks.WATER, 0);
|
||||
this.housing.removeLiquid(water);
|
||||
return true;
|
||||
} else {
|
||||
if (this.moisture != EnumMoisture.Dry) {
|
||||
return this.trySetSoil(position);
|
||||
}
|
||||
final ItemStack[] sand = {new ItemStack(Blocks.SAND, 1)};
|
||||
if (!this.housing.getFarmInventory().hasResources(sand)) {
|
||||
return false;
|
||||
}
|
||||
this.setBlock(position, Blocks.SAND, 0);
|
||||
this.housing.getFarmInventory().removeResources(sand);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setIcon(final ItemStack icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
public void setIcon(final ItemStack icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedGermling(final ItemStack itemstack) {
|
||||
for (final IFarmable farmable : this.farmables) {
|
||||
if (farmable.isGermling(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isAcceptedGermling(final ItemStack itemstack) {
|
||||
for (final IFarmable farmable : this.farmables) {
|
||||
if (farmable.isGermling(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ICrop> harvest(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Collection<ItemStack> collect(World world, IFarmHousing farmHousing) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return this.icon.getIconIndex();
|
||||
}
|
||||
@Override
|
||||
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getSpriteSheet() {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
@Override
|
||||
public Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getTextureMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean maintainCrops(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
for (int i = 0; i < extent; ++i) {
|
||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
final ItemStack below = this.getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||
if (Gardening.isSoil(below.getItem())) {
|
||||
return this.trySetCrop(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public Collection<ICrop> harvest(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon() {
|
||||
// return this.icon.getIconIndex();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ResourceLocation getSpriteSheet() {
|
||||
// return TextureMap.locationBlocksTexture;
|
||||
// }
|
||||
|
||||
private boolean trySetCrop(final Vect position) {
|
||||
for (final IFarmable farmable : this.farmables) {
|
||||
final boolean success = this.housing.plantGermling(farmable, this.world, position.x, position.y, position.z);
|
||||
if (success && this.housing instanceof IOwnable) {
|
||||
final TileEntity tile = this.housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
try {
|
||||
final IOwnable housing2 = (IOwnable) this.housing;
|
||||
GameProfile prof = null;
|
||||
if (Mods.Forestry.dev()) {
|
||||
prof = (GameProfile) IOwnable.class.getMethod("getOwner", new Class[0]).invoke(housing2, new Object[0]);
|
||||
}
|
||||
else {
|
||||
prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2, new Object[0]);
|
||||
}
|
||||
((TileEntityFlower) tile).setOwner(prof);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAcid() {
|
||||
for (final ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAlkaline() {
|
||||
for (final ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected boolean maintainCrops(final BlockPos pos, final FarmDirection direction, final int extent) {
|
||||
// for (int i = 0; i < extent; ++i) {
|
||||
// final Vect position = this.translateWithOffset(pos, direction, i);
|
||||
// if (this.isAirBlock(position) || this.world.getBlockState(pos).getBlock().isReplaceable(this.world, position.x, position.y, position.z)) {
|
||||
// final ItemStack below = this.getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||
// if (Gardening.isSoil(below.getItem())) {
|
||||
// return this.trySetCrop(position);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setData(final EnumMoisture moisture2, final EnumAcidity acidity2, final boolean isManual, final boolean isFertilised, final ItemStack icon2, final String name2) {
|
||||
this.moisture = moisture2;
|
||||
this.acidity = acidity2;
|
||||
this.isManual = isManual;
|
||||
this.fertilised = isFertilised;
|
||||
this.icon = icon2;
|
||||
this.name = name2;
|
||||
}
|
||||
private boolean trySetCrop(final Vect position) {
|
||||
// for (final IFarmable farmable : this.farmables) {
|
||||
// final boolean success = this.housing.plantGermling(farmable, this.world, position.x, position.y, position.z);
|
||||
// if (success && this.housing instanceof IOwnable) {
|
||||
// final TileEntity tile = this.housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||
// if (tile instanceof TileEntityFlower) {
|
||||
// try {
|
||||
// final IOwnable housing2 = (IOwnable) this.housing;
|
||||
// GameProfile prof = null;
|
||||
// if (Mods.Forestry.dev()) {
|
||||
// prof = (GameProfile) IOwnable.class.getMethod("getOwner", new Class[0]).invoke(housing2, new Object[0]);
|
||||
// }
|
||||
// else {
|
||||
// prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2, new Object[0]);
|
||||
// }
|
||||
// ((TileEntityFlower) tile).setOwner(prof);
|
||||
// } catch (Exception ex) {
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAcid() {
|
||||
for (final ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack getAvailableAlkaline() {
|
||||
for (final ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setData(final EnumMoisture moisture2, final EnumAcidity acidity2, final boolean isManual, final boolean isFertilised, final ItemStack icon2, final String name2) {
|
||||
this.moisture = moisture2;
|
||||
this.acidity = acidity2;
|
||||
this.isManual = isManual;
|
||||
this.fertilised = isFertilised;
|
||||
this.icon = icon2;
|
||||
this.name = name2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +1,74 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.farm;
|
||||
|
||||
public class Vect
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public class Vect {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public Vect(final int[] dim) {
|
||||
if (dim.length != 3) {
|
||||
throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points.");
|
||||
}
|
||||
this.x = dim[0];
|
||||
this.y = dim[1];
|
||||
this.z = dim[2];
|
||||
}
|
||||
public Vect(final int[] dim) {
|
||||
if (dim.length != 3) {
|
||||
throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points.");
|
||||
}
|
||||
this.x = dim[0];
|
||||
this.y = dim[1];
|
||||
this.z = dim[2];
|
||||
}
|
||||
|
||||
public Vect(final int x, final int y, final int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public Vect(final int x, final int y, final int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public Vect add(final Vect other) {
|
||||
final Vect vect;
|
||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
||||
vect.x += other.x;
|
||||
final Vect vect2 = result;
|
||||
vect2.y += other.y;
|
||||
final Vect vect3 = result;
|
||||
vect3.z += other.z;
|
||||
return result;
|
||||
}
|
||||
public Vect add(final Vect other) {
|
||||
final Vect vect;
|
||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
||||
vect.x += other.x;
|
||||
final Vect vect2 = result;
|
||||
vect2.y += other.y;
|
||||
final Vect vect3 = result;
|
||||
vect3.z += other.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Vect multiply(final float factor) {
|
||||
final Vect vect;
|
||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
||||
vect.x *= (int) factor;
|
||||
final Vect vect2 = result;
|
||||
vect2.y *= (int) factor;
|
||||
final Vect vect3 = result;
|
||||
vect3.z *= (int) factor;
|
||||
return result;
|
||||
}
|
||||
public Vect multiply(final float factor) {
|
||||
final Vect vect;
|
||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
||||
vect.x *= (int) factor;
|
||||
final Vect vect2 = result;
|
||||
vect2.y *= (int) factor;
|
||||
final Vect vect3 = result;
|
||||
vect3.z *= (int) factor;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%sx%sx%s;", this.x, this.y, this.z);
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%sx%sx%s;", this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = 31 * result + this.x;
|
||||
result = 31 * result + this.y;
|
||||
result = 31 * result + this.z;
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = 31 * result + this.x;
|
||||
result = 31 * result + this.y;
|
||||
result = 31 * result + this.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Vect other = (Vect) obj;
|
||||
return this.x == other.x && this.y == other.y && this.z == other.z;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final Vect other = (Vect) obj;
|
||||
return this.x == other.x && this.y == other.y && this.z == other.z;
|
||||
}
|
||||
}
|
||||
@@ -1,202 +1,174 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.gardening.Gardening;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
public class BlockFlower extends BlockContainer
|
||||
{
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
public class BlockFlower extends BlockContainer {
|
||||
// @Override
|
||||
// public int getRenderType() {
|
||||
// return RendererBotany.renderID;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister par1IconRegister) {
|
||||
// for (final EnumFlowerType type : EnumFlowerType.values()) {
|
||||
// type.registerIcons(par1IconRegister);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister par1IconRegister) {
|
||||
for (final EnumFlowerType type : EnumFlowerType.values()) {
|
||||
type.registerIcons(par1IconRegister);
|
||||
}
|
||||
}
|
||||
public BlockFlower() {
|
||||
super(Material.PLANTS);
|
||||
final float f = 0.2f;
|
||||
//this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||
this.setTickRandomly(true);
|
||||
this.setRegistryName("flower");
|
||||
}
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.plants);
|
||||
final float f = 0.2f;
|
||||
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockName("flower");
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
// @Override
|
||||
// public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) {
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public boolean isOpaqueCube() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderAsNormalBlock() {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) {
|
||||
// super.onBlockPlacedBy(world, x, y, z, living, stack);
|
||||
// final TileEntity flower = world.getTileEntity(x, y, z);
|
||||
// if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
// if (flower != null && flower instanceof TileEntityFlower) {
|
||||
// final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
// ((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// final 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 {
|
||||
// final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null;
|
||||
// ((TileEntityFlower) flower).create(stack, owner);
|
||||
// }
|
||||
// }
|
||||
// Gardening.tryGrowSection(world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
// if (tile instanceof TileEntityFlower) {
|
||||
// final TileEntityFlower f = (TileEntityFlower) tile;
|
||||
// final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
// final IFlowerType flower = f.getType();
|
||||
// final int section = f.getRenderSection();
|
||||
// final boolean flowered = f.isFlowered();
|
||||
// return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section));
|
||||
// }
|
||||
// return super.getIcon(world, x, y, z, side);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
// final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
// if (tile instanceof TileEntityFlower) {
|
||||
// final TileEntityFlower f = (TileEntityFlower) tile;
|
||||
// return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour());
|
||||
// }
|
||||
// return 16777215;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, living, stack);
|
||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
return;
|
||||
}
|
||||
final 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 {
|
||||
final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
Gardening.tryGrowSection(world, x, y, z);
|
||||
}
|
||||
// @Override
|
||||
// public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) {
|
||||
// return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
||||
final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
final IFlowerType flower = f.getType();
|
||||
final int section = f.getRenderSection();
|
||||
final boolean flowered = f.isFlowered();
|
||||
return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section));
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
// protected boolean canPlaceBlockOn(final Block block) {
|
||||
// return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
||||
return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour());
|
||||
}
|
||||
return 16777215;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) {
|
||||
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(final Block block) {
|
||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
|
||||
super.onNeighborBlockChange(world, x, y, z, block);
|
||||
this.checkAndDropBlock(world, x, y, z);
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
final 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) {
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(final World world, final int x, final int y, final int z, final Random rand) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
this.checkAndDropBlock(world, x, y, z);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(final World world, final int x, final int y, final int z) {
|
||||
if (!this.canBlockStay(world, x, y, z)) {
|
||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(final World world, final int x, final int y, final int z) {
|
||||
final 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 this.canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
final ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
final ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (flower != null) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
final List<ItemStack> drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
final boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (final ItemStack drop : drops) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
// @Override
|
||||
// public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
|
||||
// super.onNeighborBlockChange(world, x, y, z, block);
|
||||
// this.checkAndDropBlock(world, x, y, z);
|
||||
// final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
// if (tile instanceof TileEntityFlower) {
|
||||
// final 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) {
|
||||
// this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
// world.setBlockToAir(x, y, z);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateTick(final World world, final int x, final int y, final int z, final Random rand) {
|
||||
// final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
// if (tile instanceof TileEntityFlower) {
|
||||
// ((TileEntityFlower) tile).randomUpdate(rand);
|
||||
// this.checkAndDropBlock(world, x, y, z);
|
||||
// return;
|
||||
// }
|
||||
// world.setBlockToAir(x, y, z);
|
||||
// }
|
||||
//
|
||||
// protected void checkAndDropBlock(final World world, final int x, final int y, final int z) {
|
||||
// if (!this.canBlockStay(world, x, y, z)) {
|
||||
// this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
// world.setBlockToAir(x, y, z);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canBlockStay(final World world, final int x, final int y, final int z) {
|
||||
// final 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 this.canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
// final ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
// final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
// if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
// final ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
// if (flower != null) {
|
||||
// drops.add(flower);
|
||||
// }
|
||||
// }
|
||||
// return drops;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
// final List<ItemStack> drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
// final boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||
// if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
// for (final ItemStack drop : drops) {
|
||||
// this.dropBlockAsItem(world, x, y, z, drop);
|
||||
// }
|
||||
// }
|
||||
// return hasBeenBroken;
|
||||
// }
|
||||
}
|
||||
@@ -1,288 +1,267 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.Botany;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.Flower;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Config;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.genetics.Flower;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.botany.api.IFlower;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class ItemBotany extends Item
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
import java.util.List;
|
||||
|
||||
public ItemBotany(final String name) {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName(name);
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
public abstract class ItemBotany extends Item {
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getSpriteNumber() {
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
public ItemBotany(final String name) {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isDamageable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||
}
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(final ItemStack itemstack, final EntityPlayer player, final List list, final boolean flag) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return;
|
||||
}
|
||||
final IFlower individual = (IFlower) this.getIndividual(itemstack);
|
||||
if (individual == null) {
|
||||
list.add("This item is bugged. Destroy it!");
|
||||
return;
|
||||
}
|
||||
list.add("§e" + individual.getGenome().getPrimaryColor().getName() + ((individual.getGenome().getPrimaryColor() == individual.getGenome().getSecondaryColor()) ? "" : (" and " + individual.getGenome().getSecondaryColor().getName())) + ", " + individual.getGenome().getStemColor().getName() + " Stem");
|
||||
if (individual.isAnalyzed()) {
|
||||
if (BinnieCore.proxy.isShiftDown()) {
|
||||
individual.addTooltip(list);
|
||||
}
|
||||
else {
|
||||
list.add("§o<Hold shift for details>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
list.add("<Unknown>");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean hasEffect(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return false;
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public void addInformation(final ItemStack itemstack, final EntityPlayer player, final List list, final boolean flag) {
|
||||
// if (!itemstack.hasTagCompound()) {
|
||||
// return;
|
||||
// }
|
||||
// final IFlower individual = (IFlower) this.getIndividual(itemstack);
|
||||
// if (individual == null) {
|
||||
// list.add("This item is bugged. Destroy it!");
|
||||
// return;
|
||||
// }
|
||||
// list.add("§e" + individual.getGenome().getPrimaryColor().getName() + ((individual.getGenome().getPrimaryColor() == individual.getGenome().getSecondaryColor()) ? "" : (" and " + individual.getGenome().getSecondaryColor().getName())) + ", " + individual.getGenome().getStemColor().getName() + " Stem");
|
||||
// if (individual.isAnalyzed()) {
|
||||
// if (BinnieCore.proxy.isShiftDown()) {
|
||||
// individual.addTooltip(list);
|
||||
// }
|
||||
// else {
|
||||
// list.add("§o<Hold shift for details>");
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// list.add("<Unknown>");
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister par1IconRegister) {
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister par1IconRegister) {
|
||||
// }
|
||||
|
||||
protected IIndividual getIndividual(final ItemStack itemstack) {
|
||||
return new Flower(itemstack.getTagCompound());
|
||||
}
|
||||
protected IIndividual getIndividual(final ItemStack itemstack) {
|
||||
return new Flower(itemstack.getTagCompound());
|
||||
}
|
||||
|
||||
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
|
||||
final IFlower tree = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (tree == null) {
|
||||
return (IAlleleFlowerSpecies) BotanyCore.speciesRoot.getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
||||
}
|
||||
return tree.getGenome().getPrimary();
|
||||
}
|
||||
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
|
||||
final IFlower tree = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (tree == null) {
|
||||
return (IAlleleFlowerSpecies) BotanyCore.speciesRoot.getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
||||
}
|
||||
return tree.getGenome().getPrimary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return "Unknown";
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + this.getTag()) : "Corrupted Flower";
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack itemstack) {
|
||||
if (!itemstack.hasTagCompound()) {
|
||||
return "Unknown";
|
||||
}
|
||||
final IIndividual individual = this.getIndividual(itemstack);
|
||||
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + this.getTag()) : "Corrupted Flower";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
this.addCreativeItems(itemList, true);
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
|
||||
this.addCreativeItems(itemList, true);
|
||||
}
|
||||
|
||||
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
|
||||
for (final IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
}
|
||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), this.getStage().ordinal()));
|
||||
}
|
||||
}
|
||||
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
|
||||
for (final IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||
continue;
|
||||
}
|
||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), this.getStage()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(final ItemStack itemstack, final int renderPass) {
|
||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return 16777215;
|
||||
}
|
||||
return (renderPass == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()));
|
||||
}
|
||||
// @Override
|
||||
// public int getColorFromItemStack(final ItemStack itemstack, final int renderPass) {
|
||||
// final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
// if (flower == null || flower.getGenome() == null) {
|
||||
// return 16777215;
|
||||
// }
|
||||
// return (renderPass == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((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(final int metadata) {
|
||||
// return 3;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final ItemStack itemstack, final int renderPass) {
|
||||
// final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
// if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
// return EnumFlowerType.Allium.getBlank();
|
||||
// }
|
||||
// final IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||
// if (renderPass == 0) {
|
||||
// return type.getStem(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
// }
|
||||
// if (renderPass == 1) {
|
||||
// return type.getPetalIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
// }
|
||||
// return type.getVariantIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(final int metadata) {
|
||||
return 3;
|
||||
}
|
||||
// @Override
|
||||
// public boolean onItemUse(final ItemStack itemstack, final EntityPlayer player, final World world, int x, int y, int z, int side, final float px, final float py, final float pz) {
|
||||
// if (this.getStage() == EnumFlowerStage.POLLEN) {
|
||||
// final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||
// final TileEntity target = world.getTileEntity(x, y, z);
|
||||
// if (!(target instanceof IPollinatable)) {
|
||||
// return false;
|
||||
// }
|
||||
// final IPollinatable pollinatable = (IPollinatable) target;
|
||||
// if (!pollinatable.canMateWith(flower)) {
|
||||
// return false;
|
||||
// }
|
||||
// pollinatable.mateWith(flower);
|
||||
// if (!player.capabilities.isCreativeMode) {
|
||||
// --itemstack.stackSize;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// else {
|
||||
// final Block blockFlower = Botany.flower;
|
||||
// final 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;
|
||||
// }
|
||||
// if (side == 1) {
|
||||
// ++y;
|
||||
// }
|
||||
// if (side == 2) {
|
||||
// --z;
|
||||
// }
|
||||
// if (side == 3) {
|
||||
// ++z;
|
||||
// }
|
||||
// if (side == 4) {
|
||||
// --x;
|
||||
// }
|
||||
// if (side == 5) {
|
||||
// ++x;
|
||||
// }
|
||||
// }
|
||||
// if (itemstack.stackSize == 0) {
|
||||
// return false;
|
||||
// }
|
||||
// if (!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)) {
|
||||
// final int i1 = this.getMetadata(itemstack.getItemDamage());
|
||||
// final int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||
// if (this.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;
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final ItemStack itemstack, final int renderPass) {
|
||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||
return EnumFlowerType.Allium.getBlank();
|
||||
}
|
||||
final IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||
if (renderPass == 0) {
|
||||
return type.getStem(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return type.getPetalIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
return type.getVariantIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||
}
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public boolean func_150936_a(final World p_150936_1_, int p_150936_2_, int p_150936_3_, int p_150936_4_, int p_150936_5_, final EntityPlayer p_150936_6_, final ItemStack p_150936_7_) {
|
||||
// final Block field_150939_a = Botany.flower;
|
||||
// final Block block = p_150936_1_.getBlock(p_150936_2_, p_150936_3_, p_150936_4_);
|
||||
// if (block == Blocks.snow_layer) {
|
||||
// p_150936_5_ = 1;
|
||||
// }
|
||||
// else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) {
|
||||
// if (p_150936_5_ == 0) {
|
||||
// --p_150936_3_;
|
||||
// }
|
||||
// if (p_150936_5_ == 1) {
|
||||
// ++p_150936_3_;
|
||||
// }
|
||||
// if (p_150936_5_ == 2) {
|
||||
// --p_150936_4_;
|
||||
// }
|
||||
// if (p_150936_5_ == 3) {
|
||||
// ++p_150936_4_;
|
||||
// }
|
||||
// if (p_150936_5_ == 4) {
|
||||
// --p_150936_2_;
|
||||
// }
|
||||
// if (p_150936_5_ == 5) {
|
||||
// ++p_150936_2_;
|
||||
// }
|
||||
// }
|
||||
// return p_150936_1_.canPlaceEntityOnSide(field_150939_a, p_150936_2_, p_150936_3_, p_150936_4_, false, p_150936_5_, (Entity) null, p_150936_7_);
|
||||
// }
|
||||
//
|
||||
// public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
||||
// final Block field_150939_a = Botany.flower;
|
||||
// if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
|
||||
// return false;
|
||||
// }
|
||||
// if (world.getBlock(x, y, z) == field_150939_a) {
|
||||
// field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
// field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack itemstack, final EntityPlayer player, final World world, int x, int y, int z, int side, final float px, final float py, final float pz) {
|
||||
if (this.getStage() == EnumFlowerStage.POLLEN) {
|
||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||
final TileEntity target = world.getTileEntity(x, y, z);
|
||||
if (!(target instanceof IPollinatable)) {
|
||||
return false;
|
||||
}
|
||||
final IPollinatable pollinatable = (IPollinatable) target;
|
||||
if (!pollinatable.canMateWith(flower)) {
|
||||
return false;
|
||||
}
|
||||
pollinatable.mateWith(flower);
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
--itemstack.stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
final Block blockFlower = Botany.flower;
|
||||
final 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;
|
||||
}
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
}
|
||||
if (itemstack.stackSize == 0) {
|
||||
return false;
|
||||
}
|
||||
if (!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)) {
|
||||
final int i1 = this.getMetadata(itemstack.getItemDamage());
|
||||
final int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||
if (this.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;
|
||||
}
|
||||
}
|
||||
public abstract EnumFlowerStage getStage();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean func_150936_a(final World p_150936_1_, int p_150936_2_, int p_150936_3_, int p_150936_4_, int p_150936_5_, final EntityPlayer p_150936_6_, final ItemStack p_150936_7_) {
|
||||
final Block field_150939_a = Botany.flower;
|
||||
final Block block = p_150936_1_.getBlock(p_150936_2_, p_150936_3_, p_150936_4_);
|
||||
if (block == Blocks.snow_layer) {
|
||||
p_150936_5_ = 1;
|
||||
}
|
||||
else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) {
|
||||
if (p_150936_5_ == 0) {
|
||||
--p_150936_3_;
|
||||
}
|
||||
if (p_150936_5_ == 1) {
|
||||
++p_150936_3_;
|
||||
}
|
||||
if (p_150936_5_ == 2) {
|
||||
--p_150936_4_;
|
||||
}
|
||||
if (p_150936_5_ == 3) {
|
||||
++p_150936_4_;
|
||||
}
|
||||
if (p_150936_5_ == 4) {
|
||||
--p_150936_2_;
|
||||
}
|
||||
if (p_150936_5_ == 5) {
|
||||
++p_150936_2_;
|
||||
}
|
||||
}
|
||||
return p_150936_1_.canPlaceEntityOnSide(field_150939_a, p_150936_2_, p_150936_3_, p_150936_4_, false, p_150936_5_, (Entity) null, p_150936_7_);
|
||||
}
|
||||
|
||||
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
||||
final Block field_150939_a = Botany.flower;
|
||||
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == field_150939_a) {
|
||||
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract EnumFlowerStage getStage();
|
||||
|
||||
public abstract String getTag();
|
||||
public abstract String getTag();
|
||||
}
|
||||
@@ -1,24 +1,19 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemFlower extends ItemBotany
|
||||
{
|
||||
public ItemFlower() {
|
||||
super("itemFlower");
|
||||
}
|
||||
public class ItemFlower extends ItemBotany {
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
@@ -1,173 +1,166 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemInsulatedTube extends Item
|
||||
{
|
||||
IIcon[] icons;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List p_150895_3_) {
|
||||
for (final Material mat : Material.values()) {
|
||||
for (final Insulate ins : Insulate.values()) {
|
||||
p_150895_3_.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
}
|
||||
public class ItemInsulatedTube extends Item {
|
||||
// IIcon[] icons;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
this.icons[i] = Botany.proxy.getIcon(p_94581_1_, "insulatedTube." + i);
|
||||
}
|
||||
}
|
||||
public ItemInsulatedTube() {
|
||||
setRegistryName("insulatedTube");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int pass) {
|
||||
return (pass == 0) ? 16777215 : ((pass == 1) ? Material.get(stack.getItemDamage()).getColor() : Insulate.get(stack.getItemDamage()).getColor());
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List p_150895_3_) {
|
||||
for (final Material mat : Material.values()) {
|
||||
for (final Insulate ins : Insulate.values()) {
|
||||
p_150895_3_.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack p_77624_1_, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
||||
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
|
||||
p_77624_3_.add(Insulate.get(p_77624_1_.getItemDamage()).getName());
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister p_94581_1_) {
|
||||
// for (int i = 0; i < 3; ++i) {
|
||||
// this.icons[i] = Botany.proxy.getIcon(p_94581_1_, "insulatedTube." + i);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getColorFromItemStack(final ItemStack stack, final int pass) {
|
||||
// return (pass == 0) ? 16777215 : ((pass == 1) ? Material.get(stack.getItemDamage()).getColor() : Insulate.get(stack.getItemDamage()).getColor());
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
|
||||
return Material.get(p_77653_1_.getItemDamage()).getName() + " Insulated Tube";
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack p_77624_1_, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
||||
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
|
||||
p_77624_3_.add(Insulate.get(p_77624_1_.getItemDamage()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderPasses(final int metadata) {
|
||||
return 3;
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
|
||||
return Material.get(p_77653_1_.getItemDamage()).getName() + " Insulated Tube";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final ItemStack stack, final int pass) {
|
||||
return this.icons[pass % 3];
|
||||
}
|
||||
// @Override
|
||||
// public int getRenderPasses(final int metadata) {
|
||||
// return 3;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getIcon(final ItemStack stack, final int pass) {
|
||||
// return this.icons[pass % 3];
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean requiresMultipleRenderPasses() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public ItemInsulatedTube() {
|
||||
// this.icons = new IIcon[3];
|
||||
// this.setUnlocalizedName("insulatedTube");
|
||||
// this.setCreativeTab(CreativeTabBotany.instance);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return true;
|
||||
}
|
||||
public static String getInsulate(final ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getName();
|
||||
}
|
||||
|
||||
public ItemInsulatedTube() {
|
||||
this.icons = new IIcon[3];
|
||||
this.setUnlocalizedName("insulatedTube");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
public static ItemStack getInsulateStack(final ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
|
||||
public static String getInsulate(final ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getName();
|
||||
}
|
||||
enum Material {
|
||||
Copper(14923662, "Copper"),
|
||||
Tin(14806772, "Tin"),
|
||||
Bronze(14533238, "Bronze"),
|
||||
Iron(14211288, "Iron");
|
||||
|
||||
public static ItemStack getInsulateStack(final ItemStack stack) {
|
||||
return Insulate.get(stack.getItemDamage()).getStack();
|
||||
}
|
||||
int color;
|
||||
String name;
|
||||
|
||||
enum Material
|
||||
{
|
||||
Copper(14923662, "Copper"),
|
||||
Tin(14806772, "Tin"),
|
||||
Bronze(14533238, "Bronze"),
|
||||
Iron(14211288, "Iron");
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
int color;
|
||||
String name;
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
private Material(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public static Material get(final int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
}
|
||||
|
||||
private Material(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
enum Insulate {
|
||||
Clay(10595020, "Clay"),
|
||||
Cobble(8092539, "Cobblestone"),
|
||||
Sand(15723189, "Sand"),
|
||||
HardenedClay(9657411, "Hardened Clay"),
|
||||
Stone(7171437, "Smooth Stone"),
|
||||
Sandstone(12695945, "Sandstone");
|
||||
|
||||
public static Material get(final int i) {
|
||||
return values()[i % values().length];
|
||||
}
|
||||
}
|
||||
int color;
|
||||
String name;
|
||||
|
||||
enum Insulate
|
||||
{
|
||||
Clay(10595020, "Clay"),
|
||||
Cobble(8092539, "Cobblestone"),
|
||||
Sand(15723189, "Sand"),
|
||||
HardenedClay(9657411, "Hardened Clay"),
|
||||
Stone(7171437, "Smooth Stone"),
|
||||
Sandstone(12695945, "Sandstone");
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
int color;
|
||||
String name;
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this.color;
|
||||
}
|
||||
private Insulate(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
public static Insulate get(final int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
|
||||
private Insulate(final int color, final String name) {
|
||||
this.color = color;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Insulate get(final int i) {
|
||||
return values()[i / 128 % values().length];
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay: {
|
||||
return new ItemStack(Blocks.clay);
|
||||
}
|
||||
case Cobble: {
|
||||
return new ItemStack(Blocks.cobblestone);
|
||||
}
|
||||
case HardenedClay: {
|
||||
return new ItemStack(Blocks.hardened_clay);
|
||||
}
|
||||
case Sand: {
|
||||
return new ItemStack(Blocks.sand);
|
||||
}
|
||||
case Sandstone: {
|
||||
return new ItemStack(Blocks.sandstone);
|
||||
}
|
||||
case Stone: {
|
||||
return new ItemStack(Blocks.stone);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public ItemStack getStack() {
|
||||
switch (this) {
|
||||
case Clay: {
|
||||
return new ItemStack(Blocks.CLAY);
|
||||
}
|
||||
case Cobble: {
|
||||
return new ItemStack(Blocks.COBBLESTONE);
|
||||
}
|
||||
case HardenedClay: {
|
||||
return new ItemStack(Blocks.HARDENED_CLAY);
|
||||
}
|
||||
case Sand: {
|
||||
return new ItemStack(Blocks.SAND);
|
||||
}
|
||||
case Sandstone: {
|
||||
return new ItemStack(Blocks.SANDSTONE);
|
||||
}
|
||||
case Stone: {
|
||||
return new ItemStack(Blocks.STONE);
|
||||
}
|
||||
default: {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,19 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemPollen extends ItemBotany
|
||||
{
|
||||
public ItemPollen() {
|
||||
super("pollen");
|
||||
}
|
||||
public class ItemPollen extends ItemBotany {
|
||||
public ItemPollen() {
|
||||
super("pollen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.POLLEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Pollen";
|
||||
}
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Pollen";
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,19 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
public class ItemSeed extends ItemBotany
|
||||
{
|
||||
public ItemSeed() {
|
||||
super("seed");
|
||||
}
|
||||
public class ItemSeed extends ItemBotany {
|
||||
public ItemSeed() {
|
||||
super("seed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStage() {
|
||||
return EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Germling";
|
||||
}
|
||||
@Override
|
||||
public String getTag() {
|
||||
return " Germling";
|
||||
}
|
||||
}
|
||||
@@ -1,66 +1,54 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.flower;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class RendererBotany implements ISimpleBlockRenderingHandler
|
||||
public class RendererBotany// implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int renderID;
|
||||
public static int pass;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||
double d1 = x;
|
||||
final 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;
|
||||
final int rot = (int) (i1 % 4L);
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
RendererBotany.pass = j;
|
||||
final 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) {
|
||||
final float f4 = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||
final float f5 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||
final float f6 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||
f = f4;
|
||||
f2 = f5;
|
||||
f3 = f6;
|
||||
}
|
||||
tessellator.setColorOpaque_F(f, f2, f3);
|
||||
final IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory(final int i) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return RendererBotany.renderID;
|
||||
}
|
||||
// public static int renderID;
|
||||
// public static int pass;
|
||||
//
|
||||
// @Override
|
||||
// public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
||||
// final Tessellator tessellator = Tessellator.instance;
|
||||
// tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||
// double d1 = x;
|
||||
// final 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;
|
||||
// final int rot = (int) (i1 % 4L);
|
||||
// for (int j = 0; j < 3; ++j) {
|
||||
// RendererBotany.pass = j;
|
||||
// final 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) {
|
||||
// final float f4 = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||
// final float f5 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||
// final float f6 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||
// f = f4;
|
||||
// f2 = f5;
|
||||
// f3 = f6;
|
||||
// }
|
||||
// tessellator.setColorOpaque_F(f, f2, f3);
|
||||
// final IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||
// renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldRender3DInInventory(final int i) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getRenderId() {
|
||||
// return RendererBotany.renderID;
|
||||
// }
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,156 +1,147 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import java.util.Random;
|
||||
import java.util.List;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.block.Block;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPlant extends BlockBush
|
||||
{
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) {
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister p_149651_1_) {
|
||||
for (final Type t : Type.values()) {
|
||||
t.icon = Botany.proxy.getIcon(p_149651_1_, t.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
public class BlockPlant extends BlockBush {
|
||||
public static final PropertyEnum<Type> PLANT_TYPE = PropertyEnum.create("plant_type", Type.class);
|
||||
|
||||
public BlockPlant() {
|
||||
this.setBlockName("plant");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canPlaceBlockOn(final Block p_149854_1_) {
|
||||
return super.canPlaceBlockOn(p_149854_1_) || Gardening.isSoil(p_149854_1_);
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister p_149651_1_) {
|
||||
// for (final Type t : Type.values()) {
|
||||
// t.icon = Botany.proxy.getIcon(p_149651_1_, t.name().toLowerCase());
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final int side, final int meta) {
|
||||
return Type.values()[meta % Type.values().length].icon;
|
||||
}
|
||||
public BlockPlant() {
|
||||
this.setRegistryName("plant");
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setTickRandomly(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(final int p_149692_1_) {
|
||||
return p_149692_1_;
|
||||
}
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(worldIn, pos) || Gardening.isSoil(worldIn.getBlockState(pos).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List p_149666_3_) {
|
||||
for (final Type type : Type.values()) {
|
||||
p_149666_3_.add(type.get());
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final int side, final int meta) {
|
||||
// return Type.values()[meta % Type.values().length].icon;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
||||
final 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);
|
||||
}
|
||||
}
|
||||
final Block below = world.getBlock(x, y - 1, z);
|
||||
if (Gardening.isSoil(below)) {
|
||||
final IBlockSoil soil = (IBlockSoil) below;
|
||||
if (random.nextInt(3) == 0) {
|
||||
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 int damageDropped(final int p_149692_1_) {
|
||||
// return p_149692_1_;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List p_149666_3_) {
|
||||
for (final Type type : Type.values()) {
|
||||
p_149666_3_.add(type.get());
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWeed(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||
}
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
final Type type = state.getValue(PLANT_TYPE);
|
||||
if (world.rand.nextInt(4) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsLong), 2);
|
||||
} else if (type == Type.WeedsLong) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsVeryLong), 2);
|
||||
} else if (type == Type.DeadFlower) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.DecayingFlower), 2);
|
||||
} else if (type == Type.DecayingFlower) {
|
||||
world.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (world.rand.nextInt(6) == 0) {
|
||||
if (type == Type.Weeds) {
|
||||
world.setBlockToAir(pos);
|
||||
} else if (type == Type.WeedsLong) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.Weeds), 2);
|
||||
} else if (type == Type.WeedsVeryLong) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsLong), 2);
|
||||
}
|
||||
}
|
||||
final Block below = world.getBlockState(pos.down()).getBlock();
|
||||
if (Gardening.isSoil(below)) {
|
||||
// final IBlockSoil soil = (IBlockSoil) below;
|
||||
// if (world.rand.nextInt(3) == 0) {
|
||||
// if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
||||
// if (!soil.degrade(world, pos.down(), EnumSoilType.LOAM)) {
|
||||
// soil.degrade(world, pos.down(), EnumSoilType.SOIL);
|
||||
// }
|
||||
// } else if (type == Type.DecayingFlower && !soil.fertilise(world, pos.down(), EnumSoilType.LOAM)) {
|
||||
// soil.fertilise(world, pos.down(), EnumSoilType.FLOWERBED);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public enum Type
|
||||
{
|
||||
Weeds("Weeds"),
|
||||
WeedsLong("Long Weeds"),
|
||||
WeedsVeryLong("Very Long Weeds"),
|
||||
DeadFlower("Dead Flower"),
|
||||
DecayingFlower("Decaying Flower");
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public IIcon icon;
|
||||
String name;
|
||||
public static boolean isWeed(final IBlockAccess world, final BlockPos pos) {
|
||||
if (!(world.getBlockState(pos).getBlock() instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
final Type type = world.getBlockState(pos).getValue(PLANT_TYPE);
|
||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
||||
}
|
||||
|
||||
private Type(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public enum Type implements IStringSerializable {
|
||||
Weeds("Weeds"),
|
||||
WeedsLong("Long Weeds"),
|
||||
WeedsVeryLong("Very Long Weeds"),
|
||||
DeadFlower("Dead Flower"),
|
||||
DecayingFlower("Decaying Flower");
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
||||
}
|
||||
// public IIcon icon;
|
||||
String name;
|
||||
|
||||
public static Type get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
private Type(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
public ItemStack get() {
|
||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
||||
}
|
||||
|
||||
public static Type get(final int id) {
|
||||
return values()[id % values().length];
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,220 +1,234 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import binnie.Binnie;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import java.util.Random;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.block.material.Material;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil
|
||||
{
|
||||
boolean weedKilled;
|
||||
IIcon[] iconsTop;
|
||||
IIcon[] iconsSide;
|
||||
IIcon[] iconsNoWeed;
|
||||
EnumSoilType type;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
public class BlockSoil extends Block implements IBlockSoil {
|
||||
boolean weedKilled;
|
||||
// IIcon[] iconsTop;
|
||||
// IIcon[] iconsSide;
|
||||
// IIcon[] iconsNoWeed;
|
||||
EnumSoilType type;
|
||||
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
|
||||
public static final PropertyEnum<EnumAcidity> ACIDITY = PropertyEnum.create("acidity", EnumAcidity.class);
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
return this.getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
par3List.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final int side, int meta) {
|
||||
meta = ((meta >= 9) ? 8 : meta);
|
||||
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
return (side == 1) ? (this.weedKilled ? this.iconsNoWeed[meta] : this.iconsTop[meta]) : ((side == 0) ? Blocks.dirt.getIcon(side, 0) : this.iconsSide[meta]);
|
||||
}
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, MOISTURE, ACIDITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
for (final EnumMoisture moisture : EnumMoisture.values()) {
|
||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
||||
this.iconsTop[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".0");
|
||||
this.iconsSide[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".1");
|
||||
this.iconsNoWeed[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return getMeta(state.getValue(ACIDITY), state.getValue(MOISTURE));
|
||||
}
|
||||
|
||||
public EnumSoilType getType() {
|
||||
return this.type;
|
||||
}
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
return getDefaultState().withProperty(MOISTURE, moisture).withProperty(ACIDITY, acidity);
|
||||
}
|
||||
|
||||
public BlockSoil(final EnumSoilType type, final String blockName, final boolean weedKilled) {
|
||||
super(Material.ground);
|
||||
this.weedKilled = false;
|
||||
this.iconsTop = new IIcon[9];
|
||||
this.iconsSide = new IIcon[9];
|
||||
this.iconsNoWeed = new IIcon[9];
|
||||
this.weedKilled = weedKilled;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setBlockName(blockName);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||
this.setLightOpacity(255);
|
||||
this.setHardness(0.5f);
|
||||
this.setStepSound(Block.soundTypeGravel);
|
||||
this.type = type;
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
// return this.getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIcon(final int side, int meta) {
|
||||
// meta = ((meta >= 9) ? 8 : meta);
|
||||
// final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
// final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
// return (side == 1) ? (this.weedKilled ? this.iconsNoWeed[meta] : this.iconsTop[meta]) : ((side == 0) ? Blocks.dirt.getIcon(side, 0) : this.iconsSide[meta]);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerBlockIcons(final IIconRegister register) {
|
||||
// for (final EnumMoisture moisture : EnumMoisture.values()) {
|
||||
// for (final EnumAcidity pH : EnumAcidity.values()) {
|
||||
// this.iconsTop[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".0");
|
||||
// this.iconsSide[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".1");
|
||||
// this.iconsNoWeed[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".2");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int damageDropped(final int p_149692_1_) {
|
||||
return p_149692_1_;
|
||||
}
|
||||
public EnumSoilType getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
final 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);
|
||||
}
|
||||
final int meta2 = getMeta(acidity, moisture);
|
||||
if (meta != meta2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
||||
}
|
||||
if (!this.weedKilled && random.nextInt(5 - this.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);
|
||||
}
|
||||
}
|
||||
public BlockSoil(final EnumSoilType type, final String blockName, final boolean weedKilled) {
|
||||
super(Material.GROUND);
|
||||
this.weedKilled = false;
|
||||
// this.iconsTop = new IIcon[9];
|
||||
// this.iconsSide = new IIcon[9];
|
||||
// this.iconsNoWeed = new IIcon[9];
|
||||
this.weedKilled = weedKilled;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setRegistryName(blockName);
|
||||
this.setTickRandomly(true);
|
||||
//this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||
this.setLightOpacity(255);
|
||||
this.setHardness(0.5f);
|
||||
this.setSoundType(SoundType.GROUND);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) {
|
||||
return AxisAlignedBB.getBoundingBox(p_149668_2_ + 0, p_149668_3_ + 0, p_149668_4_ + 0, p_149668_2_ + 1, p_149668_3_ + 1, p_149668_4_ + 1);
|
||||
}
|
||||
// @Override
|
||||
// public int damageDropped(final int p_149692_1_) {
|
||||
// return p_149692_1_;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
||||
// final int meta = world.getBlockMetadata(x, y, z);
|
||||
// EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
// final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
// final 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);
|
||||
// }
|
||||
// final int meta2 = getMeta(acidity, moisture);
|
||||
// if (meta != meta2) {
|
||||
// world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
||||
// }
|
||||
// if (!this.weedKilled && random.nextInt(5 - this.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(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) {
|
||||
// return AxisAlignedBB.getBoundingBox(p_149668_2_ + 0, p_149668_3_ + 0, p_149668_4_ + 0, p_149668_2_ + 1, p_149668_3_ + 1, p_149668_4_ + 1);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean isOpaqueCube() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderAsNormalBlock() {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public EnumAcidity getPH(final World world, final BlockPos pos) {
|
||||
return world.getBlockState(pos).getValue(ACIDITY); //EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public EnumMoisture getMoisture(final World world, final BlockPos pos) {
|
||||
return world.getBlockState(pos).getValue(MOISTURE); //EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH(final World world, final int x, final int y, final int z) {
|
||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||
}
|
||||
@Override
|
||||
public EnumSoilType getType(final World world, final BlockPos pos) {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getMoisture(final World world, final int x, final int y, final int z) {
|
||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||
}
|
||||
@Override
|
||||
public boolean fertilise(final World world, final BlockPos pos, final EnumSoilType maxLevel) {
|
||||
final EnumSoilType type = this.getType(world, pos);
|
||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
final IBlockState old = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, Gardening.getSoilBlock(maxLevel, this.weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getType(final World world, final int x, final int y, final int z) {
|
||||
return this.type;
|
||||
}
|
||||
@Override
|
||||
public boolean degrade(final World world, final BlockPos pos, final EnumSoilType minLevel) {
|
||||
final EnumSoilType type = this.getType(world, pos);
|
||||
if (type.ordinal() <= minLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
final IBlockState old = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, Gardening.getSoilBlock(minLevel, this.weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fertilise(final World world, final int x, final int y, final int z, final EnumSoilType maxLevel) {
|
||||
final EnumSoilType type = this.getType(world, x, y, z);
|
||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, this.weedKilled), meta, 2);
|
||||
}
|
||||
@Override
|
||||
public boolean setPH(final World world, final BlockPos pos, final EnumAcidity pH) {
|
||||
//final int meta = getMeta(pH, this.getMoisture(world, pos));
|
||||
return world.setBlockState(pos, world.getBlockState(pos).withProperty(ACIDITY, pH));//world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean degrade(final World world, final int x, final int y, final int z, final EnumSoilType minLevel) {
|
||||
final EnumSoilType type = this.getType(world, x, y, z);
|
||||
if (type.ordinal() <= minLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, this.weedKilled), meta, 2);
|
||||
}
|
||||
@Override
|
||||
public boolean setMoisture(final World world, final BlockPos pos, final EnumMoisture moisture) {
|
||||
//final int meta = getMeta(this.getPH(world, x, y, z), moisture);
|
||||
return world.setBlockState(pos, world.getBlockState(pos).withProperty(MOISTURE, moisture));//return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPH(final World world, final int x, final int y, final int z, final EnumAcidity pH) {
|
||||
final int meta = getMeta(pH, this.getMoisture(world, x, y, z));
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setMoisture(final World world, final int x, final int y, final int z, final EnumMoisture moisture) {
|
||||
final int meta = getMeta(this.getPH(world, x, y, z), moisture);
|
||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||
}
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(world, pos, neighbor);
|
||||
if (world.isSideSolid(pos.up(), EnumFacing.DOWN, false)) {
|
||||
((World) world).setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
public static String getPH(final ItemStack stack) {
|
||||
return Binnie.Language.localise(EnumAcidity.values()[stack.getItemDamage() / 3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block p_149695_5_) {
|
||||
super.onNeighborBlockChange(world, x, y, z, p_149695_5_);
|
||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
||||
}
|
||||
}
|
||||
public static String getMoisture(final ItemStack stack) {
|
||||
return Binnie.Language.localise(EnumMoisture.values()[stack.getItemDamage() % 3]);
|
||||
}
|
||||
|
||||
public static String getPH(final ItemStack stack) {
|
||||
return Binnie.Language.localise(EnumAcidity.values()[stack.getItemDamage() / 3]);
|
||||
}
|
||||
// @Override
|
||||
// public boolean canSustainPlant(final IBlockAccess world, final BlockPos pos, final EnumFacing direction, final IPlantable plantable) {
|
||||
// final Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||
// if (plant == Botany.flower) {
|
||||
// return true;
|
||||
// }
|
||||
// if (plant == Botany.plant) {
|
||||
// return !this.weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||
// }
|
||||
// return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||
// }
|
||||
|
||||
public static String getMoisture(final ItemStack stack) {
|
||||
return Binnie.Language.localise(EnumMoisture.values()[stack.getItemDamage() % 3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection direction, final IPlantable plantable) {
|
||||
final Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||
if (plant == Botany.flower) {
|
||||
return true;
|
||||
}
|
||||
if (plant == Botany.plant) {
|
||||
return !this.weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||
}
|
||||
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resistsWeeds(final World world, final int x, final int y, final int z) {
|
||||
return this.weedKilled;
|
||||
}
|
||||
@Override
|
||||
public boolean resistsWeeds(final World world, final BlockPos pos) {
|
||||
return this.weedKilled;
|
||||
}
|
||||
}
|
||||
@@ -1,264 +1,258 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import java.util.Collection;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.Botany;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.api.IFlower;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.core.BinnieCore;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class Gardening
|
||||
{
|
||||
public static Map<ItemStack, Integer> fertiliserAcid;
|
||||
public static Map<ItemStack, Integer> fertiliserAlkaline;
|
||||
public static Map<ItemStack, Integer> fertiliserNutrient;
|
||||
public class Gardening {
|
||||
public static Map<ItemStack, Integer> fertiliserAcid;
|
||||
public static Map<ItemStack, Integer> fertiliserAlkaline;
|
||||
public static Map<ItemStack, Integer> fertiliserNutrient;
|
||||
|
||||
public static boolean isSoil(final Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
public static boolean isSoil(final Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
public static boolean isSoil(final Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
|
||||
}
|
||||
public static boolean isSoil(final Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
|
||||
}
|
||||
|
||||
public static boolean isSoil(final ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
public static boolean isSoil(final ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
|
||||
public static EnumMoisture getNaturalMoisture(final World world, final int x, final int y, final 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
|
||||
}
|
||||
// public static EnumMoisture getNaturalMoisture(final World world, final BlockPos pos) {
|
||||
// float bias = getBiomeMoisture(world.getBiome(pos), pos.getY());
|
||||
// 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;
|
||||
// }
|
||||
// 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;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
|
||||
// }
|
||||
|
||||
public static EnumAcidity getNaturalPH(final World world, final int x, final int y, final int z) {
|
||||
final float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
||||
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
|
||||
}
|
||||
public static EnumAcidity getNaturalPH(final World world, final BlockPos pos) {
|
||||
final float bias = getBiomePH(world.getBiome(pos), pos.getY());
|
||||
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
|
||||
}
|
||||
|
||||
public static float getBiomeMoisture(final BiomeGenBase biome, final int H) {
|
||||
final double R = biome.rainfall;
|
||||
final double T = biome.temperature;
|
||||
final 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);
|
||||
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
||||
}
|
||||
public static float getBiomeMoisture(final Biome biome, final int H) {
|
||||
final double R = biome.getRainfall();
|
||||
final double T = biome.getTemperature();
|
||||
final 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);
|
||||
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
||||
}
|
||||
|
||||
public static float getBiomePH(final BiomeGenBase biome, final int H) {
|
||||
final double R = biome.rainfall;
|
||||
final 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(final Biome biome, final int H) {
|
||||
final double R = biome.getRainfall();
|
||||
final double T = biome.getTemperature();
|
||||
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(final World world, final int x, final int y, final int z, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) {
|
||||
final int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
||||
}
|
||||
// public static void createSoil(final World world, final BlockPos pos, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) {
|
||||
// final int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||
// world.setBlockState(x, y, z, getSoilBlock(soil), meta, 2);
|
||||
// }
|
||||
|
||||
public static boolean plant(final World world, final int x, final int y, final int z, final IFlower flower, final GameProfile owner) {
|
||||
final boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
final TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||
final 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;
|
||||
}
|
||||
public static boolean plant(final World world, final BlockPos pos, final IFlower flower, final GameProfile owner) {
|
||||
final boolean set = world.setBlockState(pos, Botany.flower.getDefaultState());
|
||||
if (!set) {
|
||||
return false;
|
||||
}
|
||||
final TileEntity tileFlower = world.getTileEntity(pos);
|
||||
final TileEntity below = world.getTileEntity(pos.down());
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||
}
|
||||
}
|
||||
tryGrowSection(world, pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void tryGrowSection(final World world, final int x, final int y, final int z) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
final IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||
final int section = ((TileEntityFlower) flower).getSection();
|
||||
if (iflower != null && section < iflower.getGenome().getPrimary().getType().getSections() - 1 && iflower.getAge() > 0) {
|
||||
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
||||
final TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void tryGrowSection(final World world, final BlockPos pos) {
|
||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||
return;
|
||||
}
|
||||
final TileEntity flower = world.getTileEntity(pos);
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
final IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||
final int section = ((TileEntityFlower) flower).getSection();
|
||||
if (iflower != null && section < iflower.getGenome().getPrimary().getType().getSections() - 1 && iflower.getAge() > 0) {
|
||||
world.setBlockState(pos.up(), Botany.flower.getDefaultState());
|
||||
final TileEntity tileFlower = world.getTileEntity(pos.up());
|
||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void onGrowFromSeed(final World world, final int x, final int y, final int z) {
|
||||
tryGrowSection(world, x, y, z);
|
||||
}
|
||||
public static void onGrowFromSeed(final World world, final BlockPos pos) {
|
||||
tryGrowSection(world, pos);
|
||||
}
|
||||
|
||||
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(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getAcidFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isAcidFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getAcidFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAlkalineFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isAlkalineFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getAlkalineFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isNutrientFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getNutrientFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean isNutrientFertiliser(final ItemStack itemstack) {
|
||||
for (final ItemStack stack : getNutrientFertilisers()) {
|
||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getFertiliserStrength(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 1;
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
public static int getFertiliserStrength(final ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return 1;
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static boolean canTolerate(final IFlower flower, final World world, final int x, final int y, final int z) {
|
||||
if (flower == null || flower.getGenome() == null) {
|
||||
return false;
|
||||
}
|
||||
final Block soil = world.getBlock(x, y - 1, z);
|
||||
final int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||
final BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
||||
}
|
||||
// public static boolean canTolerate(final IFlower flower, final World world, final BlockPos pos) {
|
||||
// if (flower == null || flower.getGenome() == null) {
|
||||
// return false;
|
||||
// }
|
||||
// final Block soil = world.getBlock(x, y - 1, z);
|
||||
// final int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||
// final 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(final World world, final BlockPos pos) {
|
||||
// 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(final World world, final int x, final int y, final 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(final EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
public static Block getSoilBlock(final EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
public static Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
|
||||
switch (type) {
|
||||
case FLOWERBED: {
|
||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||
}
|
||||
case LOAM: {
|
||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||
}
|
||||
default: {
|
||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
|
||||
switch (type) {
|
||||
case FLOWERBED: {
|
||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||
}
|
||||
case LOAM: {
|
||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||
}
|
||||
default: {
|
||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static boolean canTolerate(final IFlower flower, final EnumAcidity ePH, final EnumMoisture eMoisture, final EnumTemperature eTemp) {
|
||||
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp);
|
||||
}
|
||||
|
||||
public static boolean canTolerate(final IFlower flower, final EnumAcidity ePH, final EnumMoisture eMoisture, final EnumTemperature eTemp) {
|
||||
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp);
|
||||
}
|
||||
public static boolean isWeedkiller(final ItemStack heldItem) {
|
||||
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||
}
|
||||
|
||||
public static boolean isWeedkiller(final ItemStack heldItem) {
|
||||
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||
}
|
||||
// public static boolean addWeedKiller(final World world, final BlockPos pos) {
|
||||
// if (!(world.getBlockState(pos).getBlock() instanceof IBlockSoil)) {
|
||||
// return false;
|
||||
// }
|
||||
// final EnumSoilType type = getSoilType(world, pos);
|
||||
// final Block block = getSoilBlock(type, true);
|
||||
// final boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
||||
// if (done && BlockPlant.isWeed(world, pos.up())) {
|
||||
// world.setBlockToAir(pos.up());
|
||||
// }
|
||||
// return done;
|
||||
// }
|
||||
|
||||
public static boolean addWeedKiller(final World world, final int x, final int y, final int z) {
|
||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
final EnumSoilType type = getSoilType(world, x, y, z);
|
||||
final Block block = getSoilBlock(type, true);
|
||||
final 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;
|
||||
}
|
||||
|
||||
static {
|
||||
Gardening.fertiliserAcid = new LinkedHashMap<ItemStack, Integer>();
|
||||
Gardening.fertiliserAlkaline = new LinkedHashMap<ItemStack, Integer>();
|
||||
Gardening.fertiliserNutrient = new LinkedHashMap<ItemStack, Integer>();
|
||||
}
|
||||
static {
|
||||
Gardening.fertiliserAcid = new LinkedHashMap<ItemStack, Integer>();
|
||||
Gardening.fertiliserAlkaline = new LinkedHashMap<ItemStack, Integer>();
|
||||
Gardening.fertiliserNutrient = new LinkedHashMap<ItemStack, Integer>();
|
||||
}
|
||||
}
|
||||
@@ -1,72 +1,69 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemSoil extends ItemBlock
|
||||
{
|
||||
EnumSoilType type;
|
||||
private boolean noWeed;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
||||
super.addInformation(stack, p_77624_2_, p_77624_3_, p_77624_4_);
|
||||
final EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
String info = "";
|
||||
if (moisture == EnumMoisture.Dry) {
|
||||
info += "§eDry§f";
|
||||
}
|
||||
if (moisture == EnumMoisture.Damp) {
|
||||
info += "§9Damp§f";
|
||||
}
|
||||
if (acidity == EnumAcidity.Acid) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§cAcidic§f";
|
||||
}
|
||||
if (acidity == EnumAcidity.Alkaline) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§bAlkaline§f";
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
p_77624_3_.add(info);
|
||||
}
|
||||
if (this.noWeed) {
|
||||
p_77624_3_.add("Weedkiller");
|
||||
}
|
||||
}
|
||||
public class ItemSoil extends ItemBlock {
|
||||
EnumSoilType type;
|
||||
private boolean noWeed;
|
||||
|
||||
public ItemSoil(final Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
this.type = ((BlockSoil) this.field_150939_a).getType();
|
||||
this.noWeed = ((BlockSoil) this.field_150939_a).weedKilled;
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
||||
super.addInformation(stack, p_77624_2_, p_77624_3_, p_77624_4_);
|
||||
final EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
final EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
String info = "";
|
||||
if (moisture == EnumMoisture.Dry) {
|
||||
info += "§eDry§f";
|
||||
}
|
||||
if (moisture == EnumMoisture.Damp) {
|
||||
info += "§9Damp§f";
|
||||
}
|
||||
if (acidity == EnumAcidity.Acid) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§cAcidic§f";
|
||||
}
|
||||
if (acidity == EnumAcidity.Alkaline) {
|
||||
if (info.length() > 0) {
|
||||
info += ", ";
|
||||
}
|
||||
info += "§bAlkaline§f";
|
||||
}
|
||||
if (info.length() > 0) {
|
||||
p_77624_3_.add(info);
|
||||
}
|
||||
if (this.noWeed) {
|
||||
p_77624_3_.add("Weedkiller");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
|
||||
}
|
||||
public ItemSoil(final Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
// this.type = ((BlockSoil) this.field_150939_a).getType();
|
||||
// this.noWeed = ((BlockSoil) this.field_150939_a).weedKilled;
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int p_77647_1_) {
|
||||
return p_77647_1_;
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return "";
|
||||
//TODO this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int p_77647_1_) {
|
||||
return p_77647_1_;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,49 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemSoilMeter extends Item
|
||||
{
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
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)) {
|
||||
final IBlockSoil soil = (IBlockSoil) block;
|
||||
final EnumSoilType type = soil.getType(world, x, y, z);
|
||||
final EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||
final EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||
String info = "Type: ";
|
||||
info = info + "§" + (new char[] { '8', '6', 'd' })[type.ordinal()] + Binnie.Language.localise(type) + "§f";
|
||||
info += ", Moisture: ";
|
||||
info = info + "§" + (new char[] { 'e', '7', '9' })[moisture.ordinal()] + Binnie.Language.localise(moisture) + "§f";
|
||||
info += ", pH: ";
|
||||
info = info + "§" + (new char[] { 'c', 'a', 'b' })[pH.ordinal()] + Binnie.Language.localise(pH) + "§f";
|
||||
final IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
|
||||
}
|
||||
public class ItemSoilMeter extends Item {
|
||||
// @Override
|
||||
// public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
// 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)) {
|
||||
// final IBlockSoil soil = (IBlockSoil) block;
|
||||
// final EnumSoilType type = soil.getType(world, x, y, z);
|
||||
// final EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||
// final EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||
// String info = "Type: ";
|
||||
// info = info + "§" + (new char[] { '8', '6', 'd' })[type.ordinal()] + Binnie.Language.localise(type) + "§f";
|
||||
// info += ", Moisture: ";
|
||||
// info = info + "§" + (new char[] { 'e', '7', '9' })[moisture.ordinal()] + Binnie.Language.localise(moisture) + "§f";
|
||||
// info += ", pH: ";
|
||||
// info = info + "§" + (new char[] { 'c', 'a', 'b' })[pH.ordinal()] + Binnie.Language.localise(pH) + "§f";
|
||||
// final IChatComponent chat = new ChatComponentText(info);
|
||||
// player.addChatMessage(chat);
|
||||
// }
|
||||
// return super.onItemUse(stack, player, world, x, y, z, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||
}
|
||||
public ItemSoilMeter() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("soilMeter");
|
||||
this.setMaxStackSize(1);
|
||||
setRegistryName("soilMeter");
|
||||
}
|
||||
|
||||
public ItemSoilMeter() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("soilMeter");
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return "Soil Meter";
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return "Soil Meter";
|
||||
}
|
||||
}
|
||||
@@ -1,74 +1,58 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemTrowel extends Item
|
||||
{
|
||||
protected Item.ToolMaterial theToolMaterial;
|
||||
String locName;
|
||||
public class ItemTrowel extends Item {
|
||||
protected Item.ToolMaterial theToolMaterial;
|
||||
String locName;
|
||||
|
||||
public ItemTrowel(final Item.ToolMaterial p_i45343_1_, final String material) {
|
||||
this.theToolMaterial = p_i45343_1_;
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(p_i45343_1_.getMaxUses());
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("trowel" + material);
|
||||
this.locName = "trowel" + material;
|
||||
}
|
||||
public ItemTrowel(final Item.ToolMaterial p_i45343_1_, final String material) {
|
||||
this.theToolMaterial = p_i45343_1_;
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(p_i45343_1_.getMaxUses());
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("trowel" + material);
|
||||
this.locName = "trowel" + material;
|
||||
setRegistryName("trowel" + material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
||||
this.itemIcon = Botany.proxy.getIcon(p_94581_1_, "tools/" + this.locName);
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister p_94581_1_) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(p_94581_1_, "tools/" + this.locName);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
// if (!player.canPlayerEdit(x, y, z, p_77648_7_, stack)) {
|
||||
// return false;
|
||||
// }
|
||||
// final Block block = world.getBlock(x, y, z);
|
||||
// if (p_77648_7_ == 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;
|
||||
// }
|
||||
// final 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;
|
||||
// }
|
||||
// final EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
// final 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
|
||||
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
||||
if (!player.canPlayerEdit(x, y, z, p_77648_7_, stack)) {
|
||||
return false;
|
||||
}
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
if (p_77648_7_ == 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;
|
||||
}
|
||||
final 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;
|
||||
}
|
||||
final EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||
final 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;
|
||||
}
|
||||
|
||||
public String getToolMaterialName() {
|
||||
return this.theToolMaterial.toString();
|
||||
}
|
||||
public String getToolMaterialName() {
|
||||
return this.theToolMaterial.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,29 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemWeed extends ItemBlock
|
||||
{
|
||||
public ItemWeed(final Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
this.setHasSubtypes(true);
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
public class ItemWeed extends ItemBlock {
|
||||
public ItemWeed(final Block p_i45328_1_) {
|
||||
super(p_i45328_1_);
|
||||
this.setHasSubtypes(true);
|
||||
this.hasSubtypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int p_77647_1_) {
|
||||
return p_77647_1_;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(final int p_77647_1_) {
|
||||
return p_77647_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int p_77617_1_) {
|
||||
return this.field_150939_a.getIcon(2, p_77617_1_);
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIconFromDamage(final int p_77617_1_) {
|
||||
// return this.field_150939_a.getIcon(2, p_77617_1_);
|
||||
// }
|
||||
}
|
||||
@@ -1,274 +1,271 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.gardening;
|
||||
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import java.util.Map;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import binnie.core.Mods;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import binnie.botany.farm.CircuitGarden;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import net.minecraft.init.Blocks;
|
||||
import binnie.botany.ceramic.PigmentRecipe;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import binnie.botany.ceramic.CeramicTileRecipe;
|
||||
import binnie.core.block.MultipassItemRenderer;
|
||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import binnie.core.block.ItemMetadataRenderer;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.botany.ceramic.BlockStained;
|
||||
import binnie.botany.ceramic.BlockCeramic;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import binnie.botany.ceramic.*;
|
||||
import binnie.botany.farm.CircuitGarden;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.botany.items.ItemClay;
|
||||
import binnie.botany.items.ItemPigment;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.items.BotanyItems;
|
||||
import binnie.Binnie;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.botany.flower.ItemInsulatedTube;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.EnumSoilType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.HashMap;
|
||||
import binnie.core.IInitializable;
|
||||
import binnie.core.Mods;
|
||||
import binnie.core.block.ItemMetadata;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class ModuleGardening implements IInitializable
|
||||
{
|
||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers;
|
||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers;
|
||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||
GameRegistry.registerBlock(Botany.plant = new BlockPlant(), ItemWeed.class, "plant");
|
||||
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
||||
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
||||
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
||||
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
||||
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
||||
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.ceramic = new BlockCeramic();
|
||||
Botany.stained = new BlockStained();
|
||||
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
||||
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
public class ModuleGardening implements IInitializable {
|
||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers;
|
||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers;
|
||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers;
|
||||
|
||||
@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, "");
|
||||
final ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
||||
final ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
||||
final ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
||||
for (final boolean manual : new boolean[] { true, false }) {
|
||||
for (final boolean fertilised : new boolean[] { true, false }) {
|
||||
for (final EnumMoisture moist : EnumMoisture.values()) {
|
||||
final 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, 0 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Acid, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Neutral, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Alkaline, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||
GameRegistry.register(Botany.plant = new BlockPlant());
|
||||
GameRegistry.register(new ItemWeed(Botany.plant).setRegistryName(Botany.plant.getRegistryName()));
|
||||
GameRegistry.register(Botany.soil);
|
||||
GameRegistry.register(new ItemSoil(Botany.soil).setRegistryName(Botany.soil.getRegistryName()));
|
||||
GameRegistry.register(Botany.loam);
|
||||
GameRegistry.register(new ItemSoil(Botany.loam).setRegistryName(Botany.loam.getRegistryName()));
|
||||
GameRegistry.register(Botany.flowerbed);
|
||||
GameRegistry.register(new ItemSoil(Botany.flowerbed).setRegistryName(Botany.flowerbed.getRegistryName()));
|
||||
GameRegistry.register(Botany.soilNoWeed);
|
||||
GameRegistry.register(new ItemSoil(Botany.soilNoWeed).setRegistryName(Botany.soilNoWeed.getRegistryName()));
|
||||
GameRegistry.register(Botany.loamNoWeed);
|
||||
GameRegistry.register(new ItemSoil(Botany.loamNoWeed).setRegistryName(Botany.loamNoWeed.getRegistryName()));
|
||||
GameRegistry.register(Botany.flowerbedNoWeed);
|
||||
GameRegistry.register(new ItemSoil(Botany.flowerbedNoWeed).setRegistryName(Botany.flowerbedNoWeed.getRegistryName()));
|
||||
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.DIAMOND, "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();
|
||||
Botany.stained = new BlockStained();
|
||||
GameRegistry.register(Botany.ceramic);
|
||||
GameRegistry.register(new ItemMetadata(Botany.ceramic).setRegistryName(Botany.ceramic.getRegistryName()));
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||
GameRegistry.register(Botany.stained);
|
||||
GameRegistry.register(new ItemMetadata(Botany.stained).setRegistryName(Botany.stained.getRegistryName()));
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||
for (int mat = 0; mat < 4; ++mat) {
|
||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||
final ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||
final ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||
final ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, mat);
|
||||
GameRegistry.addShapelessRecipe(tubes, new Object[] { forestryTube, forestryTube, insulateStack });
|
||||
}
|
||||
}
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelWood, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelStone, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelIron, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelGold, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelDiamond, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.soilMeter, new Object[] { " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron" }));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.Weedkiller.get(4), new Object[] { 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), new Object[] { Mods.Forestry.stack("ash") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), new Object[] { Mods.Forestry.stack("mulch") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerBio") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerCompound") });
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), new Object[] { 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" }));
|
||||
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 (final 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);
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||
this.addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||
this.addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||
this.addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
GameRegistry.addRecipe(BotanyItems.Mortar.get(6), new Object[] { " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel });
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
final ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||
final ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, new Object[] { Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment });
|
||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||
final ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||
glass.stackSize = 4;
|
||||
GameRegistry.addShapedRecipe(glass, new Object[] { " g ", "gpg", " g ", 'g', Blocks.glass, 'p', pigment });
|
||||
}
|
||||
GameRegistry.addRecipe(new PigmentRecipe());
|
||||
}
|
||||
GameRegistry.register(Botany.ceramicTile);
|
||||
GameRegistry.register(new ItemMetadata(Botany.ceramicTile).setRegistryName(Botany.ceramicTile.getRegistryName()));
|
||||
GameRegistry.register(Botany.ceramicBrick);
|
||||
GameRegistry.register(new ItemMetadata(Botany.ceramicBrick).setRegistryName(Botany.ceramicBrick.getRegistryName()));
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||
// BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||
}
|
||||
|
||||
private ItemStack getStack(final int type, final int pH, final 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]));
|
||||
}
|
||||
@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, "");
|
||||
final ItemStack yellow = new ItemStack(Blocks.YELLOW_FLOWER, 1);
|
||||
final ItemStack red = new ItemStack(Blocks.RED_FLOWER, 1);
|
||||
final ItemStack blue = new ItemStack(Blocks.RED_FLOWER, 1, 7);
|
||||
for (final boolean manual : new boolean[]{true, false}) {
|
||||
for (final boolean fertilised : new boolean[]{true, false}) {
|
||||
for (final EnumMoisture moist : EnumMoisture.values()) {
|
||||
final 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, 0 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Acid, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Neutral, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||
new CircuitGarden(moist, EnumAcidity.Alkaline, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addAcidFertiliser(final ItemStack stack, final 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) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type, pH - strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||
for (int mat = 0; mat < 4; ++mat) {
|
||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||
final ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||
final ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||
final ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, mat);
|
||||
GameRegistry.addShapelessRecipe(tubes, new Object[]{forestryTube, forestryTube, insulateStack});
|
||||
}
|
||||
}
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelWood, new Object[]{"d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "plankWood"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelStone, new Object[]{"d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "cobblestone"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelIron, new Object[]{"d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "ingotIron"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelGold, new Object[]{"d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "ingotGold"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelDiamond, new Object[]{"d ", " x ", " s", 'd', Blocks.DIRT, 's', "stickWood", 'x', "gemDiamond"}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.soilMeter, new Object[]{" gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron"}));
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.Weedkiller.get(4), new Object[]{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), new Object[]{Mods.Forestry.stack("ash")});
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), new Object[]{Mods.Forestry.stack("mulch")});
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), new Object[]{Mods.Forestry.stack("fertilizerBio")});
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), new Object[]{Mods.Forestry.stack("fertilizerCompound")});
|
||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), new Object[]{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"}));
|
||||
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 (final 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);
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||
this.addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||
this.addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||
this.addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||
}
|
||||
GameRegistry.addRecipe(BotanyItems.Mortar.get(6), new Object[]{" c ", "cgc", " c ", 'c', Items.CLAY_BALL, 'g', Blocks.GRAVEL});
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
final ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||
final ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||
GameRegistry.addShapelessRecipe(clay, new Object[]{Items.CLAY_BALL, Items.CLAY_BALL, Items.CLAY_BALL, pigment});
|
||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||
final ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||
glass.stackSize = 4;
|
||||
GameRegistry.addShapedRecipe(glass, new Object[]{" g ", "gpg", " g ", 'g', Blocks.GLASS, 'p', pigment});
|
||||
}
|
||||
GameRegistry.addRecipe(new PigmentRecipe());
|
||||
}
|
||||
|
||||
private void addAlkalineFertiliser(final ItemStack stack, final 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) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type, pH + strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final 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 ItemStack getStack(final int type, final int pH, final 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 addNutrientFertiliser(final ItemStack stack, final 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) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type + strength, pH, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final 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 addAcidFertiliser(final ItemStack stack, final 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) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type, pH - strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
ModuleGardening.queuedAcidFertilisers = new HashMap<ItemStack, Integer>();
|
||||
ModuleGardening.queuedAlkalineFertilisers = new HashMap<ItemStack, Integer>();
|
||||
ModuleGardening.queuedNutrientFertilisers = new HashMap<ItemStack, Integer>();
|
||||
}
|
||||
private void addAlkalineFertiliser(final ItemStack stack, final 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) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type, pH + strength, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final 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(final ItemStack stack, final 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) {
|
||||
final ItemStack start = this.getStack(type, pH, moisture);
|
||||
final ItemStack end = this.getStack(type + strength, pH, moisture);
|
||||
if (end != null) {
|
||||
end.stackSize = numOfBlocks;
|
||||
final 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
ModuleGardening.queuedAcidFertilisers = new HashMap<ItemStack, Integer>();
|
||||
ModuleGardening.queuedAlkalineFertilisers = new HashMap<ItemStack, Integer>();
|
||||
ModuleGardening.queuedNutrientFertilisers = new HashMap<ItemStack, Integer>();
|
||||
}
|
||||
}
|
||||
@@ -1,52 +1,47 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public class AlleleColor implements IAlleleInteger
|
||||
{
|
||||
String uid;
|
||||
boolean dominant;
|
||||
String name;
|
||||
int value;
|
||||
EnumFlowerColor color;
|
||||
public class AlleleColor implements IAlleleInteger {
|
||||
String uid;
|
||||
boolean dominant;
|
||||
String name;
|
||||
int value;
|
||||
EnumFlowerColor color;
|
||||
|
||||
public AlleleColor(final EnumFlowerColor color, final String uid, final String name, final int value) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
public AlleleColor(final EnumFlowerColor color, final String uid, final String name, final int value) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
@Override
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public EnumFlowerColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
public EnumFlowerColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,43 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.api.IAlleleFlowerEffect;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import binnie.botany.api.IAlleleFlowerEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class AlleleEffectNone implements IAlleleFlowerEffect
|
||||
{
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return true;
|
||||
}
|
||||
public class AlleleEffectNone implements IAlleleFlowerEffect {
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(final IEffectData storedData) {
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData validateStorage(final 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 "None";
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return "None";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(final IFlowerGenome genome, final IEffectData storedData, final World world, final int x, final int y, final int z) {
|
||||
return storedData;
|
||||
}
|
||||
@Override
|
||||
public IEffectData doEffect(final IFlowerGenome genome, final IEffectData storedData, final World world, final int x, final int y, final int z) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.getUID();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,39 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker
|
||||
{
|
||||
public BotanistTracker(final String s) {
|
||||
super(s);
|
||||
}
|
||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker {
|
||||
public BotanistTracker(final String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPickup(final IIndividual individual) {
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(final EntityPlayer player) {
|
||||
return Binnie.Genetics.getFlowerRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String speciesRootUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPickup(final IIndividual individual) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(final EntityPlayer player) {
|
||||
return Binnie.Genetics.getFlowerRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String speciesRootUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
}
|
||||
@@ -1,48 +1,43 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import binnie.botany.api.IColourMix;
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
|
||||
public class ColourMix implements IColourMix
|
||||
{
|
||||
IFlowerColour colour1;
|
||||
IFlowerColour colour2;
|
||||
IFlowerColour result;
|
||||
int chance;
|
||||
public class ColourMix implements IColourMix {
|
||||
IFlowerColour colour1;
|
||||
IFlowerColour colour2;
|
||||
IFlowerColour result;
|
||||
int chance;
|
||||
|
||||
@Override
|
||||
public IFlowerColour getColour1() {
|
||||
return this.colour1;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColour getColour1() {
|
||||
return this.colour1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColour getColour2() {
|
||||
return this.colour2;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColour getColour2() {
|
||||
return this.colour2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(final IFlowerColour a, final IFlowerColour b) {
|
||||
return (a == this.colour1 && b == this.colour2) || (a == this.colour2 && b == this.colour1);
|
||||
}
|
||||
@Override
|
||||
public boolean isMutation(final IFlowerColour a, final IFlowerColour b) {
|
||||
return (a == this.colour1 && b == this.colour2) || (a == this.colour2 && b == this.colour1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance() {
|
||||
return this.chance;
|
||||
}
|
||||
@Override
|
||||
public int getChance() {
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColour getResult() {
|
||||
return this.result;
|
||||
}
|
||||
@Override
|
||||
public IFlowerColour getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) {
|
||||
this.colour1 = colour1;
|
||||
this.colour2 = colour2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) {
|
||||
this.colour1 = colour1;
|
||||
this.colour2 = colour2;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,135 +1,126 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
int sections;
|
||||
IIcon[] stem;
|
||||
IIcon[] petal;
|
||||
IIcon[] variant;
|
||||
IIcon[] unflowered;
|
||||
IIcon seedStem;
|
||||
IIcon seedPetal;
|
||||
IIcon seedVariant;
|
||||
IIcon pollenStem;
|
||||
IIcon pollenPetal;
|
||||
IIcon pollenVariant;
|
||||
IIcon blank;
|
||||
int sections;
|
||||
// IIcon[] stem;
|
||||
// IIcon[] petal;
|
||||
// IIcon[] variant;
|
||||
// IIcon[] unflowered;
|
||||
// IIcon seedStem;
|
||||
// IIcon seedPetal;
|
||||
// IIcon seedVariant;
|
||||
// IIcon pollenStem;
|
||||
// IIcon pollenPetal;
|
||||
// IIcon pollenVariant;
|
||||
// IIcon blank;
|
||||
|
||||
private EnumFlowerType() {
|
||||
this(1);
|
||||
}
|
||||
private EnumFlowerType() {
|
||||
this(1);
|
||||
}
|
||||
|
||||
private EnumFlowerType(final int sections) {
|
||||
this.sections = 1;
|
||||
this.sections = sections;
|
||||
this.stem = new IIcon[sections];
|
||||
this.petal = new IIcon[sections];
|
||||
this.variant = new IIcon[sections];
|
||||
this.unflowered = new IIcon[sections];
|
||||
}
|
||||
private EnumFlowerType(final int sections) {
|
||||
this.sections = 1;
|
||||
this.sections = sections;
|
||||
// this.stem = new IIcon[sections];
|
||||
// this.petal = new IIcon[sections];
|
||||
// this.variant = new IIcon[sections];
|
||||
// this.unflowered = new IIcon[sections];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getStem(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
return (stage == EnumFlowerStage.SEED) ? this.seedStem : ((stage == EnumFlowerStage.POLLEN) ? this.pollenStem : this.stem[section % this.sections]);
|
||||
}
|
||||
// @Override
|
||||
// public IIcon getStem(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
// return (stage == EnumFlowerStage.SEED) ? this.seedStem : ((stage == EnumFlowerStage.POLLEN) ? this.pollenStem : this.stem[section % this.sections]);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getPetalIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
// return (stage == EnumFlowerStage.SEED) ? this.seedPetal : ((stage == EnumFlowerStage.POLLEN) ? this.pollenPetal : (flowered ? this.petal[section % this.sections] : this.unflowered[section % this.sections]));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getVariantIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
// return (stage == EnumFlowerStage.SEED) ? this.seedVariant : ((stage == EnumFlowerStage.POLLEN) ? this.pollenVariant : (flowered ? this.variant[section % this.sections] : this.blank));
|
||||
// }
|
||||
//
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// for (int i = 0; i < this.sections; ++i) {
|
||||
// final String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||
// final String pre = (this.sections == 1) ? "" : "double/";
|
||||
// this.stem[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".0");
|
||||
// this.petal[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".1");
|
||||
// this.variant[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".2");
|
||||
// this.unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".3");
|
||||
// }
|
||||
// this.blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||
// this.seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||
// this.seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||
// this.seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||
// this.pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||
// this.pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||
// this.pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IIcon getPetalIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
return (stage == EnumFlowerStage.SEED) ? this.seedPetal : ((stage == EnumFlowerStage.POLLEN) ? this.pollenPetal : (flowered ? this.petal[section % this.sections] : this.unflowered[section % this.sections]));
|
||||
}
|
||||
@Override
|
||||
public int getID() {
|
||||
return this.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getVariantIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
||||
return (stage == EnumFlowerStage.SEED) ? this.seedVariant : ((stage == EnumFlowerStage.POLLEN) ? this.pollenVariant : (flowered ? this.variant[section % this.sections] : this.blank));
|
||||
}
|
||||
@Override
|
||||
public int getSections() {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
for (int i = 0; i < this.sections; ++i) {
|
||||
final String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||
final String pre = (this.sections == 1) ? "" : "double/";
|
||||
this.stem[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".0");
|
||||
this.petal[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".1");
|
||||
this.variant[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".2");
|
||||
this.unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".3");
|
||||
}
|
||||
this.blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||
this.seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||
this.seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||
this.seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||
this.pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||
this.pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||
this.pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return this.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSections() {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
public IIcon getBlank() {
|
||||
return this.blank;
|
||||
}
|
||||
// public IIcon getBlank() {
|
||||
// return this.blank;
|
||||
// }
|
||||
}
|
||||
@@ -1,290 +1,275 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.IFlowerColour;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IColourMix;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import net.minecraft.world.World;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import java.util.Random;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import java.util.List;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import binnie.botany.api.IFlower;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Flower extends Individual implements IFlower
|
||||
{
|
||||
public IFlowerGenome genome;
|
||||
public IFlowerGenome mate;
|
||||
int age;
|
||||
boolean wilting;
|
||||
boolean flowered;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public Flower(final NBTTagCompound nbttagcompound) {
|
||||
this.age = 0;
|
||||
this.wilting = false;
|
||||
this.readFromNBT(nbttagcompound);
|
||||
}
|
||||
public class Flower extends Individual implements IFlower {
|
||||
public IFlowerGenome genome;
|
||||
public IFlowerGenome mate;
|
||||
int age;
|
||||
boolean wilting;
|
||||
boolean flowered;
|
||||
|
||||
public Flower(final IFlowerGenome genome, final int age) {
|
||||
this.age = 0;
|
||||
this.wilting = false;
|
||||
this.genome = genome;
|
||||
this.age = age;
|
||||
if (age > 0) {
|
||||
this.flowered = true;
|
||||
}
|
||||
else {
|
||||
this.flowered = false;
|
||||
}
|
||||
}
|
||||
public Flower(final NBTTagCompound nbttagcompound) {
|
||||
this.age = 0;
|
||||
this.wilting = false;
|
||||
this.readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
final IAlleleFlowerSpecies species = this.getGenome().getPrimary();
|
||||
String name = "";
|
||||
if (species != null) {
|
||||
name += species.getName();
|
||||
}
|
||||
if (this.age == 0) {
|
||||
name += "";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
public Flower(final IFlowerGenome genome, final int age) {
|
||||
this.age = 0;
|
||||
this.wilting = false;
|
||||
this.genome = genome;
|
||||
this.age = age;
|
||||
if (age > 0) {
|
||||
this.flowered = true;
|
||||
} else {
|
||||
this.flowered = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(final List<String> list) {
|
||||
final IAlleleFlowerSpecies primary = this.genome.getPrimary();
|
||||
final IAlleleFlowerSpecies secondary = this.genome.getSecondary();
|
||||
if (!this.isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||
list.add("§9" + primary.getName() + "-" + secondary.getName() + " Hybrid");
|
||||
}
|
||||
list.add("§6Age: " + this.getAge());
|
||||
list.add("§6T: " + this.getGenome().getPrimary().getTemperature() + " / " + this.getGenome().getToleranceTemperature());
|
||||
list.add("§6M: " + this.getGenome().getPrimary().getMoisture() + " / " + this.getGenome().getToleranceMoisture());
|
||||
list.add("§6pH: " + this.getGenome().getPrimary().getHumidity() + " / " + this.getGenome().getTolerancePH());
|
||||
list.add("§6Fert: " + this.getGenome().getFertility() + "x");
|
||||
}
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
final IAlleleFlowerSpecies species = this.getGenome().getPrimary();
|
||||
String name = "";
|
||||
if (species != null) {
|
||||
name += species.getName();
|
||||
}
|
||||
if (this.age == 0) {
|
||||
name += "";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdent() {
|
||||
return this.getGenome().getPrimary().getUID();
|
||||
}
|
||||
@Override
|
||||
public void addTooltip(final List<String> list) {
|
||||
final IAlleleFlowerSpecies primary = this.genome.getPrimary();
|
||||
final IAlleleFlowerSpecies secondary = this.genome.getSecondary();
|
||||
if (!this.isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||
list.add("§9" + primary.getName() + "-" + secondary.getName() + " Hybrid");
|
||||
}
|
||||
list.add("§6Age: " + this.getAge());
|
||||
list.add("§6T: " + this.getGenome().getPrimary().getTemperature() + " / " + this.getGenome().getToleranceTemperature());
|
||||
list.add("§6M: " + this.getGenome().getPrimary().getMoisture() + " / " + this.getGenome().getToleranceMoisture());
|
||||
list.add("§6pH: " + this.getGenome().getPrimary().getHumidity() + " / " + this.getGenome().getTolerancePH());
|
||||
list.add("§6Fert: " + this.getGenome().getFertility() + "x");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
return;
|
||||
}
|
||||
this.age = nbttagcompound.getInteger("Age");
|
||||
this.wilting = nbttagcompound.getBoolean("Wilt");
|
||||
this.flowered = nbttagcompound.getBoolean("Flowered");
|
||||
if (nbttagcompound.hasKey("Genome")) {
|
||||
this.genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
}
|
||||
if (nbttagcompound.hasKey("Mate")) {
|
||||
this.mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getIdent() {
|
||||
return this.getGenome().getPrimary().getUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
nbttagcompound.setInteger("Age", this.age);
|
||||
nbttagcompound.setBoolean("Wilt", this.wilting);
|
||||
nbttagcompound.setBoolean("Flowered", this.flowered);
|
||||
if (this.genome != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.genome.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Genome", NBTmachine);
|
||||
}
|
||||
if (this.mate != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.mate.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Mate", NBTmachine);
|
||||
}
|
||||
}
|
||||
//TODO TEST
|
||||
//@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
//super.readFromNBT(nbttagcompound);
|
||||
if (nbttagcompound == null) {
|
||||
this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||
return;
|
||||
}
|
||||
this.age = nbttagcompound.getInteger("Age");
|
||||
this.wilting = nbttagcompound.getBoolean("Wilt");
|
||||
this.flowered = nbttagcompound.getBoolean("Flowered");
|
||||
if (nbttagcompound.hasKey("Genome")) {
|
||||
this.genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||
}
|
||||
if (nbttagcompound.hasKey("Mate")) {
|
||||
this.mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||
}
|
||||
}
|
||||
|
||||
public int getMetadata() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound nbttagcompound2) {
|
||||
NBTTagCompound nbttagcompound = super.writeToNBT(nbttagcompound2);
|
||||
nbttagcompound.setInteger("Age", this.age);
|
||||
nbttagcompound.setBoolean("Wilt", this.wilting);
|
||||
nbttagcompound.setBoolean("Flowered", this.flowered);
|
||||
if (this.genome != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.genome.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Genome", NBTmachine);
|
||||
}
|
||||
if (this.mate != null) {
|
||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||
this.mate.writeToNBT(NBTmachine);
|
||||
nbttagcompound.setTag("Mate", NBTmachine);
|
||||
}
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome getGenome() {
|
||||
return this.genome;
|
||||
}
|
||||
public int getMetadata() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private IChromosome inheritChromosome(final Random rand, final IChromosome parent1, final IChromosome parent2) {
|
||||
IAllele choice1;
|
||||
if (rand.nextBoolean()) {
|
||||
choice1 = parent1.getPrimaryAllele();
|
||||
}
|
||||
else {
|
||||
choice1 = parent1.getSecondaryAllele();
|
||||
}
|
||||
IAllele choice2;
|
||||
if (rand.nextBoolean()) {
|
||||
choice2 = parent2.getPrimaryAllele();
|
||||
}
|
||||
else {
|
||||
choice2 = parent2.getSecondaryAllele();
|
||||
}
|
||||
if (rand.nextBoolean()) {
|
||||
return new Chromosome(choice1, choice2);
|
||||
}
|
||||
return new Chromosome(choice2, choice1);
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome getGenome() {
|
||||
return this.genome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mate(final IFlower other) {
|
||||
this.mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||
}
|
||||
private IChromosome inheritChromosome(final Random rand, final IChromosome parent1, final IChromosome parent2) {
|
||||
IAllele choice1;
|
||||
if (rand.nextBoolean()) {
|
||||
choice1 = parent1.getPrimaryAllele();
|
||||
} else {
|
||||
choice1 = parent1.getSecondaryAllele();
|
||||
}
|
||||
IAllele choice2;
|
||||
if (rand.nextBoolean()) {
|
||||
choice2 = parent2.getPrimaryAllele();
|
||||
} else {
|
||||
choice2 = parent2.getSecondaryAllele();
|
||||
}
|
||||
if (rand.nextBoolean()) {
|
||||
return new Chromosome(choice1, choice2);
|
||||
}
|
||||
return new Chromosome(choice2, choice1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome getMate() {
|
||||
return this.mate;
|
||||
}
|
||||
@Override
|
||||
public void mate(final IFlower other) {
|
||||
this.mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower copy() {
|
||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
this.writeToNBT(nbttagcompound);
|
||||
return new Flower(nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome getMate() {
|
||||
return this.mate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAge() {
|
||||
return this.age;
|
||||
}
|
||||
@Override
|
||||
public IFlower copy() {
|
||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
this.writeToNBT(nbttagcompound);
|
||||
return new Flower(nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void age() {
|
||||
if (this.age < 15) {
|
||||
++this.age;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getAge() {
|
||||
return this.age;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAge(final int i) {
|
||||
this.age = i;
|
||||
}
|
||||
@Override
|
||||
public void age() {
|
||||
if (this.age < 15) {
|
||||
++this.age;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAge() {
|
||||
return this.getGenome().getLifespan();
|
||||
}
|
||||
@Override
|
||||
public void setAge(final int i) {
|
||||
this.age = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWilted() {
|
||||
return this.wilting;
|
||||
}
|
||||
@Override
|
||||
public int getMaxAge() {
|
||||
return this.getGenome().getLifespan();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWilted(final boolean wilted) {
|
||||
this.wilting = wilted;
|
||||
}
|
||||
@Override
|
||||
public boolean isWilted() {
|
||||
return this.wilting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFlowered() {
|
||||
return this.flowered;
|
||||
}
|
||||
@Override
|
||||
public void setWilted(final boolean wilted) {
|
||||
this.wilting = wilted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlowered(final boolean flowered) {
|
||||
this.flowered = flowered;
|
||||
}
|
||||
@Override
|
||||
public boolean hasFlowered() {
|
||||
return this.flowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMate() {
|
||||
this.mate = null;
|
||||
}
|
||||
@Override
|
||||
public void setFlowered(final boolean flowered) {
|
||||
this.flowered = flowered;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getOffspring(final World world) {
|
||||
final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = this.genome.getChromosomes();
|
||||
IChromosome[] parent2 = this.mate.getChromosomes();
|
||||
parent1 = this.mutateSpecies(world, this.genome, this.mate);
|
||||
parent2 = this.mutateSpecies(world, this.mate, this.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 void removeMate() {
|
||||
this.mate = null;
|
||||
}
|
||||
|
||||
private IChromosome[] mutateSpecies(final World world, final IFlowerGenome genomeOne, final IFlowerGenome genomeTwo) {
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
final 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;
|
||||
}
|
||||
IFlowerColour colour1 = genome0.getPrimaryColor();
|
||||
IFlowerColour colour2 = genome2.getPrimaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (final 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 (final 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 (final 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 (final IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||
final 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;
|
||||
}
|
||||
@Override
|
||||
public IFlower getOffspring(final World world) {
|
||||
final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = this.genome.getChromosomes();
|
||||
IChromosome[] parent2 = this.mate.getChromosomes();
|
||||
parent1 = this.mutateSpecies(world, this.genome, this.mate);
|
||||
parent2 = this.mutateSpecies(world, this.mate, this.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(final World world, final IFlowerGenome genomeOne, final IFlowerGenome genomeTwo) {
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
final 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;
|
||||
}
|
||||
IFlowerColour colour1 = genome0.getPrimaryColor();
|
||||
IFlowerColour colour2 = genome2.getPrimaryColor();
|
||||
if (colour1 != colour2) {
|
||||
for (final 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 (final 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 (final 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 (final IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||
final 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;
|
||||
}
|
||||
}
|
||||
@@ -1,134 +1,118 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import binnie.botany.api.EnumMoisture;
|
||||
import binnie.Binnie;
|
||||
import binnie.botany.api.EnumAcidity;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import binnie.botany.api.IFlowerType;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.botany.api.*;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.*;
|
||||
import forestry.core.genetics.Genome;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class FlowerGenome extends Genome implements IFlowerGenome
|
||||
{
|
||||
public FlowerGenome(final NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||
public FlowerGenome(final NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
|
||||
public FlowerGenome(final IChromosome[] chromosomes) {
|
||||
super(chromosomes);
|
||||
}
|
||||
public FlowerGenome(final IChromosome[] chromosomes) {
|
||||
super(chromosomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getPrimary() {
|
||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getPrimary() {
|
||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getSecondary() {
|
||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getSecondary() {
|
||||
return (IAlleleFlowerSpecies) this.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) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerColor getPrimaryColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getSecondaryColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerColor getSecondaryColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerColor getStemColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerColor getStemColor() {
|
||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||
}
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerType getType() {
|
||||
return this.getPrimary().getType();
|
||||
}
|
||||
@Override
|
||||
public IFlowerType getType() {
|
||||
return this.getPrimary().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemperature() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemperature() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getToleranceMoisture() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
@Override
|
||||
public EnumTolerance getToleranceMoisture() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTolerancePH() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||
}
|
||||
@Override
|
||||
public EnumTolerance getTolerancePH() {
|
||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||
}
|
||||
//TODO TEST
|
||||
// @Override
|
||||
// public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
// super.readFromNBT(nbttagcompound);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
}
|
||||
@Override
|
||||
public float getAgeChance() {
|
||||
return 1.0f * (float) Math.sqrt(2.0f / this.getLifespan());
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAgeChance() {
|
||||
return 1.0f * (float) Math.sqrt(2.0f / this.getLifespan());
|
||||
}
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
return ((IAlleleFloat) this.getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSappiness() {
|
||||
return ((IAlleleFloat) this.getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||
}
|
||||
@Override
|
||||
public boolean canTolerate(final EnumAcidity ePH) {
|
||||
final int pH = ePH.ordinal();
|
||||
final int[] pHTol = Binnie.Genetics.getTolerance(this.getTolerancePH());
|
||||
final int fPH = this.getPrimary().getPH().ordinal();
|
||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(final EnumAcidity ePH) {
|
||||
final int pH = ePH.ordinal();
|
||||
final int[] pHTol = Binnie.Genetics.getTolerance(this.getTolerancePH());
|
||||
final int fPH = this.getPrimary().getPH().ordinal();
|
||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||
}
|
||||
@Override
|
||||
public boolean canTolerate(final EnumMoisture eMoisture) {
|
||||
final int moisture = eMoisture.ordinal();
|
||||
final int[] moistTol = Binnie.Genetics.getTolerance(this.getToleranceMoisture());
|
||||
final int fMoisture = this.getPrimary().getMoisture().ordinal();
|
||||
return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(final EnumMoisture eMoisture) {
|
||||
final int moisture = eMoisture.ordinal();
|
||||
final int[] moistTol = Binnie.Genetics.getTolerance(this.getToleranceMoisture());
|
||||
final int fMoisture = this.getPrimary().getMoisture().ordinal();
|
||||
return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(final EnumTemperature eTemp) {
|
||||
final int temp = eTemp.ordinal();
|
||||
final int[] tempTol = Binnie.Genetics.getTolerance(this.getToleranceTemperature());
|
||||
final int fTemp = this.getPrimary().getTemperature().ordinal();
|
||||
return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1];
|
||||
}
|
||||
@Override
|
||||
public boolean canTolerate(final EnumTemperature eTemp) {
|
||||
final int temp = eTemp.ordinal();
|
||||
final int[] tempTol = Binnie.Genetics.getTolerance(this.getToleranceTemperature());
|
||||
final int fTemp = this.getPrimary().getTemperature().ordinal();
|
||||
return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1];
|
||||
}
|
||||
}
|
||||
@@ -1,286 +1,261 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
|
||||
import binnie.botany.api.IBotanistTracker;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
import binnie.botany.api.IFlowerGenome;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import binnie.botany.api.EnumFlowerStage;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import binnie.botany.api.IColourMix;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
import binnie.botany.api.IFlower;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import binnie.botany.api.IFlowerRoot;
|
||||
import binnie.botany.api.*;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.*;
|
||||
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;
|
||||
|
||||
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
||||
{
|
||||
public static int flowerSpeciesCount;
|
||||
static final String UID = "rootFlowers";
|
||||
public static ArrayList<IFlower> flowerTemplates;
|
||||
private static ArrayList<IFlowerMutation> flowerMutations;
|
||||
Map<ItemStack, IFlower> conversions;
|
||||
private static ArrayList<IColourMix> colourMixes;
|
||||
import java.util.*;
|
||||
|
||||
public FlowerHelper() {
|
||||
this.conversions = new HashMap<ItemStack, IFlower>();
|
||||
}
|
||||
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
||||
public static int flowerSpeciesCount;
|
||||
static final String UID = "rootFlowers";
|
||||
public static ArrayList<IFlower> flowerTemplates;
|
||||
private static ArrayList<IFlowerMutation> flowerMutations;
|
||||
Map<ItemStack, IFlower> conversions;
|
||||
private static ArrayList<IColourMix> colourMixes;
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
public FlowerHelper() {
|
||||
this.conversions = new HashMap<ItemStack, IFlower>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeciesCount() {
|
||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||
FlowerHelper.flowerSpeciesCount = 0;
|
||||
for (final 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 String getUID() {
|
||||
return "rootFlowers";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(final ItemStack stack) {
|
||||
return stack != null && this.getStageType(stack) != EnumFlowerStage.NONE;
|
||||
}
|
||||
@Override
|
||||
public int getSpeciesCount() {
|
||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||
FlowerHelper.flowerSpeciesCount = 0;
|
||||
for (final 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(final ItemStack stack, final int type) {
|
||||
return this.getStageType(stack).ordinal() == type;
|
||||
}
|
||||
@Override
|
||||
public boolean isMember(final ItemStack stack) {
|
||||
return stack != null && this.getStageType(stack) != EnumFlowerStage.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMember(final IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
}
|
||||
@Override
|
||||
public boolean isMember(ItemStack stack, ISpeciesType type) {
|
||||
return this.getStageType(stack) == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getMemberStack(final IIndividual flower, final int type) {
|
||||
if (!this.isMember(flower)) {
|
||||
return null;
|
||||
}
|
||||
Item flowerItem = Botany.flowerItem;
|
||||
if (type == EnumFlowerStage.SEED.ordinal()) {
|
||||
flowerItem = Botany.seed;
|
||||
}
|
||||
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
||||
flowerItem = Botany.pollen;
|
||||
}
|
||||
if (flowerItem != Botany.flowerItem) {
|
||||
((IFlower) flower).setAge(0);
|
||||
}
|
||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
flower.writeToNBT(nbttagcompound);
|
||||
final ItemStack flowerStack = new ItemStack(flowerItem);
|
||||
flowerStack.setTagCompound(nbttagcompound);
|
||||
return flowerStack;
|
||||
}
|
||||
@Override
|
||||
public boolean isMember(final IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFlowerStage getStageType(final ItemStack stack) {
|
||||
return (stack == null) ? EnumFlowerStage.NONE : ((stack.getItem() == Botany.flowerItem) ? EnumFlowerStage.FLOWER : ((stack.getItem() == Botany.pollen) ? EnumFlowerStage.POLLEN : ((stack.getItem() == Botany.seed) ? EnumFlowerStage.SEED : EnumFlowerStage.NONE)));
|
||||
}
|
||||
@Override
|
||||
public IAlyzerPlugin getAlyzerPlugin() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getMember(final ItemStack stack) {
|
||||
if (!this.isMember(stack)) {
|
||||
return null;
|
||||
}
|
||||
return new Flower(stack.getTagCompound());
|
||||
}
|
||||
@Override
|
||||
public ISpeciesType getIconType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getFlower(final World world, final IFlowerGenome genome) {
|
||||
return new Flower(genome, 2);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getMemberStack(IIndividual flower, ISpeciesType type) {
|
||||
if (!this.isMember(flower)) {
|
||||
return null;
|
||||
}
|
||||
Item flowerItem = Botany.flowerItem;
|
||||
if (type == EnumFlowerStage.SEED) {
|
||||
flowerItem = Botany.seed;
|
||||
}
|
||||
if (type == EnumFlowerStage.POLLEN) {
|
||||
flowerItem = Botany.pollen;
|
||||
}
|
||||
if (flowerItem != Botany.flowerItem) {
|
||||
((IFlower) flower).setAge(0);
|
||||
}
|
||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
flower.writeToNBT(nbttagcompound);
|
||||
final ItemStack flowerStack = new ItemStack(flowerItem);
|
||||
flowerStack.setTagCompound(nbttagcompound);
|
||||
return flowerStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(final IAllele[] template) {
|
||||
return new FlowerGenome(this.templateAsChromosomes(template));
|
||||
}
|
||||
@Override
|
||||
public EnumFlowerStage getStageType(final ItemStack stack) {
|
||||
return (stack == null) ? EnumFlowerStage.NONE : ((stack.getItem() == Botany.flowerItem) ? EnumFlowerStage.FLOWER : ((stack.getItem() == Botany.pollen) ? EnumFlowerStage.POLLEN : ((stack.getItem() == Botany.seed) ? EnumFlowerStage.SEED : EnumFlowerStage.NONE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
||||
return new FlowerGenome(this.templateAsChromosomes(templateActive, templateInactive));
|
||||
}
|
||||
@Override
|
||||
public IFlower getMember(final ItemStack stack) {
|
||||
if (!this.isMember(stack)) {
|
||||
return null;
|
||||
}
|
||||
return new Flower(stack.getTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower templateAsIndividual(final IAllele[] template) {
|
||||
return new Flower(this.templateAsGenome(template), 2);
|
||||
}
|
||||
@Override
|
||||
public IFlower getFlower(final World world, final IFlowerGenome genome) {
|
||||
return new Flower(genome, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower templateAsIndividual(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
||||
return new Flower(this.templateAsGenome(templateActive, templateInactive), 2);
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(final IAllele[] template) {
|
||||
return new FlowerGenome(this.templateAsChromosomes(template));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<IFlower> getIndividualTemplates() {
|
||||
return FlowerHelper.flowerTemplates;
|
||||
}
|
||||
@Override
|
||||
public IFlowerGenome templateAsGenome(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
||||
return new FlowerGenome(this.templateAsChromosomes(templateActive, templateInactive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(final IAllele[] template) {
|
||||
this.registerTemplate(template[0].getUID(), template);
|
||||
}
|
||||
@Override
|
||||
public IFlower templateAsIndividual(final IAllele[] template) {
|
||||
return new Flower(this.templateAsGenome(template), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(final String identifier, final IAllele[] template) {
|
||||
FlowerHelper.flowerTemplates.add(new Flower(this.templateAsGenome(template), 2));
|
||||
if (!this.speciesTemplates.containsKey(identifier)) {
|
||||
this.speciesTemplates.put(identifier, template);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public IFlower templateAsIndividual(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
||||
return new Flower(this.templateAsGenome(templateActive, templateInactive), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate(final String identifier) {
|
||||
return this.speciesTemplates.get(identifier);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<IFlower> getIndividualTemplates() {
|
||||
return FlowerHelper.flowerTemplates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return FlowerTemplates.getDefaultTemplate();
|
||||
}
|
||||
@Override
|
||||
public void registerTemplate(final IAllele[] template) {
|
||||
this.registerTemplate(template[0].getUID(), template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getRandomTemplate(final Random rand) {
|
||||
return this.speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(this.speciesTemplates.values().size())];
|
||||
}
|
||||
@Override
|
||||
public void registerTemplate(final String identifier, final IAllele[] template) {
|
||||
FlowerHelper.flowerTemplates.add(new Flower(this.templateAsGenome(template), 2));
|
||||
if (!this.speciesTemplates.containsKey(identifier)) {
|
||||
this.speciesTemplates.put(identifier, template);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IFlowerMutation> getMutations(final boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||
}
|
||||
return FlowerHelper.flowerMutations;
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getTemplate(final String identifier) {
|
||||
return this.speciesTemplates.get(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMutation(final IMutation mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||
return;
|
||||
}
|
||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
return FlowerTemplates.getDefaultTemplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBotanistTracker getBreedingTracker(final World world, final GameProfile player) {
|
||||
final 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 IAllele[] getRandomTemplate(final Random rand) {
|
||||
return this.speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(this.speciesTemplates.values().size())];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIndividual getMember(final NBTTagCompound compound) {
|
||||
return new Flower(compound);
|
||||
}
|
||||
@Override
|
||||
public ArrayList<IFlowerMutation> getMutations(final boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||
}
|
||||
return FlowerHelper.flowerMutations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getMemberClass() {
|
||||
return IFlower.class;
|
||||
}
|
||||
@Override
|
||||
public void registerMutation(final IMutation mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||
return;
|
||||
}
|
||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumFlowerChromosome.values();
|
||||
}
|
||||
@Override
|
||||
public IBotanistTracker getBreedingTracker(final World world, final GameProfile player) {
|
||||
final 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 IChromosomeType getKaryotypeKey() {
|
||||
return EnumFlowerChromosome.SPECIES;
|
||||
}
|
||||
@Override
|
||||
public IIndividual getMember(final NBTTagCompound compound) {
|
||||
return new Flower(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConversion(final ItemStack itemstack, final IAllele[] template) {
|
||||
final IFlower flower = this.getFlower(null, this.templateAsGenome(template));
|
||||
this.conversions.put(itemstack, flower);
|
||||
}
|
||||
@Override
|
||||
public Class getMemberClass() {
|
||||
return IFlower.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getConversion(final ItemStack itemstack) {
|
||||
for (final Map.Entry<ItemStack, IFlower> entry : this.conversions.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(itemstack)) {
|
||||
return (IFlower) entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumFlowerChromosome.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerColourMix(final IColourMix colourMix) {
|
||||
FlowerHelper.colourMixes.add(colourMix);
|
||||
}
|
||||
@Override
|
||||
public IChromosomeType getSpeciesChromosomeType() {
|
||||
return EnumFlowerChromosome.SPECIES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IColourMix> getColourMixes(final boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.colourMixes);
|
||||
}
|
||||
return FlowerHelper.colourMixes;
|
||||
}
|
||||
|
||||
static {
|
||||
FlowerHelper.flowerSpeciesCount = -1;
|
||||
FlowerHelper.flowerTemplates = new ArrayList<IFlower>();
|
||||
FlowerHelper.flowerMutations = new ArrayList<IFlowerMutation>();
|
||||
FlowerHelper.colourMixes = new ArrayList<IColourMix>();
|
||||
}
|
||||
@Override
|
||||
public void addConversion(final ItemStack itemstack, final IAllele[] template) {
|
||||
final IFlower flower = this.getFlower(null, this.templateAsGenome(template));
|
||||
this.conversions.put(itemstack, flower);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlower getConversion(final ItemStack itemstack) {
|
||||
for (final Map.Entry<ItemStack, IFlower> entry : this.conversions.entrySet()) {
|
||||
if (entry.getKey().isItemEqual(itemstack)) {
|
||||
return (IFlower) entry.getValue().copy();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerColourMix(final IColourMix colourMix) {
|
||||
FlowerHelper.colourMixes.add(colourMix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IColourMix> getColourMixes(final boolean shuffle) {
|
||||
if (shuffle) {
|
||||
Collections.shuffle(FlowerHelper.colourMixes);
|
||||
}
|
||||
return FlowerHelper.colourMixes;
|
||||
}
|
||||
|
||||
static {
|
||||
FlowerHelper.flowerSpeciesCount = -1;
|
||||
FlowerHelper.flowerTemplates = new ArrayList<IFlower>();
|
||||
FlowerHelper.flowerMutations = new ArrayList<IFlowerMutation>();
|
||||
FlowerHelper.colourMixes = new ArrayList<IColourMix>();
|
||||
}
|
||||
|
||||
|
||||
//TODO ??
|
||||
@Override
|
||||
public ISpeciesType getType(ItemStack itemstack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// ??
|
||||
@Override
|
||||
public ISpeciesType getType(ItemStack itemstack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,89 +1,84 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
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;
|
||||
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.IFlowerMutation;
|
||||
public class FlowerMutation implements IFlowerMutation {
|
||||
IAlleleFlowerSpecies allele0;
|
||||
IAlleleFlowerSpecies allele1;
|
||||
IAllele[] template;
|
||||
int chance;
|
||||
|
||||
public class FlowerMutation implements IFlowerMutation
|
||||
{
|
||||
IAlleleFlowerSpecies allele0;
|
||||
IAlleleFlowerSpecies allele1;
|
||||
IAllele[] template;
|
||||
int chance;
|
||||
FlowerMutation(final IAlleleFlowerSpecies allele0, final IAlleleFlowerSpecies allele1, final IAllele[] template, final int chance) {
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
FlowerMutation(final IAlleleFlowerSpecies allele0, final IAlleleFlowerSpecies allele1, final IAllele[] template, final int chance) {
|
||||
this.allele0 = allele0;
|
||||
this.allele1 = allele1;
|
||||
this.template = template;
|
||||
this.chance = chance;
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele0() {
|
||||
return this.allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele0() {
|
||||
return this.allele0;
|
||||
}
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele1() {
|
||||
return this.allele1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleFlowerSpecies getAllele1() {
|
||||
return this.allele1;
|
||||
}
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return this.template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
return this.template;
|
||||
}
|
||||
@Override
|
||||
public float getBaseChance() {
|
||||
return this.chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBaseChance() {
|
||||
return this.chance;
|
||||
}
|
||||
@Override
|
||||
public boolean isPartner(final IAllele allele) {
|
||||
return allele.getUID().equals(this.allele0.getUID()) || allele.getUID().equals(this.allele1.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPartner(final IAllele allele) {
|
||||
return allele.getUID().equals(this.allele0.getUID()) || allele.getUID().equals(this.allele1.getUID());
|
||||
}
|
||||
@Override
|
||||
public IAllele getPartner(final IAllele allele) {
|
||||
return allele.getUID().equals(this.allele0.getUID()) ? this.allele1 : this.allele0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllele getPartner(final IAllele allele) {
|
||||
return allele.getUID().equals(this.allele0.getUID()) ? this.allele1 : this.allele0;
|
||||
}
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSecret() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public float getChance(final IAllele allele0, final IAllele allele1, final IGenome genome0, final IGenome genome1) {
|
||||
if (allele0 == null || allele1 == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
return this.getBaseChance();
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
return this.getBaseChance();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IAllele allele0, final IAllele allele1, final IGenome genome0, final IGenome genome1) {
|
||||
if (allele0 == null || allele1 == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||
return this.getBaseChance();
|
||||
}
|
||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||
return this.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<String>();
|
||||
}
|
||||
@Override
|
||||
public Collection<String> getSpecialConditions() {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,29 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.botany.api.EnumFlowerChromosome;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class FlowerTemplates
|
||||
{
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
final IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.Poppy;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.fertilityNormal");
|
||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.territoryDefault");
|
||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.lifespanNormal");
|
||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.sappinessAverage");
|
||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = EnumFlowerColor.Green.getAllele();
|
||||
return alleles;
|
||||
}
|
||||
public class FlowerTemplates {
|
||||
public static IAllele[] getDefaultTemplate() {
|
||||
final IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.Poppy;
|
||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.fertilityNormal");
|
||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.territoryDefault");
|
||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.lifespanNormal");
|
||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.sappinessAverage");
|
||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = EnumFlowerColor.Green.getAllele();
|
||||
return alleles;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +1,64 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.botany.core.BotanyGUI;
|
||||
import net.minecraft.world.World;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemDictionary extends Item
|
||||
{
|
||||
IIcon iconMaster;
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||
this.iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||
}
|
||||
public class ItemDictionary extends Item {
|
||||
// IIcon iconMaster;
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||
// this.iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIconFromDamage(final int par1) {
|
||||
// return (par1 == 0) ? this.itemIcon : this.iconMaster;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return (par1 == 0) ? this.itemIcon : this.iconMaster;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
||||
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
||||
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
public ItemDictionary() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("database");
|
||||
this.setMaxStackSize(1);
|
||||
setRegistryName("database");
|
||||
}
|
||||
|
||||
public ItemDictionary() {
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("database");
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
// @Override
|
||||
// public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
|
||||
// if (itemstack.getItemDamage() == 0) {
|
||||
// Botany.proxy.openGui(BotanyGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
// }
|
||||
// else {
|
||||
// Botany.proxy.openGui(BotanyGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
// }
|
||||
// return itemstack;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
|
||||
if (itemstack.getItemDamage() == 0) {
|
||||
Botany.proxy.openGui(BotanyGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
else {
|
||||
Botany.proxy.openGui(BotanyGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (i.getItemDamage() == 0) ? "Botanist Database" : "Master Botanist Database";
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (i.getItemDamage() == 0) ? "Botanist Database" : "Master Botanist Database";
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,36 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemEncyclopedia extends Item
|
||||
{
|
||||
boolean reinforced;
|
||||
public class ItemEncyclopedia extends Item {
|
||||
boolean reinforced;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "encylopedia" + (this.reinforced ? "Iron" : ""));
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "encylopedia" + (this.reinforced ? "Iron" : ""));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public IIcon getIconFromDamage(final int par1) {
|
||||
// return this.itemIcon;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.itemIcon;
|
||||
}
|
||||
public ItemEncyclopedia(final boolean reinforced) {
|
||||
this.reinforced = false;
|
||||
this.reinforced = reinforced;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("encylopedia" + (reinforced ? "Iron" : ""));
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(reinforced ? 480 : 120);
|
||||
setRegistryName("encylopedia" + (reinforced ? "Iron" : ""));
|
||||
}
|
||||
|
||||
public ItemEncyclopedia(final boolean reinforced) {
|
||||
this.reinforced = false;
|
||||
this.reinforced = reinforced;
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
this.setUnlocalizedName("encylopedia" + (reinforced ? "Iron" : ""));
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(reinforced ? 480 : 120);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (this.reinforced ? "Reinforced " : "") + "Florist's Encyclopaedia";
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack i) {
|
||||
return (this.reinforced ? "Reinforced " : "") + "Florist's Encyclopaedia";
|
||||
}
|
||||
}
|
||||
@@ -1,84 +1,72 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.flower.RendererBotany;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.botany.flower.ItemSeed;
|
||||
import binnie.botany.flower.ItemPollen;
|
||||
import binnie.botany.flower.ItemFlower;
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.flower.BlockFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.flower.*;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.IInitializable;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class ModuleGenetics implements IInitializable
|
||||
{
|
||||
static AlleleEffectNone alleleEffectNone;
|
||||
public class ModuleGenetics implements IInitializable {
|
||||
static AlleleEffectNone 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();
|
||||
Botany.encyclopedia = new ItemEncyclopedia(false);
|
||||
Botany.encyclopediaIron = new ItemEncyclopedia(true);
|
||||
}
|
||||
@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.register(Botany.flower);
|
||||
GameRegistry.register(new ItemBlock(Botany.flower).setRegistryName(Botany.flower.getRegistryName()));
|
||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||
Botany.database = new ItemDictionary();
|
||||
Botany.encyclopedia = new ItemEncyclopedia(false);
|
||||
Botany.encyclopediaIron = new ItemEncyclopedia(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
for (final EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||
}
|
||||
FlowerSpecies.setupVariants();
|
||||
for (final FlowerSpecies species : FlowerSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||
for (final IAllele[] variant : species.getVariants()) {
|
||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||
}
|
||||
}
|
||||
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
for (final EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||
}
|
||||
FlowerSpecies.setupVariants();
|
||||
for (final FlowerSpecies species : FlowerSpecies.values()) {
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||
for (final IAllele[] variant : species.getVariants()) {
|
||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||
}
|
||||
}
|
||||
//TODO RENDERING
|
||||
// RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Blocks.red_flower, 1, 32767), 'b', Items.book }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Blocks.yellow_flower, 1, 32767), 'b', Items.book }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Botany.flower, 1, 32767), 'b', Items.book }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.encyclopediaIron), new Object[] { new ItemStack(Botany.encyclopedia), "ingotIron" }));
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, new String[] { "flowersVanilla" });
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), (ItemStack) null, new ItemStack(Botany.database), new Object[] { "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() {
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[]{"fff", "fbf", "fff", 'f', new ItemStack(Blocks.RED_FLOWER, 1, 32767), 'b', Items.BOOK}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[]{"fff", "fbf", "fff", 'f', new ItemStack(Blocks.YELLOW_FLOWER, 1, 32767), 'b', Items.BOOK}));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[]{"fff", "fbf", "fff", 'f', new ItemStack(Botany.flower, 1, 32767), 'b', Items.BOOK}));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.encyclopediaIron), new Object[]{new ItemStack(Botany.encyclopedia), "ingotIron"}));
|
||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, new String[]{"flowersVanilla"});
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), (ItemStack) null, new ItemStack(Botany.database), new Object[]{"X#X", "YEY", "RDR", '#', Blocks.GLASS_PANE, 'X', Items.GOLD_INGOT, 'Y', Items.GOLD_NUGGET, 'R', Items.REDSTONE, 'D', Items.DIAMOND, 'E', Items.EMERALD});
|
||||
}
|
||||
|
||||
static {
|
||||
ModuleGenetics.alleleEffectNone = new AlleleEffectNone();
|
||||
}
|
||||
static {
|
||||
ModuleGenetics.alleleEffectNone = new AlleleEffectNone();
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,56 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.List;
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.core.item.IItemMisc;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum BotanyItems implements IItemMisc
|
||||
{
|
||||
AshPowder("Ash Powder", "powderAsh"),
|
||||
PulpPowder("Wood Pulp Powder", "powderPulp"),
|
||||
MulchPowder("Mulch Powder", "powderMulch"),
|
||||
SulphurPowder("Sulphur Powder", "powderSulphur"),
|
||||
FertiliserPowder("Fertiliser Powder", "powderFertiliser"),
|
||||
CompostPowder("Compost Powder", "powderCompost"),
|
||||
Mortar("Mortar", "mortar"),
|
||||
Weedkiller("Weedkiller", "weedkiller");
|
||||
import java.util.List;
|
||||
|
||||
IIcon icon;
|
||||
String name;
|
||||
String iconPath;
|
||||
public enum BotanyItems implements IItemMisc {
|
||||
AshPowder("Ash Powder", "powderAsh"),
|
||||
PulpPowder("Wood Pulp Powder", "powderPulp"),
|
||||
MulchPowder("Mulch Powder", "powderMulch"),
|
||||
SulphurPowder("Sulphur Powder", "powderSulphur"),
|
||||
FertiliserPowder("Fertiliser Powder", "powderFertiliser"),
|
||||
CompostPowder("Compost Powder", "powderCompost"),
|
||||
Mortar("Mortar", "mortar"),
|
||||
Weedkiller("Weedkiller", "weedkiller");
|
||||
|
||||
private BotanyItems(final String name, final String iconPath) {
|
||||
this.name = name;
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
// IIcon icon;
|
||||
String name;
|
||||
String iconPath;
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final ItemStack stack) {
|
||||
return this.icon;
|
||||
}
|
||||
private BotanyItems(final String name, final String iconPath) {
|
||||
this.name = name;
|
||||
this.iconPath = iconPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.icon = Botany.proxy.getIcon(register, this.iconPath);
|
||||
}
|
||||
// @Override
|
||||
// public IIcon getIcon(final ItemStack stack) {
|
||||
// return this.icon;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.icon = Botany.proxy.getIcon(register, this.iconPath);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void addInformation(final List par3List) {
|
||||
}
|
||||
@Override
|
||||
public void addInformation(final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(final ItemStack stack) {
|
||||
return this.name;
|
||||
}
|
||||
@Override
|
||||
public String getName(final ItemStack stack) {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack get(final int size) {
|
||||
return new ItemStack(Botany.misc, size, this.ordinal());
|
||||
}
|
||||
@Override
|
||||
public ItemStack get(final int size) {
|
||||
return new ItemStack(Botany.misc, size, this.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,46 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.items;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemClay extends Item
|
||||
{
|
||||
public ItemClay() {
|
||||
this.setUnlocalizedName("clay");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
final int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
public class ItemClay extends Item {
|
||||
public ItemClay() {
|
||||
this.setUnlocalizedName("clay");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName("clay");
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
// final int damage = stack.getItemDamage();
|
||||
// return EnumFlowerColor.get(damage).getColor(false);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Clay";
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Clay";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||
// }
|
||||
}
|
||||
@@ -1,51 +1,47 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.items;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import java.util.List;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPigment extends Item
|
||||
{
|
||||
public ItemPigment() {
|
||||
this.setUnlocalizedName("pigment");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
import java.util.List;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
final int damage = stack.getItemDamage();
|
||||
return EnumFlowerColor.get(damage).getColor(false);
|
||||
}
|
||||
public class ItemPigment extends Item {
|
||||
public ItemPigment() {
|
||||
this.setUnlocalizedName("pigment");
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName("pigment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Pigment";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
||||
// final int damage = stack.getItemDamage();
|
||||
// return EnumFlowerColor.get(damage).getColor(false);
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
this.itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||
}
|
||||
@Override
|
||||
public String getItemStackDisplayName(final ItemStack stack) {
|
||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Pigment";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void registerIcons(final IIconRegister register) {
|
||||
// this.itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||
// }
|
||||
}
|
||||
@@ -1,54 +1,50 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.network;
|
||||
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import java.io.IOException;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.network.packet.MessageCoordinates;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class MessageFlowerUpdate extends MessageCoordinates
|
||||
{
|
||||
public TileEntityFlower.RenderInfo render;
|
||||
import java.io.IOException;
|
||||
|
||||
public MessageFlowerUpdate(final int posX, final int posY, final int posZ, final TileEntityFlower.RenderInfo render) {
|
||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||
this.render = render;
|
||||
}
|
||||
public class MessageFlowerUpdate extends MessageCoordinates {
|
||||
public TileEntityFlower.RenderInfo render;
|
||||
|
||||
public MessageFlowerUpdate(final MessageBinnie message) {
|
||||
super(message);
|
||||
}
|
||||
public MessageFlowerUpdate(final int posX, final int posY, final int posZ, final TileEntityFlower.RenderInfo render) {
|
||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||
this.render = render;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(final ByteBuf data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeByte(this.render.primary.getID());
|
||||
data.writeByte(this.render.secondary.getID());
|
||||
data.writeByte(this.render.stem.getID());
|
||||
data.writeByte(this.render.type.ordinal());
|
||||
data.writeByte(this.render.age);
|
||||
data.writeByte(this.render.section);
|
||||
data.writeBoolean(this.render.wilted);
|
||||
data.writeBoolean(this.render.flowered);
|
||||
}
|
||||
public MessageFlowerUpdate(final MessageBinnie message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(final ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
this.render = new TileEntityFlower.RenderInfo();
|
||||
this.render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.type = EnumFlowerType.values()[data.readByte()];
|
||||
this.render.age = data.readByte();
|
||||
this.render.section = data.readByte();
|
||||
this.render.wilted = data.readBoolean();
|
||||
this.render.flowered = data.readBoolean();
|
||||
}
|
||||
@Override
|
||||
public void writeData(final ByteBuf data) throws IOException {
|
||||
super.writeData(data);
|
||||
data.writeByte(this.render.primary.getID());
|
||||
data.writeByte(this.render.secondary.getID());
|
||||
data.writeByte(this.render.stem.getID());
|
||||
data.writeByte(this.render.type.ordinal());
|
||||
data.writeByte(this.render.age);
|
||||
data.writeByte(this.render.section);
|
||||
data.writeBoolean(this.render.wilted);
|
||||
data.writeBoolean(this.render.flowered);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(final ByteBuf data) throws IOException {
|
||||
super.readData(data);
|
||||
this.render = new TileEntityFlower.RenderInfo();
|
||||
this.render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||
this.render.type = EnumFlowerType.values()[data.readByte()];
|
||||
this.render.age = data.readByte();
|
||||
this.render.section = data.readByte();
|
||||
this.render.wilted = data.readBoolean();
|
||||
this.render.flowered = data.readBoolean();
|
||||
}
|
||||
}
|
||||
@@ -1,90 +1,76 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.network;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import binnie.botany.flower.TileEntityFlower;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import binnie.botany.genetics.EnumFlowerColor;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.network.IPacketID;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public enum PacketID implements IPacketID
|
||||
{
|
||||
Encylopedia,
|
||||
FlowerUpdate;
|
||||
public enum PacketID implements IPacketID {
|
||||
Encylopedia,
|
||||
FlowerUpdate;
|
||||
|
||||
@Override
|
||||
public void onMessage(final MessageBinnie message, final MessageContext context) {
|
||||
if (this == PacketID.Encylopedia && context.side == Side.CLIENT) {
|
||||
final MessageNBT packet = new MessageNBT(message);
|
||||
final NBTTagCompound data = packet.getTagCompound();
|
||||
final 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 {
|
||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
final IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
final float age = data.getFloat("Age");
|
||||
final EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
final 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";
|
||||
}
|
||||
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 (age == 0.0f) {
|
||||
info += " Germling";
|
||||
}
|
||||
if (data.getBoolean("Wilting")) {
|
||||
info += ". Shame it is Wilting!";
|
||||
}
|
||||
}
|
||||
final IChatComponent chat = new ChatComponentText(info);
|
||||
player.addChatMessage(chat);
|
||||
}
|
||||
else if (this == PacketID.FlowerUpdate) {
|
||||
final MessageFlowerUpdate packet2 = new MessageFlowerUpdate(message);
|
||||
final TileEntity tile = packet2.getTileEntity(BinnieCore.proxy.getWorld());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).setRender(packet2.render);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onMessage(final MessageBinnie message, final MessageContext context) {
|
||||
if (this == PacketID.Encylopedia && context.side == Side.CLIENT) {
|
||||
final MessageNBT packet = new MessageNBT(message);
|
||||
final NBTTagCompound data = packet.getTagCompound();
|
||||
final 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 {
|
||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||
final IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||
final float age = data.getFloat("Age");
|
||||
final EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||
final 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";
|
||||
}
|
||||
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 (age == 0.0f) {
|
||||
info += " Germling";
|
||||
}
|
||||
if (data.getBoolean("Wilting")) {
|
||||
info += ". Shame it is Wilting!";
|
||||
}
|
||||
}
|
||||
player.addChatMessage(new TextComponentString(info));
|
||||
} else if (this == PacketID.FlowerUpdate) {
|
||||
final MessageFlowerUpdate packet2 = new MessageFlowerUpdate(message);
|
||||
final TileEntity tile = packet2.getTileEntity(BinnieCore.proxy.getWorld());
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).setRender(packet2.render);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
|
||||
public interface IBotanyProxy extends IProxyCore
|
||||
{
|
||||
public interface IBotanyProxy extends IProxyCore {
|
||||
}
|
||||
@@ -1,15 +1,10 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.core.proxy.BinnieModProxy;
|
||||
|
||||
public class Proxy extends BinnieModProxy implements IBotanyProxy
|
||||
{
|
||||
public Proxy() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
public class Proxy extends BinnieModProxy implements IBotanyProxy {
|
||||
public Proxy() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
public class ProxyClient extends Proxy implements IBotanyProxy
|
||||
{
|
||||
public class ProxyClient extends Proxy implements IBotanyProxy {
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.botany.proxy;
|
||||
|
||||
public class ProxyServer extends Proxy implements IBotanyProxy
|
||||
{
|
||||
public class ProxyServer extends Proxy implements IBotanyProxy {
|
||||
}
|
||||
@@ -1,143 +1,139 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import binnie.core.mod.parser.FieldParser;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.mod.parser.FieldParser;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.LinkedHashSet;
|
||||
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import binnie.core.network.IPacketProvider;
|
||||
import binnie.core.network.packet.MessageBinnie;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable
|
||||
{
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
private LinkedHashSet<Field> fields;
|
||||
protected List<IInitializable> modules;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
public AbstractMod() {
|
||||
this.fields = new LinkedHashSet<Field>();
|
||||
this.modules = new ArrayList<IInitializable>();
|
||||
BinnieCore.registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||
private SimpleNetworkWrapper wrapper;
|
||||
private LinkedHashSet<Field> fields;
|
||||
protected List<IInitializable> modules;
|
||||
|
||||
public abstract boolean isActive();
|
||||
public AbstractMod() {
|
||||
this.fields = new LinkedHashSet<Field>();
|
||||
this.modules = new ArrayList<IInitializable>();
|
||||
BinnieCore.registerMod(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract String getChannel();
|
||||
public abstract boolean isActive();
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return new IPacketID[0];
|
||||
}
|
||||
@Override
|
||||
public abstract String getChannel();
|
||||
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return new IBinnieGUID[0];
|
||||
}
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return new IPacketID[0];
|
||||
}
|
||||
|
||||
public Class[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return new IBinnieGUID[0];
|
||||
}
|
||||
|
||||
public abstract IProxyCore getProxy();
|
||||
public Class[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
public abstract String getModID();
|
||||
public abstract IProxyCore getProxy();
|
||||
|
||||
public SimpleNetworkWrapper getNetworkWrapper() {
|
||||
return this.wrapper;
|
||||
}
|
||||
public abstract String getModID();
|
||||
|
||||
protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
|
||||
public SimpleNetworkWrapper getNetworkWrapper() {
|
||||
return this.wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
if (this.getConfigs() != null) {
|
||||
for (final Class cls : this.getConfigs()) {
|
||||
Binnie.Configuration.registerConfiguration(cls, this);
|
||||
}
|
||||
}
|
||||
this.getProxy().preInit();
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.preInit();
|
||||
}
|
||||
for (final Field field : this.getClass().getFields()) {
|
||||
this.fields.add(field);
|
||||
}
|
||||
for (final Class cls : this.getClass().getClasses()) {
|
||||
for (final Field field2 : this.getClass().getFields()) {
|
||||
this.fields.add(field2);
|
||||
}
|
||||
}
|
||||
for (final IInitializable module : this.modules) {
|
||||
for (final Field field3 : module.getClass().getFields()) {
|
||||
this.fields.add(field3);
|
||||
}
|
||||
}
|
||||
for (final Field field4 : this.fields) {
|
||||
try {
|
||||
FieldParser.preInitParse(field4, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected abstract Class<? extends BinniePacketHandler> getPacketHandler();
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
this.getProxy().init();
|
||||
(this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(this.getChannel())).registerMessage((Class) this.getPacketHandler(), (Class) MessageBinnie.class, 1, Side.CLIENT);
|
||||
this.wrapper.registerMessage((Class) this.getPacketHandler(), (Class) MessageBinnie.class, 1, Side.SERVER);
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.init();
|
||||
}
|
||||
for (final Field field : this.fields) {
|
||||
try {
|
||||
FieldParser.initParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
if (this.getConfigs() != null) {
|
||||
for (final Class cls : this.getConfigs()) {
|
||||
Binnie.Configuration.registerConfiguration(cls, this);
|
||||
}
|
||||
}
|
||||
this.getProxy().preInit();
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.preInit();
|
||||
}
|
||||
for (final Field field : this.getClass().getFields()) {
|
||||
this.fields.add(field);
|
||||
}
|
||||
for (final Class cls : this.getClass().getClasses()) {
|
||||
for (final Field field2 : this.getClass().getFields()) {
|
||||
this.fields.add(field2);
|
||||
}
|
||||
}
|
||||
for (final IInitializable module : this.modules) {
|
||||
for (final Field field3 : module.getClass().getFields()) {
|
||||
this.fields.add(field3);
|
||||
}
|
||||
}
|
||||
for (final Field field4 : this.fields) {
|
||||
try {
|
||||
FieldParser.preInitParse(field4, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
this.getProxy().postInit();
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.postInit();
|
||||
}
|
||||
for (final Field field : this.fields) {
|
||||
try {
|
||||
FieldParser.postInitParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
this.getProxy().init();
|
||||
(this.wrapper = NetworkRegistry.INSTANCE.newSimpleChannel(this.getChannel())).registerMessage((Class) this.getPacketHandler(), (Class) MessageBinnie.class, 1, Side.CLIENT);
|
||||
this.wrapper.registerMessage((Class) this.getPacketHandler(), (Class) MessageBinnie.class, 1, Side.SERVER);
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.init();
|
||||
}
|
||||
for (final Field field : this.fields) {
|
||||
try {
|
||||
FieldParser.initParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected final void addModule(final IInitializable init) {
|
||||
this.modules.add(init);
|
||||
MinecraftForge.EVENT_BUS.register(init);
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
if (!this.isActive()) {
|
||||
return;
|
||||
}
|
||||
this.getProxy().postInit();
|
||||
for (final IInitializable module : this.modules) {
|
||||
module.postInit();
|
||||
}
|
||||
for (final Field field : this.fields) {
|
||||
try {
|
||||
FieldParser.postInitParse(field, this);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected final void addModule(final IInitializable init) {
|
||||
this.modules.add(init);
|
||||
MinecraftForge.EVENT_BUS.register(init);
|
||||
}
|
||||
}
|
||||
@@ -1,238 +1,229 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.mod.config.ConfigurationMain;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import binnie.core.network.BinnieCorePacketID;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IBinnieProxy;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import java.util.ArrayList;
|
||||
import forestry.plugins.PluginManager;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import binnie.core.block.MultipassBlockRenderer;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import binnie.core.gui.BinnieGUIHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import binnie.core.mod.parser.ItemParser;
|
||||
import binnie.core.mod.parser.FieldParser;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import binnie.core.liquid.ItemFluidContainer;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.gui.BinnieCoreGUI;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import binnie.core.triggers.ModuleTrigger;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import binnie.core.item.ModuleItems;
|
||||
import binnie.core.machines.storage.ModuleStorage;
|
||||
import binnie.craftgui.minecraft.ModuleCraftGUI;
|
||||
import binnie.core.mod.config.ConfigurationMods;
|
||||
import binnie.Binnie;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import binnie.core.block.TileEntityMetadata;
|
||||
import binnie.core.gui.BinnieCoreGUI;
|
||||
import binnie.core.gui.BinnieGUIHandler;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.item.ItemFieldKit;
|
||||
import binnie.core.item.ItemGenesis;
|
||||
import binnie.core.item.ModuleItems;
|
||||
import binnie.core.liquid.FluidContainer;
|
||||
import binnie.core.liquid.ItemFluidContainer;
|
||||
import binnie.core.machines.MachineGroup;
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import binnie.core.machines.storage.ModuleStorage;
|
||||
import binnie.core.mod.config.ConfigurationMain;
|
||||
import binnie.core.mod.config.ConfigurationMods;
|
||||
import binnie.core.mod.parser.FieldParser;
|
||||
import binnie.core.mod.parser.ItemParser;
|
||||
import binnie.core.network.BinnieCorePacketID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.BinnieProxy;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import binnie.core.proxy.IBinnieProxy;
|
||||
import binnie.core.triggers.ModuleTrigger;
|
||||
import binnie.craftgui.minecraft.ModuleCraftGUI;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.plugins.PluginManager;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Mod(modid = "BinnieCore", name = "Binnie Core", useMetadata = true)
|
||||
public final 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;
|
||||
public static MachineGroup packageCompartment;
|
||||
public static ItemGenesis genesis;
|
||||
public static ItemFieldKit fieldKit;
|
||||
public final 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;
|
||||
public static MachineGroup packageCompartment;
|
||||
public static ItemGenesis genesis;
|
||||
public static ItemFieldKit fieldKit;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (final ManagerBase baseManager : Binnie.Managers) {
|
||||
this.addModule(baseManager);
|
||||
}
|
||||
this.addModule(new ModuleCraftGUI());
|
||||
this.addModule(new ModuleStorage());
|
||||
this.addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
this.addModule(new ModuleTrigger());
|
||||
}
|
||||
this.preInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void preInit(final FMLPreInitializationEvent evt) {
|
||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||
for (final ManagerBase baseManager : Binnie.Managers) {
|
||||
this.addModule(baseManager);
|
||||
}
|
||||
this.addModule(new ModuleCraftGUI());
|
||||
this.addModule(new ModuleStorage());
|
||||
this.addModule(new ModuleItems());
|
||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||
this.addModule(new ModuleTrigger());
|
||||
}
|
||||
this.preInit();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
this.init();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void init(final FMLInitializationEvent evt) {
|
||||
this.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
this.postInit();
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void postInit(final FMLPostInitializationEvent evt) {
|
||||
this.postInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BinnieCoreGUI.values();
|
||||
}
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BinnieCoreGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
BinnieCore.instance = this;
|
||||
for (final FluidContainer container : FluidContainer.values()) {
|
||||
final Item item = new ItemFluidContainer(container);
|
||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
||||
}
|
||||
FieldParser.parsers.add(new ItemParser());
|
||||
super.preInit();
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
BinnieCore.instance = this;
|
||||
for (final FluidContainer container : FluidContainer.values()) {
|
||||
final Item item = new ItemFluidContainer(container);
|
||||
GameRegistry.register(item);
|
||||
}
|
||||
FieldParser.parsers.add(new ItemParser());
|
||||
super.preInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
for (final AbstractMod mod : getActiveMods()) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod));
|
||||
}
|
||||
BinnieCore.multipassRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer());
|
||||
GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata");
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
for (final AbstractMod mod : getActiveMods()) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new BinnieGUIHandler(mod));
|
||||
}
|
||||
//TODO RENDERING
|
||||
// BinnieCore.multipassRenderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
// RenderingRegistry.registerBlockHandler(new MultipassBlockRenderer());
|
||||
GameRegistry.registerTileEntity(TileEntityMetadata.class, "binnie.tile.metadata");
|
||||
}
|
||||
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.Module.LEPIDOPTEROLOGY.isEnabled();
|
||||
}
|
||||
public static boolean isLepidopteryActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.lepidopterology.PluginLepidopterology);
|
||||
}
|
||||
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.Module.APICULTURE.isEnabled();
|
||||
}
|
||||
public static boolean isApicultureActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.arboriculture.PluginArboriculture);
|
||||
}
|
||||
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
||||
}
|
||||
public static boolean isArboricultureActive() {
|
||||
return PluginManager.configDisabledPlugins.stream().noneMatch(e -> e instanceof forestry.arboriculture.PluginArboriculture);
|
||||
}
|
||||
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
public static boolean isBotanyActive() {
|
||||
return ConfigurationMods.botany;
|
||||
}
|
||||
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
public static boolean isGeneticsActive() {
|
||||
return ConfigurationMods.genetics;
|
||||
}
|
||||
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ConfigurationMods.extraBees && isApicultureActive();
|
||||
}
|
||||
public static boolean isExtraBeesActive() {
|
||||
return ConfigurationMods.extraBees && isApicultureActive();
|
||||
}
|
||||
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
public static boolean isExtraTreesActive() {
|
||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
}
|
||||
|
||||
static void registerMod(final AbstractMod mod) {
|
||||
BinnieCore.modList.add(mod);
|
||||
}
|
||||
static void registerMod(final AbstractMod mod) {
|
||||
BinnieCore.modList.add(mod);
|
||||
}
|
||||
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
final List<AbstractMod> list = new ArrayList<AbstractMod>();
|
||||
for (final AbstractMod mod : BinnieCore.modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private static List<AbstractMod> getActiveMods() {
|
||||
final List<AbstractMod> list = new ArrayList<AbstractMod>();
|
||||
for (final AbstractMod mod : BinnieCore.modList) {
|
||||
if (mod.isActive()) {
|
||||
list.add(mod);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSpeciesDiscovered(final ForestryEvent.SpeciesDiscovered event) {
|
||||
try {
|
||||
final EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(event.username.getName());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
event.tracker.synchToPlayer(player);
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("species", event.species.getUID());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleSpeciesDiscovered(final ForestryEvent.SpeciesDiscovered event) {
|
||||
try {
|
||||
final EntityPlayerMP player = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerByUUID(event.username.getId());
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
event.tracker.synchToPlayer(player);
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setString("species", event.species.getUID());
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BIN";
|
||||
}
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BIN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieProxy getProxy() {
|
||||
return BinnieCore.proxy;
|
||||
}
|
||||
@Override
|
||||
public IBinnieProxy getProxy() {
|
||||
return BinnieCore.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "binniecore";
|
||||
}
|
||||
@Override
|
||||
public String getModID() {
|
||||
return "binniecore";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return BinnieCorePacketID.values();
|
||||
}
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return BinnieCorePacketID.values();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(final TextureStitchEvent.Pre event) {
|
||||
if (event.map.getTextureType() == 0) {
|
||||
Binnie.Liquid.reloadIcons(event.map);
|
||||
}
|
||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||
}
|
||||
//TODO RENDERING
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void handleTextureRemap(final TextureStitchEvent.Pre event) {
|
||||
// if (event.map.getTextureType() == 0) {
|
||||
// Binnie.Liquid.reloadIcons(event.map);
|
||||
// }
|
||||
Binnie.Resource.registerIcons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[] { ConfigurationMain.class };
|
||||
}
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[]{ConfigurationMain.class};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static {
|
||||
BinnieCore.modList = new ArrayList<AbstractMod>();
|
||||
}
|
||||
static {
|
||||
BinnieCore.modList = new ArrayList<AbstractMod>();
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler
|
||||
{
|
||||
public PacketHandler() {
|
||||
super(BinnieCore.instance);
|
||||
}
|
||||
}
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(BinnieCore.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
public interface IInitializable
|
||||
{
|
||||
void preInit();
|
||||
public interface IInitializable {
|
||||
void preInit();
|
||||
|
||||
void init();
|
||||
void init();
|
||||
|
||||
void postInit();
|
||||
void postInit();
|
||||
}
|
||||
@@ -1,26 +1,21 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import binnie.Binnie;
|
||||
|
||||
public abstract class ManagerBase implements IInitializable
|
||||
{
|
||||
public ManagerBase() {
|
||||
Binnie.Managers.add(this);
|
||||
}
|
||||
public abstract class ManagerBase implements IInitializable {
|
||||
public ManagerBase() {
|
||||
Binnie.Managers.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
}
|
||||
@Override
|
||||
public void preInit() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
@Override
|
||||
public void postInit() {
|
||||
}
|
||||
}
|
||||
@@ -1,97 +1,93 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core;
|
||||
|
||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import cpw.mods.fml.common.versioning.Restriction;
|
||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.versioning.ArtifactVersion;
|
||||
import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion;
|
||||
import net.minecraftforge.fml.common.versioning.Restriction;
|
||||
|
||||
public class Mods
|
||||
{
|
||||
public static Mod Forestry;
|
||||
public static Mod IC2;
|
||||
public static Mod Botania;
|
||||
private static boolean WARN;
|
||||
public class Mods {
|
||||
public static Mod Forestry;
|
||||
public static Mod IC2;
|
||||
public static Mod Botania;
|
||||
private static boolean WARN;
|
||||
|
||||
private static Item findItem(final String modId, final String name) {
|
||||
final Item stack = GameRegistry.findItem(modId, name);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
private static Item findItem(final String modId, final String name) {
|
||||
final Item stack = Item.REGISTRY.getObject(new ResourceLocation(modId, name));
|
||||
if (stack == null && Mods.WARN && modId == "forestry") {
|
||||
//throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||
}
|
||||
|
||||
private static ItemStack findItemStack(final String modId, final String name, final int stackSize) {
|
||||
final ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static Block findBlock(final String modId, final String name) {
|
||||
final Block stack = GameRegistry.findBlock(modId, name);
|
||||
if (stack == null && Mods.WARN && modId == "Forestry") {
|
||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
private static ItemStack findItemStack(final String modId, final String name, final int stackSize) {
|
||||
final ItemStack stack = GameRegistry.makeItemStack(modId + ":" + name, 0, stackSize, null);
|
||||
if (stack == null && Mods.WARN && modId == "forestry") {
|
||||
//throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
static {
|
||||
Mods.Forestry = new Mod("Forestry") {
|
||||
@Override
|
||||
public boolean dev() {
|
||||
final String forVersion = Loader.instance().getIndexedModList().get("Forestry").getVersion();
|
||||
final Restriction rest = new Restriction(new DefaultArtifactVersion("3.6"), true, (ArtifactVersion) null, false);
|
||||
return rest.containsVersion(new DefaultArtifactVersion(forVersion));
|
||||
}
|
||||
};
|
||||
Mods.IC2 = new Mod("IC2");
|
||||
Mods.Botania = new Mod("Botania");
|
||||
Mods.WARN = true;
|
||||
}
|
||||
private static Block findBlock(final String modId, final String name) {
|
||||
final Block stack = Block.REGISTRY.getObject(new ResourceLocation(modId + ":" + name));
|
||||
if (stack == null && Mods.WARN && modId == "forestry") {
|
||||
//throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static class Mod
|
||||
{
|
||||
private String id;
|
||||
static {
|
||||
Mods.Forestry = new Mod("forestry") {
|
||||
@Override
|
||||
public boolean dev() {
|
||||
final String forVersion = Loader.instance().getIndexedModList().get("forestry").getVersion();
|
||||
final Restriction rest = new Restriction(new DefaultArtifactVersion("3.6"), true, (ArtifactVersion) null, false);
|
||||
return rest.containsVersion(new DefaultArtifactVersion(forVersion));
|
||||
}
|
||||
};
|
||||
Mods.IC2 = new Mod("IC2");
|
||||
Mods.Botania = new Mod("Botania");
|
||||
Mods.WARN = true;
|
||||
}
|
||||
|
||||
private Mod(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public static class Mod {
|
||||
private String id;
|
||||
|
||||
public Item item(final String name) {
|
||||
return findItem(this.id, name);
|
||||
}
|
||||
private Mod(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Block block(final String name) {
|
||||
return findBlock(this.id, name);
|
||||
}
|
||||
public Item item(final String name) {
|
||||
return findItem(this.id, name);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String name, final int stackSize) {
|
||||
return findItemStack(this.id, name, stackSize);
|
||||
}
|
||||
public Block block(final String name) {
|
||||
return findBlock(this.id, name);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String name) {
|
||||
return this.stack(name, 1);
|
||||
}
|
||||
public ItemStack stack(final String name, final int stackSize) {
|
||||
return findItemStack(this.id, name, stackSize);
|
||||
}
|
||||
|
||||
public ItemStack stack(final String string, final int i, final int j) {
|
||||
return new ItemStack(this.item(string), i, j);
|
||||
}
|
||||
public ItemStack stack(final String name) {
|
||||
return this.stack(name, 1);
|
||||
}
|
||||
|
||||
public boolean active() {
|
||||
return Loader.isModLoaded(this.id);
|
||||
}
|
||||
public ItemStack stack(final String string, final int i, final int j) {
|
||||
return new ItemStack(this.item(string), i, j);
|
||||
}
|
||||
|
||||
public boolean dev() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean active() {
|
||||
return Loader.isModLoaded(this.id);
|
||||
}
|
||||
|
||||
public boolean dev() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package binnie.core.block;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015-2016 Adrian Siekierka
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import java.util.EnumMap;
|
||||
|
||||
public abstract class BaseBakedModel implements IPerspectiveAwareModel {
|
||||
private final EnumMap<ItemCameraTransforms.TransformType, TRSRTransformation> transformMap = new EnumMap(ItemCameraTransforms.TransformType.class);
|
||||
private final ResourceLocation particle;
|
||||
|
||||
public BaseBakedModel() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BaseBakedModel(ResourceLocation particle) {
|
||||
this.particle = particle != null ? particle : TextureMap.LOCATION_MISSING_TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
return ImmutablePair.of(this,
|
||||
transformMap.containsKey(cameraTransformType) ? transformMap.get(cameraTransformType).getMatrix() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(particle.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return ItemCameraTransforms.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return ItemOverrideList.NONE;
|
||||
}
|
||||
|
||||
public void addTransformation(ItemCameraTransforms.TransformType type, TRSRTransformation transformation) {
|
||||
transformMap.put(type, TRSRTransformation.blockCornerToCenter(transformation));
|
||||
}
|
||||
|
||||
public void addThirdPersonTransformation(TRSRTransformation transformation) {
|
||||
addTransformation(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, transformation);
|
||||
addTransformation(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, toLeftHand(transformation));
|
||||
}
|
||||
|
||||
public void addFirstPersonTransformation(TRSRTransformation transformation) {
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, transformation);
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, toLeftHand(transformation));
|
||||
}
|
||||
|
||||
// ForgeBlockStateV1 transforms
|
||||
|
||||
private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
|
||||
protected static TRSRTransformation toLeftHand(TRSRTransformation transform) {
|
||||
return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX));
|
||||
}
|
||||
|
||||
protected static TRSRTransformation getTransformation(float tx, float ty, float tz, float ax, float ay, float az, float s) {
|
||||
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(
|
||||
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||
new Vector3f(s, s, s),
|
||||
null));
|
||||
}
|
||||
|
||||
public BaseBakedModel addDefaultBlockTransforms() {
|
||||
TRSRTransformation thirdperson = getTransformation(0, 2.5f, 0, 75, 45, 0, 0.375f);
|
||||
addTransformation(ItemCameraTransforms.TransformType.GUI, getTransformation(0, 0, 0, 30, 225, 0, 0.625f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.GROUND, getTransformation(0, 3, 0, 0, 0, 0, 0.25f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIXED, getTransformation(0, 0, 0, 0, 0, 0, 0.5f));
|
||||
addThirdPersonTransformation(thirdperson);
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransformation(0, 0, 0, 0, 45, 0, 0.4f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransformation(0, 0, 0, 0, 255, 0, 0.4f));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseBakedModel addDefaultItemTransforms() {
|
||||
TRSRTransformation thirdperson = getTransformation(0, 3, 1, 0, 0, 0, 0.55f);
|
||||
TRSRTransformation firstperson = getTransformation(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f);
|
||||
addTransformation(ItemCameraTransforms.TransformType.GROUND, getTransformation(0, 2, 0, 0, 0, 0, 0.5f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.HEAD, getTransformation(0, 13, 7, 0, 180, 0, 1));
|
||||
addThirdPersonTransformation(thirdperson);
|
||||
addFirstPersonTransformation(firstperson);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseBakedModel addDefaultToolTransforms() {
|
||||
addTransformation(ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, getTransformation(0, 4, 0.5f, 0, -90, 55, 0.85f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND, getTransformation(0, 4, 0.5f, 0, 90, -55, 0.85f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND, getTransformation(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f));
|
||||
addTransformation(ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, getTransformation(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,135 +1,133 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata
|
||||
{
|
||||
static int temporyMeta;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public BlockMetadata(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
static int temporyMeta;
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
||||
return getBlockDropped(this, world, x, y, z, blockMeta);
|
||||
}
|
||||
public BlockMetadata(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
||||
return breakBlock(this, player, world, x, y, z);
|
||||
}
|
||||
@Override
|
||||
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
return getBlockDropped(this, world, pos, state.getBlock().getMetaFromState(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(final int meta) {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
}
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4, final int par5) {
|
||||
final int metadata = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
return this.getIcon(par5, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
// @Override
|
||||
// public boolean onBlockEventReceived(final World par1World, final BlockPos pos, final int par5, final int par6) {
|
||||
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
||||
// final TileEntity tileentity = par1World.getTileEntity(pos);
|
||||
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getIcon(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4, final int par5) {
|
||||
// final int metadata = TileEntityMetadata.getTileMetadata(par1IBlockAccess, par2, par3, par4);
|
||||
// return this.getIcon(par5, metadata);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
@Override
|
||||
public String getBlockName(final ItemStack par1ItemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
||||
final int damage = TileEntityMetadata.getItemDamage(item);
|
||||
return damage;
|
||||
}
|
||||
@Override
|
||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(final int tileMeta, final int blockMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
final int damage = TileEntityMetadata.getItemDamage(item);
|
||||
return damage;
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getBlockDropped(final IBlockMetadata block, final World world, final int x, final int y, final int z, final int blockMeta) {
|
||||
final ArrayList<ItemStack> array = new ArrayList<ItemStack>();
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
final int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata());
|
||||
array.add(TileEntityMetadata.getItemStack((Block) block, meta));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@Override
|
||||
public int getDroppedMeta(final int tileMeta, final int blockMeta) {
|
||||
return tileMeta;
|
||||
}
|
||||
|
||||
public static boolean breakBlock(final IBlockMetadata block, final EntityPlayer player, final World world, final int i, final int j, final int k) {
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
final Block block2 = (Block) block;
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, i, j, k);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
final int tileMeta = TileEntityMetadata.getTileMetadata(world, i, j, k);
|
||||
drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
}
|
||||
final boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (final ItemStack drop : drops) {
|
||||
block.dropAsStack(world, i, j, k, drop);
|
||||
}
|
||||
tile.dropBlock();
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
public static ArrayList<ItemStack> getBlockDropped(final IBlockMetadata block, final IBlockAccess world, final BlockPos pos, final int blockMeta) {
|
||||
final ArrayList<ItemStack> array = new ArrayList<ItemStack>();
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
//final int meta = block.getDroppedMeta(world.getBlockMetadata(x, y, z), tile.getTileMetadata());
|
||||
//array.add(TileEntityMetadata.getItemStack((Block) block, meta));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
||||
this.dropBlockAsItem(world, x, y, z, drop);
|
||||
}
|
||||
public static boolean breakBlock(final IBlockMetadata block, final EntityPlayer player, final World world, final BlockPos pos) {
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
final Block block2 = (Block) block;
|
||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
final int tileMeta = TileEntityMetadata.getTileMetadata(world, pos);
|
||||
//drops = block2.getDrops(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
|
||||
}
|
||||
//final boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
||||
// if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
// for (final ItemStack drop : drops) {
|
||||
// //block.dropAsStack(world, i, j, k, drop);
|
||||
// }
|
||||
// tile.dropBlock();
|
||||
// }
|
||||
return false; //hasBeenBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
par1World.removeTileEntity(par2, par3, par4);
|
||||
}
|
||||
@Override
|
||||
public void dropAsStack(final World world, BlockPos pos, final ItemStack drop) {
|
||||
//this.dropBlockAsItem(world, pos, drop);
|
||||
}
|
||||
|
||||
public static ItemStack getPickBlock(final World world, final int x, final int y, final int z) {
|
||||
final List<ItemStack> list = getBlockDropped((IBlockMetadata) world.getBlock(x, y, z), world, x, y, z, world.getBlockMetadata(x, y, z));
|
||||
return list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
// @Override
|
||||
// public void breakBlock(final World par1World, final BlockPos pos, final Block par5, final int par6) {
|
||||
//// super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
//// par1World.removeTileEntity(par2, par3, par4);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
return getPickBlock(world, x, y, z);
|
||||
}
|
||||
//
|
||||
//TODO DROP
|
||||
public static ItemStack getPickBlock(final World world, final BlockPos pos) {
|
||||
//final List<ItemStack> list = getBlockDropped((IBlockMetadata) world.getBlockState(pos).getBlock(), world, pos, world.getBlockMetadata(x, y, z));
|
||||
//return list.isEmpty() ? null : list.get(0);
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
||||
// return getPickBlock(world, x, y, z);
|
||||
// }
|
||||
|
||||
static {
|
||||
BlockMetadata.temporyMeta = -1;
|
||||
}
|
||||
static {
|
||||
BlockMetadata.temporyMeta = -1;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,21 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockMetadata extends ITileEntityProvider
|
||||
{
|
||||
int getPlacedMeta(final ItemStack p0, final World p1, final int p2, final int p3, final int p4, final ForgeDirection p5);
|
||||
import java.util.List;
|
||||
|
||||
int getDroppedMeta(final int p0, final int p1);
|
||||
public interface IBlockMetadata extends ITileEntityProvider {
|
||||
int getPlacedMeta(final ItemStack p0, final World p1, BlockPos pos, final EnumFacing p5);
|
||||
|
||||
String getBlockName(final ItemStack p0);
|
||||
int getDroppedMeta(final int p0, final int p1);
|
||||
|
||||
void getBlockTooltip(final ItemStack p0, final List p1);
|
||||
String getBlockName(final ItemStack p0);
|
||||
|
||||
void dropAsStack(final World p0, final int p1, final int p2, final int p3, final ItemStack p4);
|
||||
void getBlockTooltip(final ItemStack p0, final List p1);
|
||||
|
||||
void dropAsStack(final World p0, BlockPos pos, final ItemStack p4);
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
public interface IMultipassBlock
|
||||
{
|
||||
int getNumberOfPasses();
|
||||
public interface IMultipassBlock {
|
||||
int getNumberOfPasses();
|
||||
|
||||
int colorMultiplier(final int p0);
|
||||
int colorMultiplier(final int p0);
|
||||
}
|
||||
@@ -1,71 +1,56 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import java.util.List;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemMetadata extends ItemBlock
|
||||
{
|
||||
public ItemMetadata(final Block block) {
|
||||
super(block);
|
||||
}
|
||||
public class ItemMetadata extends ItemBlock {
|
||||
public ItemMetadata(final Block block) {
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(final int par1) {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(final int par1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
||||
final Block block = this.field_150939_a;
|
||||
if (!(block instanceof IBlockMetadata)) {
|
||||
return false;
|
||||
}
|
||||
final int placedMeta = ((IBlockMetadata) block).getPlacedMeta(stack, world, x, y, z, ForgeDirection.values()[side]);
|
||||
if (placedMeta < 0) {
|
||||
return false;
|
||||
}
|
||||
if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
return false;
|
||||
}
|
||||
if (world.getBlock(x, y, z) == block) {
|
||||
final 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(final ItemStack par1ItemStack) {
|
||||
return ((IBlockMetadata) this.field_150939_a).getBlockName(par1ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
||||
((IBlockMetadata) this.field_150939_a).getBlockTooltip(par1ItemStack, par3List);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(final int par1) {
|
||||
return this.field_150939_a.getIcon(1, par1);
|
||||
}
|
||||
// @Override
|
||||
// public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
||||
// final Block block = this.field_150939_a;
|
||||
// if (!(block instanceof IBlockMetadata)) {
|
||||
// return false;
|
||||
// }
|
||||
// final int placedMeta = ((IBlockMetadata) block).getPlacedMeta(stack, world, x, y, z, ForgeDirection.values()[side]);
|
||||
// if (placedMeta < 0) {
|
||||
// return false;
|
||||
// }
|
||||
// if (!world.setBlock(x, y, z, block, metadata, 3)) {
|
||||
// return false;
|
||||
// }
|
||||
// if (world.getBlock(x, y, z) == block) {
|
||||
// final 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(final ItemStack par1ItemStack) {
|
||||
// return ((IBlockMetadata) this.field_150939_a).getBlockName(par1ItemStack);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @SideOnly(Side.CLIENT)
|
||||
// public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
||||
// ((IBlockMetadata) this.field_150939_a).getBlockTooltip(par1ItemStack, par3List);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IIcon getIconFromDamage(final int par1) {
|
||||
// return this.field_150939_a.getIcon(1, par1);
|
||||
// }
|
||||
}
|
||||
@@ -1,49 +1,38 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class ItemMetadataRenderer implements IItemRenderer
|
||||
public class ItemMetadataRenderer //implements IItemRenderer
|
||||
{
|
||||
@Override
|
||||
public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
return type == IItemRenderer.ItemRenderType.INVENTORY || type == IItemRenderer.ItemRenderType.ENTITY || type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
}
|
||||
if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING || helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
}
|
||||
return (type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) && helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
GL11.glPushMatrix();
|
||||
final 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(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
GL11.glPushMatrix();
|
||||
((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
// @Override
|
||||
// public boolean handleRenderType(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
// return type == IItemRenderer.ItemRenderType.INVENTORY || type == IItemRenderer.ItemRenderType.ENTITY || type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
// if (type == IItemRenderer.ItemRenderType.INVENTORY) {
|
||||
// return helper == IItemRenderer.ItemRendererHelper.INVENTORY_BLOCK;
|
||||
// }
|
||||
// if (type == IItemRenderer.ItemRenderType.ENTITY) {
|
||||
// return helper == IItemRenderer.ItemRendererHelper.ENTITY_BOBBING || helper == IItemRenderer.ItemRendererHelper.ENTITY_ROTATION;
|
||||
// }
|
||||
// return (type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) && helper == IItemRenderer.ItemRendererHelper.EQUIPPED_BLOCK;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
// GL11.glPushMatrix();
|
||||
// final 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(3042);
|
||||
// OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
// }
|
||||
// GL11.glPushMatrix();
|
||||
// ((RenderBlocks) data[0]).renderBlockAsItem(block, TileEntityMetadata.getItemDamage(item), 1.0f);
|
||||
// GL11.glPopMatrix();
|
||||
// GL11.glPopMatrix();
|
||||
// }
|
||||
}
|
||||
@@ -1,109 +1,97 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler
|
||||
public class MultipassBlockRenderer //implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static MultipassBlockRenderer instance;
|
||||
private static int layer;
|
||||
|
||||
public MultipassBlockRenderer() {
|
||||
MultipassBlockRenderer.instance = this;
|
||||
}
|
||||
|
||||
private void setColour(final Tessellator tess, final int colour) {
|
||||
final float var6 = (colour >> 16 & 0xFF) / 255.0f;
|
||||
final float var7 = (colour >> 8 & 0xFF) / 255.0f;
|
||||
final float var8 = (colour & 0xFF) / 255.0f;
|
||||
GL11.glColor3f(var6, var7, var8);
|
||||
}
|
||||
|
||||
public static int getLayer() {
|
||||
return MultipassBlockRenderer.layer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(final Block block, final int meta, final int modelID, final RenderBlocks renderer) {
|
||||
block.setBlockBoundsForItemRender();
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
this.renderItem(block, renderer, meta);
|
||||
++MultipassBlockRenderer.layer;
|
||||
}
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final 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(final int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return BinnieCore.multipassRenderID;
|
||||
}
|
||||
|
||||
public void renderItem(final Block block, final RenderBlocks renderer, final int meta) {
|
||||
this.setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
final 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, 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(-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();
|
||||
}
|
||||
|
||||
public void setColor(final int l) {
|
||||
final float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
final float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
final float f3 = (l & 0xFF) / 255.0f;
|
||||
GL11.glColor3f(f, f2, f3);
|
||||
}
|
||||
|
||||
static {
|
||||
MultipassBlockRenderer.layer = 0;
|
||||
}
|
||||
// public static MultipassBlockRenderer instance;
|
||||
// private static int layer;
|
||||
//
|
||||
// public MultipassBlockRenderer() {
|
||||
// MultipassBlockRenderer.instance = this;
|
||||
// }
|
||||
//
|
||||
// private void setColour(final Tessellator tess, final int colour) {
|
||||
// final float var6 = (colour >> 16 & 0xFF) / 255.0f;
|
||||
// final float var7 = (colour >> 8 & 0xFF) / 255.0f;
|
||||
// final float var8 = (colour & 0xFF) / 255.0f;
|
||||
// GL11.glColor3f(var6, var7, var8);
|
||||
// }
|
||||
//
|
||||
// public static int getLayer() {
|
||||
// return MultipassBlockRenderer.layer;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderInventoryBlock(final Block block, final int meta, final int modelID, final RenderBlocks renderer) {
|
||||
// block.setBlockBoundsForItemRender();
|
||||
// renderer.setRenderBoundsFromBlock(block);
|
||||
// GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||
// this.renderItem(block, renderer, meta);
|
||||
// ++MultipassBlockRenderer.layer;
|
||||
// }
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final 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(final int i) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getRenderId() {
|
||||
// return BinnieCore.multipassRenderID;
|
||||
// }
|
||||
//
|
||||
// public void renderItem(final Block block, final RenderBlocks renderer, final int meta) {
|
||||
// this.setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||
// final 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, 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(-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();
|
||||
// }
|
||||
//
|
||||
// public void setColor(final int l) {
|
||||
// final float f = (l >> 16 & 0xFF) / 255.0f;
|
||||
// final float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||
// final float f3 = (l & 0xFF) / 255.0f;
|
||||
// GL11.glColor3f(f, f2, f3);
|
||||
// }
|
||||
//
|
||||
// static {
|
||||
// MultipassBlockRenderer.layer = 0;
|
||||
// }
|
||||
}
|
||||
@@ -1,81 +1,69 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
public class MultipassItemRenderer implements IItemRenderer
|
||||
public class MultipassItemRenderer// implements IItemRenderer
|
||||
{
|
||||
private void render(final RenderBlocks renderer, final ItemStack item, final float f, final float g, final float h) {
|
||||
GL11.glTranslatef(f, g, h);
|
||||
final Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
GL11.glEnable(3008);
|
||||
if (block.getRenderBlockPass() != 0) {
|
||||
GL11.glAlphaFunc(516, 0.1f);
|
||||
GL11.glEnable(3042);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
else {
|
||||
GL11.glAlphaFunc(516, 0.5f);
|
||||
GL11.glDisable(3042);
|
||||
}
|
||||
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(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
return true;
|
||||
}
|
||||
case EQUIPPED: {
|
||||
return true;
|
||||
}
|
||||
case INVENTORY: {
|
||||
return true;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
return true;
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
switch (type) {
|
||||
case ENTITY: {
|
||||
this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
case EQUIPPED:
|
||||
case EQUIPPED_FIRST_PERSON: {
|
||||
this.render((RenderBlocks) data[0], item, 0.5f, 0.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
case INVENTORY: {
|
||||
this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// private void render(final RenderBlocks renderer, final ItemStack item, final float f, final float g, final float h) {
|
||||
// GL11.glTranslatef(f, g, h);
|
||||
// final Block block = ((ItemBlock) item.getItem()).field_150939_a;
|
||||
// GL11.glEnable(3008);
|
||||
// if (block.getRenderBlockPass() != 0) {
|
||||
// GL11.glAlphaFunc(516, 0.1f);
|
||||
// GL11.glEnable(3042);
|
||||
// OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
// }
|
||||
// else {
|
||||
// GL11.glAlphaFunc(516, 0.5f);
|
||||
// GL11.glDisable(3042);
|
||||
// }
|
||||
// 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(final ItemStack item, final IItemRenderer.ItemRenderType type) {
|
||||
// switch (type) {
|
||||
// case ENTITY: {
|
||||
// return true;
|
||||
// }
|
||||
// case EQUIPPED: {
|
||||
// return true;
|
||||
// }
|
||||
// case INVENTORY: {
|
||||
// return true;
|
||||
// }
|
||||
// case EQUIPPED_FIRST_PERSON: {
|
||||
// return true;
|
||||
// }
|
||||
// default: {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean shouldUseRenderHelper(final IItemRenderer.ItemRenderType type, final ItemStack item, final IItemRenderer.ItemRendererHelper helper) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void renderItem(final IItemRenderer.ItemRenderType type, final ItemStack item, final Object... data) {
|
||||
// switch (type) {
|
||||
// case ENTITY: {
|
||||
// this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
// break;
|
||||
// }
|
||||
// case EQUIPPED:
|
||||
// case EQUIPPED_FIRST_PERSON: {
|
||||
// this.render((RenderBlocks) data[0], item, 0.5f, 0.5f, 0.5f);
|
||||
// break;
|
||||
// }
|
||||
// case INVENTORY: {
|
||||
// this.render((RenderBlocks) data[0], item, 0.0f, 0.0f, 0.0f);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,110 +1,106 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.block;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import binnie.core.network.packet.MessageMetadata;
|
||||
import binnie.core.BinnieCore;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class TileEntityMetadata extends TileEntity
|
||||
{
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
public class TileEntityMetadata extends TileEntity {
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
|
||||
public TileEntityMetadata() {
|
||||
this.droppedBlock = false;
|
||||
}
|
||||
public TileEntityMetadata() {
|
||||
this.droppedBlock = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent(final int par1, final int par2) {
|
||||
if (par1 == 42) {
|
||||
this.meta = par2;
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean receiveClientEvent(final int par1, final int par2) {
|
||||
if (par1 == 42) {
|
||||
this.meta = par2;
|
||||
//TODO UPDATE
|
||||
//this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("meta", this.meta);
|
||||
}
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound nbt) {
|
||||
NBTTagCompound nbt2 = super.writeToNBT(nbt);
|
||||
nbt2.setInteger("meta", this.meta);
|
||||
return nbt2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public boolean canUpdate() {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
public int getTileMetadata() {
|
||||
return this.meta;
|
||||
}
|
||||
public int getTileMetadata() {
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public void setTileMetadata(final int meta, final boolean notify) {
|
||||
if (this.meta != meta) {
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setTileMetadata(final int meta, final boolean notify) {
|
||||
if (this.meta != meta) {
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
//TODO UPDATE
|
||||
//this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageMetadata(this.xCoord, this.yCoord, this.zCoord, this.meta).GetMessage());
|
||||
}
|
||||
//TODO update packet
|
||||
// @Override
|
||||
// public Packet getDescriptionPacket() {
|
||||
// return BinnieCore.instance.getNetworkWrapper().getPacketFrom(new MessageMetadata(this.xCoord, this.yCoord, this.zCoord, this.meta).GetMessage());
|
||||
// }
|
||||
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final ItemStack item = new ItemStack(block, 1, 0);
|
||||
setItemDamage(item, damage);
|
||||
return item;
|
||||
}
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final ItemStack item = new ItemStack(block, 1, 0);
|
||||
setItemDamage(item, damage);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(final IBlockAccess world, final int x, final int y, final int z) {
|
||||
final TileEntityMetadata tile = getTile(world, x, y, z);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
public static int getTileMetadata(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntityMetadata tile = getTile(world, pos);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
public boolean hasDroppedBlock() {
|
||||
return this.droppedBlock;
|
||||
}
|
||||
public boolean hasDroppedBlock() {
|
||||
return this.droppedBlock;
|
||||
}
|
||||
|
||||
public void dropBlock() {
|
||||
this.droppedBlock = true;
|
||||
}
|
||||
public void dropBlock() {
|
||||
this.droppedBlock = true;
|
||||
}
|
||||
}
|
||||
@@ -1,92 +1,87 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.circuits;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
public class BinnieCircuit implements ICircuit {
|
||||
private String uid;
|
||||
private int limit;
|
||||
private List<String> tooltips;
|
||||
|
||||
public class BinnieCircuit implements ICircuit
|
||||
{
|
||||
private String uid;
|
||||
private int limit;
|
||||
private List<String> tooltips;
|
||||
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final ItemStack itemStack) {
|
||||
this.tooltips = new ArrayList<String>();
|
||||
this.uid = "binnie.circuit." + uid;
|
||||
this.limit = limit;
|
||||
ChipsetManager.circuitRegistry.registerCircuit(this);
|
||||
if (itemStack != null) {
|
||||
ChipsetManager.solderManager.addRecipe(layout, itemStack, this);
|
||||
}
|
||||
}
|
||||
|
||||
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final ItemStack itemStack) {
|
||||
this.tooltips = new ArrayList<String>();
|
||||
this.uid = "binnie.circuit." + uid;
|
||||
this.limit = limit;
|
||||
ChipsetManager.circuitRegistry.registerCircuit(this);
|
||||
if (itemStack != null) {
|
||||
ChipsetManager.solderManager.addRecipe(layout, itemStack, this);
|
||||
}
|
||||
}
|
||||
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final Item item, final int itemMeta) {
|
||||
this(uid, limit, layout, new ItemStack(item, 1, itemMeta));
|
||||
}
|
||||
|
||||
public BinnieCircuit(final String uid, final int limit, final ICircuitLayout layout, final Item item, final int itemMeta) {
|
||||
this(uid, limit, layout, new ItemStack(item, 1, itemMeta));
|
||||
}
|
||||
public void addTooltipString(final String string) {
|
||||
this.tooltips.add(string);
|
||||
}
|
||||
|
||||
public void addTooltipString(final String string) {
|
||||
this.tooltips.add(string);
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return this.uid;
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresDiscovery() {
|
||||
return false;
|
||||
}
|
||||
// @Override
|
||||
// public boolean requiresDiscovery() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getLimit() {
|
||||
// return this.limit;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return this.uid;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getLimit() {
|
||||
return this.limit;
|
||||
}
|
||||
@Override
|
||||
public void addTooltip(final List<String> list) {
|
||||
for (final String string : this.tooltips) {
|
||||
list.add(" - " + string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.uid;
|
||||
}
|
||||
@Override
|
||||
public boolean isCircuitable(Object arg0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(final List<String> list) {
|
||||
for (final String string : this.tooltips) {
|
||||
list.add(" - " + string);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onInsertion(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(Object arg0) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void onLoad(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int arg0, Object arg1) {
|
||||
}
|
||||
@Override
|
||||
public void onRemoval(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int arg0, Object arg1) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
}
|
||||
@Override
|
||||
public void onTick(int arg0, Object arg1) {
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,39 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.circuits;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.AbstractMod;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import binnie.core.AbstractMod;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
|
||||
public class BinnieCircuitLayout implements ICircuitLayout
|
||||
{
|
||||
private String uid;
|
||||
private AbstractMod mod;
|
||||
public class BinnieCircuitLayout implements ICircuitLayout {
|
||||
private String uid;
|
||||
private AbstractMod mod;
|
||||
|
||||
public BinnieCircuitLayout(final AbstractMod mod, final String uid) {
|
||||
this.uid = uid;
|
||||
this.mod = mod;
|
||||
ChipsetManager.circuitRegistry.registerLayout(this);
|
||||
}
|
||||
public BinnieCircuitLayout(final AbstractMod mod, final String uid) {
|
||||
this.uid = uid;
|
||||
this.mod = mod;
|
||||
ChipsetManager.circuitRegistry.registerLayout(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.circuitLayout" + this.uid;
|
||||
}
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "binnie.circuitLayout" + this.uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase());
|
||||
}
|
||||
@Override
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase() + ".usage");
|
||||
}
|
||||
@Override
|
||||
public String getUsage() {
|
||||
return Binnie.Language.localise(this.mod, "circuit.layout." + this.uid.toLowerCase() + ".usage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.NONE;// TODO hmm? CircuitSocketType
|
||||
}
|
||||
@Override
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.NONE;// TODO hmm? CircuitSocketType
|
||||
}
|
||||
}
|
||||
@@ -1,143 +1,124 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.genetics.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.TreeSet;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
class BeeBreedingSystem extends BreedingSystem {
|
||||
public BeeBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
|
||||
}
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return ((IBeeMutation) mutation).
|
||||
getChance(new VirtualBeeHousing(player),
|
||||
(IAlleleBeeSpecies) species1,
|
||||
(IAlleleBeeSpecies) species2,
|
||||
(IBeeGenome) this.getSpeciesRoot().
|
||||
templateAsGenome(this.getSpeciesRoot().getTemplate(species1.getUID())),
|
||||
(IBeeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(species2.getUID())));
|
||||
}
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getBeeRoot();
|
||||
}
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 16767232;
|
||||
}
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.Binnie;
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IApiaristTracker.class;
|
||||
}
|
||||
|
||||
class BeeBreedingSystem extends BreedingSystem
|
||||
{
|
||||
public BeeBreedingSystem() {
|
||||
this.iconUndiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/undiscoveredBee");
|
||||
this.iconDiscovered = Binnie.Resource.getItemIcon(ExtraBees.instance, "icon/discoveredBee");
|
||||
}
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumBeeChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(final IMutation mutation, final EntityPlayer player, final IAllele species1, final IAllele species2) {
|
||||
return ((IBeeMutation) mutation).
|
||||
getChance(new VirtualBeeHousing(player),
|
||||
(IAlleleBeeSpecies) species1,
|
||||
(IAlleleBeeSpecies) species2,
|
||||
(IBeeGenome) this.getSpeciesRoot().
|
||||
templateAsGenome(this.getSpeciesRoot().getTemplate(species1.getUID())),
|
||||
(IBeeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(species2.getUID())));
|
||||
}
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IBeeRoot) this.getSpeciesRoot()).getType(member) == EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return Binnie.Genetics.getBeeRoot();
|
||||
}
|
||||
@Override
|
||||
public ISpeciesType[] getActiveTypes() {
|
||||
return new ISpeciesType[]{EnumBeeType.DRONE, EnumBeeType.PRINCESS, EnumBeeType.QUEEN, EnumBeeType.LARVAE};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return 16767232;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBreedingTracker> getTrackerClass() {
|
||||
return IApiaristTracker.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (chromosome == EnumBeeChromosome.FERTILITY) {
|
||||
if (allele.getUID().contains("Low")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.low");
|
||||
}
|
||||
if (allele.getUID().contains("Normal")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.normal");
|
||||
}
|
||||
if (allele.getUID().contains("High")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.high");
|
||||
}
|
||||
if (allele.getUID().contains("Maximum")) {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
}
|
||||
return super.getAlleleName(chromosome, allele);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDNAManipulable(final ItemStack member) {
|
||||
return ((IBeeRoot) this.getSpeciesRoot()).getType(member) == EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getActiveTypes() {
|
||||
return new int[] { EnumBeeType.DRONE.ordinal(), EnumBeeType.PRINCESS.ordinal(), EnumBeeType.QUEEN.ordinal(), EnumBeeType.LARVAE.ordinal() };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumBeeChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FLOWERING: {
|
||||
for (final ForestryAllele.Flowering a2 : ForestryAllele.Flowering.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a4 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPEED: {
|
||||
for (final ForestryAllele.Speed a5 : ForestryAllele.Speed.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NOCTURNAL:
|
||||
case CAVE_DWELLING:
|
||||
case TOLERANT_FLYER: {
|
||||
for (final ForestryAllele.Bool a7 : ForestryAllele.Bool.values()) {
|
||||
alleles.add(a7.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addExtraAlleles(final IChromosomeType chromosome, final TreeSet<IAllele> alleles) {
|
||||
switch ((EnumBeeChromosome) chromosome) {
|
||||
case FERTILITY: {
|
||||
for (final ForestryAllele.Fertility a : ForestryAllele.Fertility.values()) {
|
||||
alleles.add(a.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FLOWERING: {
|
||||
for (final ForestryAllele.Flowering a2 : ForestryAllele.Flowering.values()) {
|
||||
alleles.add(a2.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HUMIDITY_TOLERANCE:
|
||||
case TEMPERATURE_TOLERANCE: {
|
||||
for (final Tolerance a3 : Tolerance.values()) {
|
||||
alleles.add(a3.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LIFESPAN: {
|
||||
for (final ForestryAllele.Lifespan a4 : ForestryAllele.Lifespan.values()) {
|
||||
alleles.add(a4.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPEED: {
|
||||
for (final ForestryAllele.Speed a5 : ForestryAllele.Speed.values()) {
|
||||
alleles.add(a5.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TERRITORY: {
|
||||
for (final ForestryAllele.Territory a6 : ForestryAllele.Territory.values()) {
|
||||
alleles.add(a6.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NEVER_SLEEPS:
|
||||
case CAVE_DWELLING:
|
||||
case TOLERATES_RAIN: {
|
||||
for (final ForestryAllele.Bool a7 : ForestryAllele.Bool.values()) {
|
||||
alleles.add(a7.getAllele());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,3 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -9,45 +5,43 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class BeeModifierLogic
|
||||
{
|
||||
private Map<EnumBeeModifier, Float[]> modifiers;
|
||||
private List<EnumBeeBooleanModifier> booleanModifiers;
|
||||
public class BeeModifierLogic {
|
||||
private Map<EnumBeeModifier, Float[]> modifiers;
|
||||
private List<EnumBeeBooleanModifier> booleanModifiers;
|
||||
|
||||
public BeeModifierLogic() {
|
||||
this.modifiers = new HashMap<EnumBeeModifier, Float[]>();
|
||||
this.booleanModifiers = new ArrayList<EnumBeeBooleanModifier>();
|
||||
}
|
||||
public BeeModifierLogic() {
|
||||
this.modifiers = new HashMap<EnumBeeModifier, Float[]>();
|
||||
this.booleanModifiers = new ArrayList<EnumBeeBooleanModifier>();
|
||||
}
|
||||
|
||||
public float getModifier(final EnumBeeModifier modifier, final float currentModifier) {
|
||||
if (!this.modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
}
|
||||
final float mult = this.modifiers.get(modifier)[0];
|
||||
final float max = this.modifiers.get(modifier)[1];
|
||||
if (max >= 1.0f) {
|
||||
if (max <= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.min(max / currentModifier, mult);
|
||||
}
|
||||
else {
|
||||
if (max >= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.max(max / currentModifier, mult);
|
||||
}
|
||||
}
|
||||
public float getModifier(final EnumBeeModifier modifier, final float currentModifier) {
|
||||
if (!this.modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
}
|
||||
final float mult = this.modifiers.get(modifier)[0];
|
||||
final float max = this.modifiers.get(modifier)[1];
|
||||
if (max >= 1.0f) {
|
||||
if (max <= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.min(max / currentModifier, mult);
|
||||
} else {
|
||||
if (max >= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.max(max / currentModifier, mult);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getModifier(final EnumBeeBooleanModifier modifier) {
|
||||
return this.booleanModifiers.contains(modifier);
|
||||
}
|
||||
public boolean getModifier(final EnumBeeBooleanModifier modifier) {
|
||||
return this.booleanModifiers.contains(modifier);
|
||||
}
|
||||
|
||||
public void setModifier(final EnumBeeBooleanModifier modifier) {
|
||||
this.booleanModifiers.add(modifier);
|
||||
}
|
||||
public void setModifier(final EnumBeeBooleanModifier modifier) {
|
||||
this.booleanModifiers.add(modifier);
|
||||
}
|
||||
|
||||
public void setModifier(final EnumBeeModifier modifier, final float mult, final float max) {
|
||||
this.modifiers.put(modifier, new Float[] { mult, max });
|
||||
}
|
||||
public void setModifier(final EnumBeeModifier modifier, final float mult, final float max) {
|
||||
this.modifiers.put(modifier, new Float[]{mult, max});
|
||||
}
|
||||
}
|
||||
@@ -1,494 +1,464 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
import java.util.TreeSet;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.world.World;
|
||||
import java.util.Set;
|
||||
import binnie.extrabees.genetics.ExtraBeeMutation;
|
||||
import java.util.LinkedHashSet;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import java.util.Collection;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.core.BinnieCore;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import binnie.Binnie;
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import java.util.List;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.resource.BinnieIcon;
|
||||
import binnie.extrabees.genetics.ExtraBeeMutation;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.api.genetics.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public abstract class BreedingSystem implements IItemStackRepresentitive
|
||||
{
|
||||
protected BinnieIcon iconUndiscovered;
|
||||
protected BinnieIcon iconDiscovered;
|
||||
private List<IClassification> allBranches;
|
||||
List<IAlleleSpecies> allActiveSpecies;
|
||||
private List<IAlleleSpecies> allSpecies;
|
||||
private List<IMutation> allMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> resultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> furtherMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allResultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allFurtherMutations;
|
||||
public float discoveredSpeciesPercentage;
|
||||
public int totalSpeciesCount;
|
||||
public int discoveredSpeciesCount;
|
||||
public int totalSecretCount;
|
||||
public int discoveredSecretCount;
|
||||
public float discoveredBranchPercentage;
|
||||
public int totalBranchCount;
|
||||
public int discoveredBranchCount;
|
||||
private int totalSecretBranchCount;
|
||||
private int discoveredSecretBranchCount;
|
||||
String currentEpithet;
|
||||
import java.util.*;
|
||||
|
||||
public BreedingSystem() {
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
Binnie.Genetics.registerBreedingSystem(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
protected BinnieIcon iconUndiscovered;
|
||||
protected BinnieIcon iconDiscovered;
|
||||
private List<IClassification> allBranches;
|
||||
List<IAlleleSpecies> allActiveSpecies;
|
||||
private List<IAlleleSpecies> allSpecies;
|
||||
private List<IMutation> allMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> resultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> furtherMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allResultantMutations;
|
||||
private Map<IAlleleSpecies, List<IMutation>> allFurtherMutations;
|
||||
public float discoveredSpeciesPercentage;
|
||||
public int totalSpeciesCount;
|
||||
public int discoveredSpeciesCount;
|
||||
public int totalSecretCount;
|
||||
public int discoveredSecretCount;
|
||||
public float discoveredBranchPercentage;
|
||||
public int totalBranchCount;
|
||||
public int discoveredBranchCount;
|
||||
private int totalSecretBranchCount;
|
||||
private int discoveredSecretBranchCount;
|
||||
String currentEpithet;
|
||||
|
||||
public String getChromosomeName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
|
||||
}
|
||||
public BreedingSystem() {
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
Binnie.Genetics.registerBreedingSystem(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
public String getChromosomeShortName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
|
||||
}
|
||||
public String getChromosomeName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName());
|
||||
}
|
||||
|
||||
public final String getEpitome(final float discoveredPercentage) {
|
||||
int i = 0;
|
||||
if (discoveredPercentage == 1.0f) {
|
||||
i = 6;
|
||||
}
|
||||
else if (discoveredPercentage < 0.1f) {
|
||||
i = 0;
|
||||
}
|
||||
else if (discoveredPercentage < 0.3f) {
|
||||
i = 1;
|
||||
}
|
||||
else if (discoveredPercentage < 0.5f) {
|
||||
i = 2;
|
||||
}
|
||||
else if (discoveredPercentage < 0.7f) {
|
||||
i = 3;
|
||||
}
|
||||
else if (discoveredPercentage < 0.9f) {
|
||||
i = 4;
|
||||
}
|
||||
else if (discoveredPercentage < 1.0f) {
|
||||
i = 5;
|
||||
}
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".epitome." + i);
|
||||
}
|
||||
public String getChromosomeShortName(final IChromosomeType chromo) {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".chromosome." + chromo.getName() + ".short");
|
||||
}
|
||||
|
||||
public abstract ISpeciesRoot getSpeciesRoot();
|
||||
public final String getEpitome(final float discoveredPercentage) {
|
||||
int i = 0;
|
||||
if (discoveredPercentage == 1.0f) {
|
||||
i = 6;
|
||||
} else if (discoveredPercentage < 0.1f) {
|
||||
i = 0;
|
||||
} else if (discoveredPercentage < 0.3f) {
|
||||
i = 1;
|
||||
} else if (discoveredPercentage < 0.5f) {
|
||||
i = 2;
|
||||
} else if (discoveredPercentage < 0.7f) {
|
||||
i = 3;
|
||||
} else if (discoveredPercentage < 0.9f) {
|
||||
i = 4;
|
||||
} else if (discoveredPercentage < 1.0f) {
|
||||
i = 5;
|
||||
}
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".epitome." + i);
|
||||
}
|
||||
|
||||
public final List<IClassification> getAllBranches() {
|
||||
return this.allBranches;
|
||||
}
|
||||
public abstract ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
public final Collection<IAlleleSpecies> getAllSpecies() {
|
||||
return this.allActiveSpecies;
|
||||
}
|
||||
public final List<IClassification> getAllBranches() {
|
||||
return this.allBranches;
|
||||
}
|
||||
|
||||
public final Collection<IMutation> getAllMutations() {
|
||||
return this.allMutations;
|
||||
}
|
||||
public final Collection<IAlleleSpecies> getAllSpecies() {
|
||||
return this.allActiveSpecies;
|
||||
}
|
||||
|
||||
public void calculateArrays() {
|
||||
final Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAllele species : allAlleles) {
|
||||
if (this.getSpeciesRoot().getTemplate(species.getUID()) != null) {
|
||||
this.resultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.furtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allResultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allFurtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allSpecies.add((IAlleleSpecies) species);
|
||||
if (this.isBlacklisted(species) || species.getUID().contains("speciesBotAlfheim")) {
|
||||
continue;
|
||||
}
|
||||
this.allActiveSpecies.add((IAlleleSpecies) species);
|
||||
}
|
||||
}
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
final Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : allRegBranches) {
|
||||
if (branch.getMemberSpecies().length > 0 && this.getSpeciesRoot().getTemplate(branch.getMemberSpecies()[0].getUID()) != null) {
|
||||
boolean possible = false;
|
||||
for (final IAlleleSpecies species2 : branch.getMemberSpecies()) {
|
||||
if (this.allActiveSpecies.contains(species2)) {
|
||||
possible = true;
|
||||
}
|
||||
}
|
||||
if (!possible) {
|
||||
continue;
|
||||
}
|
||||
this.allBranches.add(branch);
|
||||
}
|
||||
}
|
||||
if (this.getSpeciesRoot().getMutations(false) != null) {
|
||||
final Set<IMutation> mutations = new LinkedHashSet<IMutation>();
|
||||
mutations.addAll(this.getSpeciesRoot().getMutations(false));
|
||||
if (this == Binnie.Genetics.beeBreedingSystem) {
|
||||
mutations.addAll(ExtraBeeMutation.mutations);
|
||||
}
|
||||
for (final IMutation mutation : mutations) {
|
||||
this.allMutations.add(mutation);
|
||||
final Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet<IAlleleSpecies>();
|
||||
if (mutation.getAllele0() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele0());
|
||||
}
|
||||
if (mutation.getAllele1() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele1());
|
||||
}
|
||||
for (final IAlleleSpecies species3 : participatingSpecies) {
|
||||
this.allFurtherMutations.get(species3).add(mutation);
|
||||
if (this.allActiveSpecies.contains(species3)) {
|
||||
this.furtherMutations.get(species3).add(mutation);
|
||||
}
|
||||
}
|
||||
if (this.resultantMutations.containsKey(mutation.getTemplate()[0])) {
|
||||
this.allResultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
this.resultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public final Collection<IMutation> getAllMutations() {
|
||||
return this.allMutations;
|
||||
}
|
||||
|
||||
public final boolean isBlacklisted(final IAllele allele) {
|
||||
return AlleleManager.alleleRegistry.isBlacklisted(allele.getUID());
|
||||
}
|
||||
public void calculateArrays() {
|
||||
final Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
|
||||
this.resultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.furtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allResultantMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allFurtherMutations = new HashMap<IAlleleSpecies, List<IMutation>>();
|
||||
this.allActiveSpecies = new ArrayList<IAlleleSpecies>();
|
||||
this.allSpecies = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAllele species : allAlleles) {
|
||||
if (this.getSpeciesRoot().getTemplate(species.getUID()) != null) {
|
||||
this.resultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.furtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allResultantMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allFurtherMutations.put((IAlleleSpecies) species, new ArrayList<IMutation>());
|
||||
this.allSpecies.add((IAlleleSpecies) species);
|
||||
if (this.isBlacklisted(species) || species.getUID().contains("speciesBotAlfheim")) {
|
||||
continue;
|
||||
}
|
||||
this.allActiveSpecies.add((IAlleleSpecies) species);
|
||||
}
|
||||
}
|
||||
this.allMutations = new ArrayList<IMutation>();
|
||||
final Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
|
||||
this.allBranches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : allRegBranches) {
|
||||
if (branch.getMemberSpecies().length > 0 && this.getSpeciesRoot().getTemplate(branch.getMemberSpecies()[0].getUID()) != null) {
|
||||
boolean possible = false;
|
||||
for (final IAlleleSpecies species2 : branch.getMemberSpecies()) {
|
||||
if (this.allActiveSpecies.contains(species2)) {
|
||||
possible = true;
|
||||
}
|
||||
}
|
||||
if (!possible) {
|
||||
continue;
|
||||
}
|
||||
this.allBranches.add(branch);
|
||||
}
|
||||
}
|
||||
if (this.getSpeciesRoot().getMutations(false) != null) {
|
||||
final Set<IMutation> mutations = new LinkedHashSet<IMutation>();
|
||||
mutations.addAll(this.getSpeciesRoot().getMutations(false));
|
||||
if (this == Binnie.Genetics.beeBreedingSystem) {
|
||||
mutations.addAll(ExtraBeeMutation.mutations);
|
||||
}
|
||||
for (final IMutation mutation : mutations) {
|
||||
this.allMutations.add(mutation);
|
||||
final Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet<IAlleleSpecies>();
|
||||
if (mutation.getAllele0() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele0());
|
||||
}
|
||||
if (mutation.getAllele1() instanceof IAlleleSpecies) {
|
||||
participatingSpecies.add(mutation.getAllele1());
|
||||
}
|
||||
for (final IAlleleSpecies species3 : participatingSpecies) {
|
||||
this.allFurtherMutations.get(species3).add(mutation);
|
||||
if (this.allActiveSpecies.contains(species3)) {
|
||||
this.furtherMutations.get(species3).add(mutation);
|
||||
}
|
||||
}
|
||||
if (this.resultantMutations.containsKey(mutation.getTemplate()[0])) {
|
||||
this.allResultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
this.resultantMutations.get(mutation.getTemplate()[0]).add(mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allResultantMutations.get(species) : this.resultantMutations.get(species);
|
||||
}
|
||||
public final boolean isBlacklisted(final IAllele allele) {
|
||||
return AlleleManager.alleleRegistry.isBlacklisted(allele.getUID());
|
||||
}
|
||||
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.resultantMutations.get(species);
|
||||
}
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allResultantMutations.get(species) : this.resultantMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allFurtherMutations.get(species) : this.furtherMutations.get(species);
|
||||
}
|
||||
public final List<IMutation> getResultantMutations(final IAlleleSpecies species) {
|
||||
if (this.resultantMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.resultantMutations.get(species);
|
||||
}
|
||||
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.furtherMutations.get(species);
|
||||
}
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species, final boolean includeInactive) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return includeInactive ? this.allFurtherMutations.get(species) : this.furtherMutations.get(species);
|
||||
}
|
||||
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final World world, final GameProfile name) {
|
||||
return this.isMutationDiscovered(mutation, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
public final List<IMutation> getFurtherMutations(final IAlleleSpecies species) {
|
||||
if (this.furtherMutations.isEmpty()) {
|
||||
this.calculateArrays();
|
||||
}
|
||||
return this.furtherMutations.get(species);
|
||||
}
|
||||
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(mutation);
|
||||
}
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final World world, final GameProfile name) {
|
||||
return this.isMutationDiscovered(mutation, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final World world, final GameProfile name) {
|
||||
return this.isSpeciesDiscovered(species, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
public final boolean isMutationDiscovered(final IMutation mutation, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(mutation);
|
||||
}
|
||||
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(species);
|
||||
}
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final World world, final GameProfile name) {
|
||||
return this.isSpeciesDiscovered(species, this.getSpeciesRoot().getBreedingTracker(world, name));
|
||||
}
|
||||
|
||||
public final boolean isSecret(final IAlleleSpecies species) {
|
||||
return !species.isCounted();
|
||||
}
|
||||
public final boolean isSpeciesDiscovered(final IAlleleSpecies species, final IBreedingTracker tracker) {
|
||||
return tracker == null || tracker.isDiscovered(species);
|
||||
}
|
||||
|
||||
public final boolean isSecret(final IClassification branch) {
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (!this.isSecret(species)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public final boolean isSecret(final IAlleleSpecies species) {
|
||||
return !species.isCounted();
|
||||
}
|
||||
|
||||
public final Collection<IClassification> getDiscoveredBranches(final World world, final GameProfile player) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
public final boolean isSecret(final IClassification branch) {
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (!this.isSecret(species)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final Collection<IClassification> getDiscoveredBranches(final IBreedingTracker tracker) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
public final Collection<IClassification> getDiscoveredBranches(final World world, final GameProfile player) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final World world, final GameProfile player) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
public final Collection<IClassification> getDiscoveredBranches(final IBreedingTracker tracker) {
|
||||
final List<IClassification> branches = new ArrayList<IClassification>();
|
||||
for (final IClassification branch : this.getAllBranches()) {
|
||||
boolean discovered = false;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
discovered = true;
|
||||
}
|
||||
}
|
||||
if (discovered) {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
return branches;
|
||||
}
|
||||
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final IBreedingTracker tracker) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final World world, final GameProfile player) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final List<IMutation> getDiscoveredMutations(final World world, final GameProfile player) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
public final Collection<IAlleleSpecies> getDiscoveredSpecies(final IBreedingTracker tracker) {
|
||||
final List<IAlleleSpecies> speciesList = new ArrayList<IAlleleSpecies>();
|
||||
for (final IAlleleSpecies species : this.getAllSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final List<IMutation> getDiscoveredMutations(final IBreedingTracker tracker) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
public final List<IMutation> getDiscoveredMutations(final World world, final GameProfile player) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, world, player)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public final int getDiscoveredBranchMembers(final IClassification branch, final IBreedingTracker tracker) {
|
||||
int discoveredSpecies = 0;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
++discoveredSpecies;
|
||||
}
|
||||
}
|
||||
return discoveredSpecies;
|
||||
}
|
||||
public final List<IMutation> getDiscoveredMutations(final IBreedingTracker tracker) {
|
||||
final List<IMutation> speciesList = new ArrayList<IMutation>();
|
||||
for (final IMutation species : this.getAllMutations()) {
|
||||
if (this.isMutationDiscovered(species, tracker)) {
|
||||
speciesList.add(species);
|
||||
}
|
||||
}
|
||||
return speciesList;
|
||||
}
|
||||
|
||||
public IIcon getUndiscoveredIcon() {
|
||||
return this.iconUndiscovered.getIcon();
|
||||
}
|
||||
public final int getDiscoveredBranchMembers(final IClassification branch, final IBreedingTracker tracker) {
|
||||
int discoveredSpecies = 0;
|
||||
for (final IAlleleSpecies species : branch.getMemberSpecies()) {
|
||||
if (this.isSpeciesDiscovered(species, tracker)) {
|
||||
++discoveredSpecies;
|
||||
}
|
||||
}
|
||||
return discoveredSpecies;
|
||||
}
|
||||
|
||||
public IIcon getDiscoveredIcon() {
|
||||
return this.iconDiscovered.getIcon();
|
||||
}
|
||||
// public IIcon getUndiscoveredIcon() {
|
||||
// return this.iconUndiscovered.getIcon();
|
||||
// }
|
||||
//
|
||||
// public IIcon getDiscoveredIcon() {
|
||||
// return this.iconDiscovered.getIcon();
|
||||
// }
|
||||
|
||||
public abstract float getChance(final IMutation p0, final EntityPlayer p1, final IAllele p2, final IAllele p3);
|
||||
public abstract float getChance(final IMutation p0, final EntityPlayer p1, final IAllele p2, final IAllele p3);
|
||||
|
||||
public abstract Class<? extends IBreedingTracker> getTrackerClass();
|
||||
public abstract Class<? extends IBreedingTracker> getTrackerClass();
|
||||
|
||||
@SubscribeEvent
|
||||
public final void onSyncBreedingTracker(final ForestryEvent.SyncedBreedingTracker event) {
|
||||
final IBreedingTracker tracker = event.tracker;
|
||||
if (!this.getTrackerClass().isInstance(tracker)) {
|
||||
return;
|
||||
}
|
||||
this.syncTracker(tracker);
|
||||
}
|
||||
@SubscribeEvent
|
||||
public final void onSyncBreedingTracker(final ForestryEvent.SyncedBreedingTracker event) {
|
||||
final IBreedingTracker tracker = event.tracker;
|
||||
if (!this.getTrackerClass().isInstance(tracker)) {
|
||||
return;
|
||||
}
|
||||
this.syncTracker(tracker);
|
||||
}
|
||||
|
||||
public final void syncTracker(final IBreedingTracker tracker) {
|
||||
this.discoveredSpeciesPercentage = 0.0f;
|
||||
this.totalSpeciesCount = 0;
|
||||
this.discoveredSpeciesCount = 0;
|
||||
this.totalSecretCount = 0;
|
||||
this.discoveredSecretCount = 0;
|
||||
final Collection<IAlleleSpecies> discoveredSpecies = this.getDiscoveredSpecies(tracker);
|
||||
final Collection<IAlleleSpecies> allSpecies = this.getAllSpecies();
|
||||
for (final IAlleleSpecies species : allSpecies) {
|
||||
if (!this.isSecret(species)) {
|
||||
++this.totalSpeciesCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSpeciesCount;
|
||||
}
|
||||
else {
|
||||
++this.totalSecretCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretCount;
|
||||
}
|
||||
}
|
||||
this.discoveredBranchPercentage = 0.0f;
|
||||
this.totalBranchCount = 0;
|
||||
this.discoveredBranchCount = 0;
|
||||
final Collection<IClassification> discoveredBranches = this.getDiscoveredBranches(tracker);
|
||||
final Collection<IClassification> allBranches = this.getAllBranches();
|
||||
for (final IClassification branch : allBranches) {
|
||||
if (!this.isSecret(branch)) {
|
||||
++this.totalBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredBranchCount;
|
||||
}
|
||||
else {
|
||||
++this.totalSecretBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretBranchCount;
|
||||
}
|
||||
}
|
||||
this.discoveredSpeciesPercentage = this.discoveredSpeciesCount / this.totalSpeciesCount;
|
||||
this.discoveredBranchPercentage = this.discoveredBranchCount / this.totalBranchCount;
|
||||
final String epithet = this.getEpitome();
|
||||
this.onSyncBreedingTracker(tracker);
|
||||
}
|
||||
public final void syncTracker(final IBreedingTracker tracker) {
|
||||
this.discoveredSpeciesPercentage = 0.0f;
|
||||
this.totalSpeciesCount = 0;
|
||||
this.discoveredSpeciesCount = 0;
|
||||
this.totalSecretCount = 0;
|
||||
this.discoveredSecretCount = 0;
|
||||
final Collection<IAlleleSpecies> discoveredSpecies = this.getDiscoveredSpecies(tracker);
|
||||
final Collection<IAlleleSpecies> allSpecies = this.getAllSpecies();
|
||||
for (final IAlleleSpecies species : allSpecies) {
|
||||
if (!this.isSecret(species)) {
|
||||
++this.totalSpeciesCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSpeciesCount;
|
||||
} else {
|
||||
++this.totalSecretCount;
|
||||
if (!this.isSpeciesDiscovered(species, tracker)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretCount;
|
||||
}
|
||||
}
|
||||
this.discoveredBranchPercentage = 0.0f;
|
||||
this.totalBranchCount = 0;
|
||||
this.discoveredBranchCount = 0;
|
||||
final Collection<IClassification> discoveredBranches = this.getDiscoveredBranches(tracker);
|
||||
final Collection<IClassification> allBranches = this.getAllBranches();
|
||||
for (final IClassification branch : allBranches) {
|
||||
if (!this.isSecret(branch)) {
|
||||
++this.totalBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredBranchCount;
|
||||
} else {
|
||||
++this.totalSecretBranchCount;
|
||||
if (!discoveredBranches.contains(branch)) {
|
||||
continue;
|
||||
}
|
||||
++this.discoveredSecretBranchCount;
|
||||
}
|
||||
}
|
||||
this.discoveredSpeciesPercentage = this.discoveredSpeciesCount / this.totalSpeciesCount;
|
||||
this.discoveredBranchPercentage = this.discoveredBranchCount / this.totalBranchCount;
|
||||
final String epithet = this.getEpitome();
|
||||
this.onSyncBreedingTracker(tracker);
|
||||
}
|
||||
|
||||
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
|
||||
}
|
||||
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
|
||||
}
|
||||
|
||||
public String getEpitome() {
|
||||
return this.getEpitome(this.discoveredSpeciesPercentage);
|
||||
}
|
||||
public String getEpitome() {
|
||||
return this.getEpitome(this.discoveredSpeciesPercentage);
|
||||
}
|
||||
|
||||
public final String getDescriptor() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".descriptor");
|
||||
}
|
||||
public final String getDescriptor() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".descriptor");
|
||||
}
|
||||
|
||||
public final String getIdent() {
|
||||
return this.getSpeciesRoot().getUID();
|
||||
}
|
||||
public final String getIdent() {
|
||||
return this.getSpeciesRoot().getUID();
|
||||
}
|
||||
|
||||
public final IChromosomeType getChromosome(final int i) {
|
||||
for (final IChromosomeType chromosome : this.getSpeciesRoot().getKaryotype()) {
|
||||
if (i == chromosome.ordinal()) {
|
||||
return chromosome;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public final IChromosomeType getChromosome(final int i) {
|
||||
for (final IChromosomeType chromosome : this.getSpeciesRoot().getKaryotype()) {
|
||||
if (i == chromosome.ordinal()) {
|
||||
return chromosome;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract int getColour();
|
||||
public abstract int getColour();
|
||||
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (allele instanceof IAlleleBoolean) {
|
||||
return ((IAlleleBoolean) allele).getValue() ? Binnie.Language.localise(BinnieCore.instance, "allele.true") : Binnie.Language.localise(BinnieCore.instance, "allele.false");
|
||||
}
|
||||
if (allele.getName() == "for.gui.maximum") {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
return allele.getName();
|
||||
}
|
||||
public String getAlleleName(final IChromosomeType chromosome, final IAllele allele) {
|
||||
if (allele instanceof IAlleleBoolean) {
|
||||
return ((IAlleleBoolean) allele).getValue() ? Binnie.Language.localise(BinnieCore.instance, "allele.true") : Binnie.Language.localise(BinnieCore.instance, "allele.false");
|
||||
}
|
||||
if (allele.getName() == "for.gui.maximum") {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "allele.fertility.maximum");
|
||||
}
|
||||
return allele.getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".shortName");
|
||||
}
|
||||
public String getName() {
|
||||
return BinnieCore.proxy.localise(this.getSpeciesRoot().getUID() + ".shortName");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStackRepresentitive() {
|
||||
final IIndividual first = this.getSpeciesRoot().getIndividualTemplates().get(0);
|
||||
return this.getSpeciesRoot().getMemberStack(first, this.getDefaultType());
|
||||
}
|
||||
@Override
|
||||
public ItemStack getItemStackRepresentitive() {
|
||||
final IIndividual first = this.getSpeciesRoot().getIndividualTemplates().get(0);
|
||||
return this.getSpeciesRoot().getMemberStack(first, this.getDefaultType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public abstract boolean isDNAManipulable(final ItemStack p0);
|
||||
public abstract boolean isDNAManipulable(final ItemStack p0);
|
||||
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
public IIndividual getConversion(final ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final IIndividual getDefaultIndividual() {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getDefaultTemplate());
|
||||
}
|
||||
public final IIndividual getDefaultIndividual() {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getDefaultTemplate());
|
||||
}
|
||||
|
||||
public final int getDefaultType() {
|
||||
return this.getActiveTypes()[0];
|
||||
}
|
||||
public final ISpeciesType getDefaultType() {
|
||||
return this.getActiveTypes()[0];
|
||||
}
|
||||
|
||||
public abstract int[] getActiveTypes();
|
||||
public abstract ISpeciesType[] getActiveTypes();
|
||||
|
||||
public abstract void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
public abstract void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
|
||||
public ItemStack getConversionStack(final ItemStack stack) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getConversion(stack), this.getDefaultType());
|
||||
}
|
||||
public ItemStack getConversionStack(final ItemStack stack) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getConversion(stack), this.getDefaultType());
|
||||
}
|
||||
|
||||
public final Collection<IChromosomeType> getActiveKaryotype() {
|
||||
return Binnie.Genetics.getActiveChromosomes(this.getSpeciesRoot());
|
||||
}
|
||||
public final Collection<IChromosomeType> getActiveKaryotype() {
|
||||
return Binnie.Genetics.getActiveChromosomes(this.getSpeciesRoot());
|
||||
}
|
||||
|
||||
public ItemStack getDefaultMember(final String uid) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getIndividual(uid), this.getDefaultType());
|
||||
}
|
||||
public ItemStack getDefaultMember(final String uid) {
|
||||
return this.getSpeciesRoot().getMemberStack(this.getIndividual(uid), this.getDefaultType());
|
||||
}
|
||||
|
||||
public IIndividual getIndividual(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
public IIndividual getIndividual(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsIndividual(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
|
||||
public IGenome getGenome(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
public IGenome getGenome(final String uid) {
|
||||
return this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(uid));
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,8 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
public enum EnumBeeBooleanModifier
|
||||
{
|
||||
Sealed,
|
||||
SelfLighted,
|
||||
SunlightStimulated,
|
||||
Hellish;
|
||||
public enum EnumBeeBooleanModifier {
|
||||
Sealed,
|
||||
SelfLighted,
|
||||
SunlightStimulated,
|
||||
Hellish;
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
|
||||
public enum EnumBeeModifier
|
||||
{
|
||||
Territory,
|
||||
Mutation,
|
||||
Lifespan,
|
||||
Production,
|
||||
Flowering,
|
||||
GeneticDecay;
|
||||
public enum EnumBeeModifier {
|
||||
Territory,
|
||||
Mutation,
|
||||
Lifespan,
|
||||
Production,
|
||||
Flowering,
|
||||
GeneticDecay;
|
||||
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "beemodifier." + this.name().toLowerCase());
|
||||
}
|
||||
public String getName() {
|
||||
return Binnie.Language.localise(BinnieCore.instance, "beemodifier." + this.name().toLowerCase());
|
||||
}
|
||||
}
|
||||
Loaded 100 of 826 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user