mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 09:34:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e3c23e4eb | ||
|
|
d8ffc5c4b8 | ||
|
|
737f64eeab | ||
|
|
0db27d83b0 | ||
|
|
f57de19b06 | ||
|
|
1fed58fae5 | ||
|
|
1d8d61daf1 | ||
|
|
65bd93749c | ||
|
|
ac48b4b5c6 | ||
|
|
3be3ecfc8a | ||
|
|
10aae6b6bc | ||
|
|
d84560926c | ||
|
|
ab3de49198 | ||
|
|
b2b743398c | ||
|
|
52f233e84a | ||
|
|
2f2ec91670 | ||
|
|
2e2fa8e6df | ||
|
|
3de6e0c5b7 | ||
|
|
0f4ba8d8fa | ||
|
|
9570d26c83 | ||
|
|
01dc4f2bfe | ||
|
|
80de4d6490 | ||
|
|
253e9f18ed | ||
|
|
bbda5c8ba9 |
No files matched your search
+5
-5
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.1.2080
|
||||
forgeversion=12.18.1.2094
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
tesla_version=1.10.2-1.2.1.42
|
||||
jei_version=3.8.1.242
|
||||
ic2_version=2.6.38-ex110
|
||||
tesla_version=1.10.2-1.2.1.49
|
||||
jei_version=3.12.2.290
|
||||
ic2_version=2.6.76-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=2
|
||||
version_patch=11
|
||||
version_patch=14
|
||||
@@ -12,20 +12,6 @@ package forestry;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.climate.ClimateEventHandler;
|
||||
@@ -40,6 +26,19 @@ import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -53,7 +52,7 @@ import forestry.plugins.PluginManager;
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.10]",
|
||||
dependencies = "required-after:Forge@[12.18.1.2080,);"
|
||||
+ "after:JEI@[3.8.0,);"
|
||||
+ "after:JEI@[3.11.2.278,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
public class ApicultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorApiarist}.
|
||||
* The {@link Capability#getDefaultInstance()} will always protect the wearer with no side effects.
|
||||
*/
|
||||
@CapabilityInject(IArmorApiarist.class)
|
||||
public static Capability<IArmorApiarist> ARMOR_APIARIST;
|
||||
}
|
||||
@@ -5,21 +5,24 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* When implemented by armor piece items, allows them to act as apiarist's armor.
|
||||
* When implemented as a capability by armor items, protects the wearer from negative bee effects.
|
||||
* @see ApicultureCapabilities#ARMOR_APIARIST
|
||||
*/
|
||||
public interface IArmorApiarist {
|
||||
/**
|
||||
* Called when the apiarist's armor acts as protection against an attack.
|
||||
*
|
||||
* @param entity Entity being attacked
|
||||
* @param armor Armor item
|
||||
* @param cause Optional cause of attack, such as a bee effect identifier
|
||||
* @param entity Entity being attacked
|
||||
* @param armor Armor item
|
||||
* @param cause Optional cause of attack, such as a bee effect identifier
|
||||
* @param doProtect Whether or not to actually do the side effects of protection
|
||||
* @return Whether or not the armor should protect the player from that attack
|
||||
*/
|
||||
boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect);
|
||||
boolean protectEntity(EntityLivingBase entity, ItemStack armor, @Nullable String cause, boolean doProtect);
|
||||
}
|
||||
@@ -5,33 +5,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.core.ILocatable;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider {
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider, ILocatable {
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
|
||||
* Used by {@link IBeeRoot#createBeeHousingModifier(IBeeHousing)}
|
||||
* to combine bee modifiers from several sources that can change over time.
|
||||
* @return IBeeModifiers from the housing, frames, etc.
|
||||
*/
|
||||
Iterable<IBeeModifier> getBeeModifiers();
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingListener(IBeeHousing housing)
|
||||
* Used by {@link IBeeRoot#createBeeHousingListener(IBeeHousing)}
|
||||
* to combine bee listeners from several sources that can change over time.
|
||||
* @return IBeeListeners from the housing, multiblock parts, etc.
|
||||
*/
|
||||
Iterable<IBeeListener> getBeeListeners();
|
||||
|
||||
@Nonnull
|
||||
IBeeHousingInventory getBeeInventory();
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
@@ -40,14 +36,11 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvid
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.2
|
||||
* @return exact coordinates where bee FX should spawn from
|
||||
* @return exact coordinates where bee particle FX should spawn from
|
||||
*/
|
||||
Vec3d getBeeFXCoordinates();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
|
||||
public class ArboricultureCapabilities {
|
||||
/**
|
||||
* Capability for {@link IArmorNaturalist}.
|
||||
* The {@link Capability#getDefaultInstance()} will always show pollination with no side effects.
|
||||
*/
|
||||
@CapabilityInject(IArmorNaturalist.class)
|
||||
public static Capability<IArmorNaturalist> ARMOR_NATURALIST;
|
||||
}
|
||||
@@ -60,15 +60,15 @@ public enum EnumTemperature {
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumTemperature getFromBiome(Biome Biome) {
|
||||
if (BiomeHelper.isBiomeHellish(Biome)) {
|
||||
public static EnumTemperature getFromBiome(Biome biome) {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
return getFromValue(Biome.getTemperature());
|
||||
return getFromValue(biome.getTemperature());
|
||||
}
|
||||
|
||||
public static EnumTemperature getFromBiome(Biome Biome, World world, BlockPos pos) {
|
||||
if (BiomeHelper.isBiomeHellish(Biome)) {
|
||||
public static EnumTemperature getFromBiome(Biome biome, World world, BlockPos pos) {
|
||||
if (BiomeHelper.isBiomeHellish(biome)) {
|
||||
return HELLISH;
|
||||
}
|
||||
float temperature = ForestryAPI.climateManager.getTemperature(world, pos);
|
||||
|
||||
@@ -5,20 +5,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import forestry.api.arboriculture.ArboricultureCapabilities;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Naturalist armor allows players to see pollinated tree leaves.
|
||||
*
|
||||
* @see ArboricultureCapabilities#ARMOR_NATURALIST
|
||||
*/
|
||||
public interface IArmorNaturalist {
|
||||
|
||||
/**
|
||||
* Called when the naturalist's armor acts as spectacles for seeing pollinated tree leaves/flowers.
|
||||
* Called to see if this naturalist's armor allows for seeing pollinated tree leaves/flowers.
|
||||
*
|
||||
* @param player
|
||||
* Player doing the viewing
|
||||
* @param armor
|
||||
* Armor item
|
||||
* @param doSee
|
||||
* Whether or not to actually do the side effects of viewing
|
||||
* @param player Player doing the viewing
|
||||
* @param armor Armor item
|
||||
* @param doSee Whether or not to actually do the side effects of viewing
|
||||
* @return true if the armor actually allows the player to see pollination.
|
||||
*/
|
||||
boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his species alleles of a individual.
|
||||
*/
|
||||
public class AlleleSpeciesRegisterEvent extends Event {
|
||||
|
||||
private final ISpeciesRoot root;
|
||||
|
||||
public AlleleSpeciesRegisterEvent(ISpeciesRoot root) {
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
public ISpeciesRoot getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,23 +3,22 @@ package forestry.api.genetics;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
|
||||
public interface IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack);
|
||||
void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack);
|
||||
void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack);
|
||||
void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack);
|
||||
|
||||
Map<String, ItemStack> getIconStacks();
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ package forestry.api.recipes;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface ICarpenterRecipe extends IForestryRecipe {
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.recipes;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
/**
|
||||
@@ -30,4 +33,7 @@ public interface IDescriptiveRecipe extends IRecipe {
|
||||
*/
|
||||
Object[] getIngredients();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ItemStack getRecipeOutput();
|
||||
}
|
||||
@@ -10,13 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IArmorApiaristHelper;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IArmorApiaristHelper;
|
||||
|
||||
public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
|
||||
@Override
|
||||
@@ -25,12 +25,16 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = stack.getItem();
|
||||
if (!(item instanceof IArmorApiarist)) {
|
||||
final Item item = stack.getItem();
|
||||
final IArmorApiarist armorApiarist;
|
||||
if (item instanceof IArmorApiarist) { // legacy
|
||||
armorApiarist = (IArmorApiarist) item;
|
||||
} else if (stack.hasCapability(ApicultureCapabilities.ARMOR_APIARIST, null)) {
|
||||
armorApiarist = stack.getCapability(ApicultureCapabilities.ARMOR_APIARIST, null);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
IArmorApiarist armorApiarist = (IArmorApiarist) item;
|
||||
return armorApiarist.protectEntity(entity, stack, cause, doProtect);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import forestry.Forestry;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHiveRegistry.HiveType;
|
||||
@@ -36,6 +37,7 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.capabilities.ArmorApiarist;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
@@ -72,6 +74,7 @@ import forestry.apiculture.worldgen.HiveRegistry;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.PluginFluids;
|
||||
import forestry.core.capabilities.NullStorage;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
@@ -106,6 +109,7 @@ import net.minecraft.world.storage.loot.LootTableList;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
@@ -161,6 +165,9 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hard);
|
||||
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hardcore);
|
||||
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.insane);
|
||||
|
||||
// Capabilities
|
||||
CapabilityManager.INSTANCE.register(IArmorApiarist.class, new NullStorage<>(), () -> ArmorApiarist.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -286,6 +286,11 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
boolean isLit = isLit(stack);
|
||||
tileCandle.setColour(colour);
|
||||
tileCandle.setLit(isLit);
|
||||
if (tileCandle.isLit()) {
|
||||
world.theProfiler.startSection("checkLight");
|
||||
world.checkLight(pos);
|
||||
world.theProfiler.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,19 +327,11 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
}
|
||||
|
||||
public ItemStack getUnlitCandle(int amount) {
|
||||
ItemStack itemStack = new ItemStack(this, amount, 0);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger(BlockCandle.colourTagName, 0xffffff);
|
||||
itemStack.setTagCompound(tag);
|
||||
return itemStack;
|
||||
return new ItemStack(this, amount, 0);
|
||||
}
|
||||
|
||||
public ItemStack getLitCandle(int amount) {
|
||||
ItemStack itemStack = new ItemStack(this, amount, 1);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger(BlockCandle.colourTagName, 0xffffff);
|
||||
itemStack.setTagCompound(tag);
|
||||
return itemStack;
|
||||
return new ItemStack(this, amount, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,10 +60,11 @@ public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
if (heldItem != null && BlockCandle.lightingItems.contains(heldItem.getItem())) {
|
||||
IBlockState blockState = worldIn.getBlockState(pos);
|
||||
Block block = blockState.getBlock();
|
||||
IBlockState activatedState = PluginApiculture.blocks.candle.getStateFromMeta(block.getMetaFromState(blockState) | 0x08);
|
||||
IBlockState activatedState = PluginApiculture.blocks.candle.getStateFromMeta(block.getMetaFromState(blockState));
|
||||
worldIn.setBlockState(pos, activatedState, Constants.FLAG_BLOCK_SYNC);
|
||||
TileCandle tc = new TileCandle();
|
||||
tc.setColour(0); // default to white
|
||||
tc.setColour(16777215); // default to white
|
||||
tc.setLit(true);
|
||||
worldIn.setTileEntity(pos, tc);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package forestry.apiculture.capabilities;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ArmorApiarist implements IArmorApiarist {
|
||||
public static final ArmorApiarist INSTANCE = new ArmorApiarist();
|
||||
|
||||
protected ArmorApiarist() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, @Nullable String cause, boolean doProtect) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,6 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public Set<IErrorState> getCanWork(IBeeHousing housing) {
|
||||
World world = housing.getWorldObj();
|
||||
Biome biome = housing.getBiome();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
|
||||
Set<IErrorState> errorStates = new HashSet<>();
|
||||
@@ -282,7 +281,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// / Check for the sky, except if in hell
|
||||
if (biome != null && !BiomeHelper.isBiomeHellish(biome)) {
|
||||
if (!world.provider.getHasNoSky()) {
|
||||
if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NO_SKY);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -47,208 +48,217 @@ public class BeeAlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
|
||||
String customSecondaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
|
||||
|
||||
gui.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryBeeKey), GuiAlyzer.checkCustomName(customSecondaryBeeKey));
|
||||
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
|
||||
String customSecondaryBeeKey = "for.bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
|
||||
|
||||
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryBeeKey), GuiAlyzer.checkCustomName(customSecondaryBeeKey));
|
||||
textLayout.newLine();
|
||||
}
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
textLayout.newLine();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
guiAlyzer.drawFertilityInfo(primaryFertility.getValue(), GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(primaryFertility.isDominant()), 0);
|
||||
guiAlyzer.drawFertilityInfo(secondaryFertility.getValue(), GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(secondaryFertility.isDominant()), 0);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
textLayout.newLine();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
gui.drawFertilityInfo(primaryFertility.getValue(), GuiAlyzer.COLUMN_1, gui.getColorCoding(primaryFertility.isDominant()), 0);
|
||||
gui.drawFertilityInfo(secondaryFertility.getValue(), GuiAlyzer.COLUMN_2, gui.getColorCoding(secondaryFertility.isDominant()), 0);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
gui.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
gui.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
String yes = Translator.translateToLocal("for.yes");
|
||||
String no = Translator.translateToLocal("for.no");
|
||||
|
||||
String diurnal0, diurnal1, nocturnal0, nocturnal1;
|
||||
if (bee.getGenome().getNeverSleeps()) {
|
||||
nocturnal0 = diurnal0 = yes;
|
||||
} else {
|
||||
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
String displayText;
|
||||
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
|
||||
String displayTextKey = "for.bees.stock.pristine";
|
||||
if (!bee.isNatural()) {
|
||||
displayTextKey = "for.bees.stock.ignoble";
|
||||
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
displayText = Translator.translateToLocal(displayTextKey);
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, gui.getFontColor().get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
if (bee.getGeneration() >= 0) {
|
||||
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine(16);
|
||||
|
||||
String yes = Translator.translateToLocal("for.yes");
|
||||
String no = Translator.translateToLocal("for.no");
|
||||
|
||||
String diurnal0, diurnal1, nocturnal0, nocturnal1;
|
||||
if (bee.getGenome().getNeverSleeps()) {
|
||||
nocturnal0 = diurnal0 = yes;
|
||||
} else {
|
||||
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, gui.getFontColor().get("gui.beealyzer.binomial"));
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
String displayText;
|
||||
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
|
||||
String displayTextKey = "for.bees.stock.pristine";
|
||||
if (!bee.isNatural()) {
|
||||
displayTextKey = "for.bees.stock.ignoble";
|
||||
}
|
||||
displayText = Translator.translateToLocal(displayTextKey);
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
if (bee.getGeneration() >= 0) {
|
||||
textLayout.newLineCompressed();
|
||||
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
WidgetManager widgetManager = gui.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getProduceList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IBee bee = BeeManager.beeRoot.getMember(itemStack);
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getSpecialtyList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
WidgetManager widgetManager = guiAlyzer.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getProduceList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : bee.getSpecialtyList()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -32,6 +32,7 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
@@ -1019,6 +1020,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
for (BeeDefinition bee : values()) {
|
||||
bee.registerMutations();
|
||||
}
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(BeeManager.beeRoot));
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
|
||||
@@ -10,26 +10,29 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.arboriculture.ArboricultureCapabilities;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArmorNaturalist, IItemModelRegister {
|
||||
public class ItemArmorApiarist extends ItemArmor implements IItemModelRegister {
|
||||
|
||||
public ItemArmorApiarist(EntityEquipmentSlot equipmentSlotIn) {
|
||||
super(ArmorMaterial.LEATHER, 0, equipmentSlotIn);
|
||||
@@ -57,14 +60,28 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect) {
|
||||
return true;
|
||||
}
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return new ICapabilityProvider() {
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ArboricultureCapabilities.ARMOR_NATURALIST) {
|
||||
return armorType == EntityEquipmentSlot.HEAD;
|
||||
}
|
||||
return capability == ApicultureCapabilities.ARMOR_APIARIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
|
||||
return armorType == EntityEquipmentSlot.HEAD;
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ApicultureCapabilities.ARMOR_APIARIST) {
|
||||
return capability.getDefaultInstance();
|
||||
} else if (capability == ArboricultureCapabilities.ARMOR_NATURALIST &&
|
||||
armorType == EntityEquipmentSlot.HEAD) {
|
||||
return capability.getDefaultInstance();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.apiculture.ApicultureCapabilities;
|
||||
import forestry.api.apiculture.IHiveTile;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemForestry;
|
||||
@@ -9,6 +12,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
@@ -18,8 +22,10 @@ import net.minecraft.util.EnumHandSide;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
||||
public class ItemSmoker extends ItemForestry implements IArmorApiarist {
|
||||
public class ItemSmoker extends ItemForestry {
|
||||
public ItemSmoker() {
|
||||
super(Tabs.tabApiculture);
|
||||
setMaxStackSize(1);
|
||||
@@ -102,8 +108,22 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect) {
|
||||
return true;
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return new ICapabilityProvider() {
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == ApicultureCapabilities.ARMOR_APIARIST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ApicultureCapabilities.ARMOR_APIARIST) {
|
||||
return capability.getDefaultInstance();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
private final InventoryBeeHousing inventory;
|
||||
private final IBeekeepingLogic beekeepingLogic;
|
||||
|
||||
private Biome cachedBiome;
|
||||
private float tempChange = 0.0f;
|
||||
private float humidChange = 0.0f;
|
||||
|
||||
@@ -381,11 +380,8 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
if (cachedBiome == null) {
|
||||
BlockPos coords = getReferenceCoord();
|
||||
cachedBiome = worldObj.getBiome(coords);
|
||||
}
|
||||
return cachedBiome;
|
||||
BlockPos coords = getReferenceCoord();
|
||||
return worldObj.getBiome(coords);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,6 @@ import net.minecraft.world.biome.Biome;
|
||||
public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IOwnedTile, IClimatised, IGuiBeeHousingInventory, IStreamableGui {
|
||||
private final OwnerHandler ownerHandler = new OwnerHandler();
|
||||
private final IBeekeepingLogic beeLogic;
|
||||
private Biome cachedBiome;
|
||||
|
||||
// CLIENT
|
||||
private int breedingProgressPercent = 0;
|
||||
@@ -164,10 +163,7 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
|
||||
// / IBEEHOUSING
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
if (cachedBiome == null) {
|
||||
cachedBiome = worldObj.getBiome(getPos());
|
||||
}
|
||||
return cachedBiome;
|
||||
return worldObj.getBiome(getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
@@ -30,6 +30,7 @@ import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ILeafTranslator;
|
||||
import forestry.api.genetics.ISaplingTranslator;
|
||||
@@ -41,6 +42,7 @@ import forestry.arboriculture.blocks.BlockPile;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.blocks.log.BlockArbLog;
|
||||
import forestry.arboriculture.blocks.slab.BlockArbSlab;
|
||||
import forestry.arboriculture.capabilities.ArmorNaturalist;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
import forestry.arboriculture.genetics.TreeBranchDefinition;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
@@ -64,6 +66,7 @@ import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.arboriculture.tiles.TilePile;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.capabilities.NullStorage;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
@@ -98,6 +101,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -140,6 +144,9 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.hard);
|
||||
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.hardcore);
|
||||
TreeManager.treeRoot.registerTreekeepingMode(TreekeepingMode.insane);
|
||||
|
||||
// Capabilities
|
||||
CapabilityManager.INSTANCE.register(IArmorNaturalist.class, new NullStorage<>(), () -> ArmorNaturalist.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package forestry.arboriculture.capabilities;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ArmorNaturalist implements IArmorNaturalist {
|
||||
public static final ArmorNaturalist INSTANCE = new ArmorNaturalist();
|
||||
|
||||
protected ArmorNaturalist() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import forestry.core.gui.widgets.ItemStackWidget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -58,204 +59,213 @@ public class TreeAlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack) {
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
EnumGermlingType type = TreeManager.treeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.", "");
|
||||
String customSecondaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getSecondary().getUnlocalizedName().replace("trees.species.", "");
|
||||
|
||||
gui.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), tree, EnumTreeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryTreeKey), GuiAlyzer.checkCustomName(customSecondaryTreeKey));
|
||||
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
EnumGermlingType type = TreeManager.treeRoot.getType(itemStack);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getPrimary().getUnlocalizedName().replace("trees.species.", "");
|
||||
String customSecondaryTreeKey = "trees.custom.treealyzer." + type.getName() + "." + tree.getGenome().getSecondary().getUnlocalizedName().replace("trees.species.", "");
|
||||
|
||||
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), tree, EnumTreeChromosome.SPECIES, GuiAlyzer.checkCustomName(customPrimaryTreeKey), GuiAlyzer.checkCustomName(customSecondaryTreeKey));
|
||||
textLayout.newLine();
|
||||
}
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.saplings"), tree, EnumTreeChromosome.FERTILITY);
|
||||
textLayout.newLineCompressed();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.maturity"), tree, EnumTreeChromosome.MATURATION);
|
||||
textLayout.newLineCompressed();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.height"), tree, EnumTreeChromosome.HEIGHT);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
IAlleleInteger activeGirth = (IAlleleInteger) tree.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH);
|
||||
IAlleleInteger inactiveGirth = (IAlleleInteger) tree.getGenome().getInactiveAllele(EnumTreeChromosome.GIRTH);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.girth"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawLine(String.format("%sx%s", activeGirth.getValue(), activeGirth.getValue()), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.GIRTH, false);
|
||||
guiAlyzer.drawLine(String.format("%sx%s", inactiveGirth.getValue(), inactiveGirth.getValue()), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.GIRTH, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.yield"), tree, EnumTreeChromosome.YIELD);
|
||||
textLayout.newLineCompressed();
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.sappiness"), tree, EnumTreeChromosome.SAPPINESS);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
guiAlyzer.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), tree, EnumTreeChromosome.EFFECT);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.saplings"), tree, EnumTreeChromosome.FERTILITY);
|
||||
textLayout.newLineCompressed();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.maturity"), tree, EnumTreeChromosome.MATURATION);
|
||||
textLayout.newLineCompressed();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.height"), tree, EnumTreeChromosome.HEIGHT);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
IAlleleInteger activeGirth = (IAlleleInteger) tree.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH);
|
||||
IAlleleInteger inactiveGirth = (IAlleleInteger) tree.getGenome().getInactiveAllele(EnumTreeChromosome.GIRTH);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.girth"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawLine(String.format("%sx%s", activeGirth.getValue(), activeGirth.getValue()), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.GIRTH, false);
|
||||
gui.drawLine(String.format("%sx%s", inactiveGirth.getValue(), inactiveGirth.getValue()), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.GIRTH, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.yield"), tree, EnumTreeChromosome.YIELD);
|
||||
textLayout.newLineCompressed();
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.sappiness"), tree, EnumTreeChromosome.SAPPINESS);
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
gui.drawChromosomeRow(Translator.translateToLocal("for.gui.effect"), tree, EnumTreeChromosome.EFFECT);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack) {
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage();
|
||||
|
||||
int speciesDominance0 = gui.getColorCoding(tree.getGenome().getPrimary().isDominant());
|
||||
int speciesDominance1 = gui.getColorCoding(tree.getGenome().getSecondary().isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTreeSpecies activeSpecies = (IAlleleTreeSpecies) tree.getGenome().getActiveAllele(EnumTreeChromosome.SPECIES);
|
||||
IAlleleTreeSpecies inActiveSpecies = (IAlleleTreeSpecies) tree.getGenome().getInactiveAllele(EnumTreeChromosome.SPECIES);
|
||||
|
||||
int activeCombustibility = activeSpecies.getWoodProvider().getCombustibility();
|
||||
int inactiveCombustibility = inActiveSpecies.getWoodProvider().getCombustibility();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.combustibility"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawLine(Integer.toString(activeCombustibility), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
gui.drawLine(Integer.toString(inactiveCombustibility), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
int activeCarbonization = activeSpecies.getWoodProvider().getCarbonization();
|
||||
int inactiveCarbonization = inActiveSpecies.getWoodProvider().getCarbonization();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.carbonization"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawLine(Integer.toString(activeCarbonization), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
gui.drawLine(Integer.toString(inactiveCarbonization), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.native"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_1,
|
||||
speciesDominance0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getSecondary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_2,
|
||||
speciesDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
// FRUITS
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.supports"), GuiAlyzer.COLUMN_0);
|
||||
List<IFruitFamily> families0 = new ArrayList<>(tree.getGenome().getPrimary().getSuitableFruit());
|
||||
List<IFruitFamily> families1 = new ArrayList<>(tree.getGenome().getSecondary().getSuitableFruit());
|
||||
|
||||
int max = Math.max(families0.size(), families1.size());
|
||||
for (int i = 0; i < max; i++) {
|
||||
if (i > 0) {
|
||||
textLayout.newLineCompressed();
|
||||
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (families0.size() > i) {
|
||||
textLayout.drawLine(families0.get(i).getName(), GuiAlyzer.COLUMN_1, speciesDominance0);
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage();
|
||||
|
||||
int speciesDominance0 = guiAlyzer.getColorCoding(tree.getGenome().getPrimary().isDominant());
|
||||
int speciesDominance1 = guiAlyzer.getColorCoding(tree.getGenome().getSecondary().isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTreeSpecies activeSpecies = (IAlleleTreeSpecies) tree.getGenome().getActiveAllele(EnumTreeChromosome.SPECIES);
|
||||
IAlleleTreeSpecies inActiveSpecies = (IAlleleTreeSpecies) tree.getGenome().getInactiveAllele(EnumTreeChromosome.SPECIES);
|
||||
|
||||
int activeCombustibility = activeSpecies.getWoodProvider().getCombustibility();
|
||||
int inactiveCombustibility = inActiveSpecies.getWoodProvider().getCombustibility();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.combustibility"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawLine(Integer.toString(activeCombustibility), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
guiAlyzer.drawLine(Integer.toString(inactiveCombustibility), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
int activeCarbonization = activeSpecies.getWoodProvider().getCarbonization();
|
||||
int inactiveCarbonization = inActiveSpecies.getWoodProvider().getCarbonization();
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.carbonization"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawLine(Integer.toString(activeCarbonization), GuiAlyzer.COLUMN_1, tree, EnumTreeChromosome.SPECIES, false);
|
||||
guiAlyzer.drawLine(Integer.toString(inactiveCarbonization), GuiAlyzer.COLUMN_2, tree, EnumTreeChromosome.SPECIES, true);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.native"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_1,
|
||||
speciesDominance0);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui." + tree.getGenome().getSecondary().getPlantType().toString().toLowerCase(Locale.ENGLISH)), GuiAlyzer.COLUMN_2,
|
||||
speciesDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
// FRUITS
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.supports"), GuiAlyzer.COLUMN_0);
|
||||
List<IFruitFamily> families0 = new ArrayList<>(tree.getGenome().getPrimary().getSuitableFruit());
|
||||
List<IFruitFamily> families1 = new ArrayList<>(tree.getGenome().getSecondary().getSuitableFruit());
|
||||
|
||||
int max = Math.max(families0.size(), families1.size());
|
||||
for (int i = 0; i < max; i++) {
|
||||
if (i > 0) {
|
||||
textLayout.newLineCompressed();
|
||||
}
|
||||
|
||||
if (families0.size() > i) {
|
||||
textLayout.drawLine(families0.get(i).getName(), GuiAlyzer.COLUMN_1, speciesDominance0);
|
||||
}
|
||||
if (families1.size() > i) {
|
||||
textLayout.drawLine(families1.get(i).getName(), GuiAlyzer.COLUMN_2, speciesDominance1);
|
||||
}
|
||||
|
||||
}
|
||||
if (families1.size() > i) {
|
||||
textLayout.drawLine(families1.get(i).getName(), GuiAlyzer.COLUMN_2, speciesDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int fruitDominance0 = guiAlyzer.getColorCoding(tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
int fruitDominance1 = guiAlyzer.getColorCoding(tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fruits"), GuiAlyzer.COLUMN_0);
|
||||
String strike = "";
|
||||
IAllele fruit0 = tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.canBearFruit() && fruit0 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
|
||||
textLayout.drawLine(strike + tree.getGenome().getFruitProvider().getDescription(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
|
||||
strike = "";
|
||||
IAlleleFruit fruit1 = (IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.getGenome().getSecondary().getSuitableFruit().contains(fruit1.getProvider().getFamily()) && fruit1 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
textLayout.drawLine(strike + fruit1.getProvider().getDescription(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.family"), GuiAlyzer.COLUMN_0);
|
||||
IFruitFamily primary = tree.getGenome().getFruitProvider().getFamily();
|
||||
IFruitFamily secondary = ((IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS)).getProvider().getFamily();
|
||||
|
||||
if (primary != null) {
|
||||
textLayout.drawLine(primary.getName(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
}
|
||||
if (secondary != null) {
|
||||
textLayout.drawLine(secondary.getName(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
int fruitDominance0 = gui.getColorCoding(tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
int fruitDominance1 = gui.getColorCoding(tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS).isDominant());
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fruits"), GuiAlyzer.COLUMN_0);
|
||||
String strike = "";
|
||||
IAllele fruit0 = tree.getGenome().getActiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.canBearFruit() && fruit0 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
textLayout.drawLine(strike + tree.getGenome().getFruitProvider().getDescription(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
|
||||
strike = "";
|
||||
IAlleleFruit fruit1 = (IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS);
|
||||
if (!tree.getGenome().getSecondary().getSuitableFruit().contains(fruit1.getProvider().getFamily()) && fruit1 != AlleleFruit.fruitNone) {
|
||||
strike = TextFormatting.STRIKETHROUGH.toString();
|
||||
}
|
||||
textLayout.drawLine(strike + fruit1.getProvider().getDescription(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.family"), GuiAlyzer.COLUMN_0);
|
||||
IFruitFamily primary = tree.getGenome().getFruitProvider().getFamily();
|
||||
IFruitFamily secondary = ((IAlleleFruit) tree.getGenome().getInactiveAllele(EnumTreeChromosome.FRUITS)).getProvider().getFamily();
|
||||
|
||||
if (primary != null) {
|
||||
textLayout.drawLine(primary.getName(), GuiAlyzer.COLUMN_1, fruitDominance0);
|
||||
}
|
||||
if (secondary != null) {
|
||||
textLayout.drawLine(secondary.getName(), GuiAlyzer.COLUMN_2, fruitDominance1);
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack) {
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
WidgetManager widgetManager = gui.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getProducts().keySet()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
ITree tree = TreeManager.treeRoot.getMember(itemStack);
|
||||
if (tree == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getSpecialties().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, gui.getGuiLeft() + x, gui.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
WidgetManager widgetManager = guiAlyzer.getWidgetManager();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.produce") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getProducts().keySet()) {
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.specialty") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : tree.getSpecialties().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, guiAlyzer.getGuiLeft() + x, guiAlyzer.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,6 +35,7 @@ import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
@@ -91,6 +92,7 @@ import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSerializable {
|
||||
Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), EnumVanillaWoodType.OAK) {
|
||||
@@ -1066,6 +1068,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(TreeManager.treeRoot));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package forestry.core.capabilities;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
public class NullStorage<T> implements Capability.IStorage<T> {
|
||||
@Override
|
||||
public NBTBase writeNBT(Capability<T> capability, T instance, EnumFacing side) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNBT(Capability<T> capability, T instance, EnumFacing side, NBTBase nbt) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,23 +10,27 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IArmorNaturalist;
|
||||
import forestry.api.arboriculture.ArboricultureCapabilities;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.CreativeTabForestry;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist, IItemModelRegister {
|
||||
public class ItemArmorNaturalist extends ItemArmor implements IItemModelRegister {
|
||||
|
||||
public ItemArmorNaturalist() {
|
||||
super(ArmorMaterial.LEATHER, 0, EntityEquipmentSlot.HEAD);
|
||||
@@ -34,6 +38,7 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist,
|
||||
setCreativeTab(CreativeTabForestry.tabForestry);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
|
||||
return Constants.MOD_ID + ":" + Constants.TEXTURE_NATURALIST_ARMOR_PRIMARY;
|
||||
@@ -50,9 +55,25 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist,
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
|
||||
return armorType == EntityEquipmentSlot.HEAD;
|
||||
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
|
||||
return new ICapabilityProvider() {
|
||||
@Override
|
||||
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
|
||||
return capability == ArboricultureCapabilities.ARMOR_NATURALIST &&
|
||||
armorType == EntityEquipmentSlot.HEAD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
|
||||
if (capability == ArboricultureCapabilities.ARMOR_NATURALIST &&
|
||||
armorType == EntityEquipmentSlot.HEAD) {
|
||||
return capability.getDefaultInstance();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,20 +22,19 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.energy.EnergyHelper;
|
||||
import forestry.energy.EnergyManager;
|
||||
import forestry.energy.EnergyTransferMode;
|
||||
import forestry.energy.compat.rf.IEnergyConnectionDelegated;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
|
||||
public abstract class TileEngine extends TileBase implements IEnergyConnectionDelegated, IActivatable {
|
||||
public abstract class TileEngine extends TileBase implements IEnergyConnectionDelegated, IActivatable, IStreamableGui {
|
||||
private static final int CANT_SEND_ENERGY_TIME = 20;
|
||||
|
||||
private boolean active = false; // Used for smp.
|
||||
@@ -276,14 +275,22 @@ public abstract class TileEngine extends TileBase implements IEnergyConnectionDe
|
||||
pistonSpeedServer = data.readFloat();
|
||||
energyManager.readData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeInt(currentOutput);
|
||||
data.writeInt(heat);
|
||||
energyManager.writeData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
currentOutput = data.readInt();
|
||||
heat = data.readInt();
|
||||
energyManager.readData(data);
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
@Deprecated //use packets
|
||||
public abstract void getGUINetworkData(int i, int j);
|
||||
|
||||
@Deprecated //use packets
|
||||
public abstract void sendGUINetworkData(Container containerEngine, IContainerListener iCrafting);
|
||||
|
||||
@Override
|
||||
public EnergyManager getEnergyManager() {
|
||||
return energyManager;
|
||||
}
|
||||
|
||||
@@ -14,17 +14,8 @@ import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.ArboricultureCapabilities;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
@@ -43,6 +34,14 @@ import forestry.api.lepidopterology.IButterflyNursery;
|
||||
import forestry.arboriculture.genetics.pollination.CheckPollinatableTree;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.ItemGE;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class GeneticsUtil {
|
||||
|
||||
@@ -56,12 +55,16 @@ public class GeneticsUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item armorItem = armorItemStack.getItem();
|
||||
if (!(armorItem instanceof IArmorNaturalist)) {
|
||||
final Item armorItem = armorItemStack.getItem();
|
||||
final IArmorNaturalist armorNaturalist;
|
||||
if (armorItem instanceof IArmorNaturalist) { // legacy
|
||||
armorNaturalist = (IArmorNaturalist) armorItem;
|
||||
} else if (armorItemStack.hasCapability(ArboricultureCapabilities.ARMOR_NATURALIST, null)) {
|
||||
armorNaturalist = armorItemStack.getCapability(ArboricultureCapabilities.ARMOR_NATURALIST, null);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
IArmorNaturalist armorNaturalist = (IArmorNaturalist) armorItem;
|
||||
return armorNaturalist.canSeePollination(player, armorItemStack, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package forestry.core.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -8,9 +11,12 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class JeiUtil {
|
||||
public static void addDescription(IModRegistry registry, String itemKey, Item... items) {
|
||||
List<ItemStack> itemStacks = new ArrayList<>();
|
||||
for (Item item : items) {
|
||||
addDescription(registry, item, itemKey);
|
||||
itemStacks.add(new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
|
||||
registry.addDescription(itemStacks, "for.jei.description." + itemKey);
|
||||
}
|
||||
|
||||
public static void addDescription(IModRegistry registry, Block... blocks) {
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
package forestry.energy.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotLiquidIn;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
import forestry.energy.inventory.InventoryEngineBiogas;
|
||||
import forestry.energy.tiles.TileEngineBiogas;
|
||||
|
||||
@@ -26,19 +25,10 @@ public class ContainerEngineBiogas extends ContainerLiquidTanks<TileEngineBiogas
|
||||
this.addSlotToContainer(new SlotLiquidIn(engine, InventoryEngineBiogas.SLOT_CAN, 143, 40));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int messageId, int data) {
|
||||
super.updateProgressBar(messageId, data);
|
||||
|
||||
tile.getGUINetworkData(messageId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (IContainerListener crafter : listeners) {
|
||||
tile.sendGUINetworkData(this, crafter);
|
||||
}
|
||||
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToListeners(packet);
|
||||
}
|
||||
}
|
||||
@@ -26,21 +26,11 @@ public class ContainerEngineElectric extends ContainerSocketed<TileEngineElectri
|
||||
this.addSlotToContainer(new SlotFiltered(tile, InventoryEngineElectric.SLOT_BATTERY, 84, 53));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (tile != null) {
|
||||
tile.getGUINetworkData(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if (tile != null) {
|
||||
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToListeners(packet);
|
||||
}
|
||||
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToListeners(packet);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,11 +11,10 @@
|
||||
package forestry.energy.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
import forestry.energy.tiles.TileEnginePeat;
|
||||
|
||||
public class ContainerEnginePeat extends ContainerTile<TileEnginePeat> {
|
||||
@@ -31,19 +30,10 @@ public class ContainerEnginePeat extends ContainerTile<TileEnginePeat> {
|
||||
this.addSlotToContainer(new SlotOutput(tile, 4, 116, 53));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (tile != null) {
|
||||
tile.getGUINetworkData(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (IContainerListener crafter : listeners) {
|
||||
tile.sendGUINetworkData(this, crafter);
|
||||
}
|
||||
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToListeners(packet);
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,9 @@
|
||||
package forestry.energy.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotLiquidIn;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
import forestry.energy.inventory.InventoryGenerator;
|
||||
import forestry.energy.tiles.TileEuGenerator;
|
||||
|
||||
@@ -26,19 +25,10 @@ public class ContainerGenerator extends ContainerLiquidTanks<TileEuGenerator> {
|
||||
this.addSlotToContainer(new SlotLiquidIn(tile, InventoryGenerator.SLOT_CAN, 22, 38));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int messageId, int data) {
|
||||
super.updateProgressBar(messageId, data);
|
||||
|
||||
tile.getGUINetworkData(messageId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for (IContainerListener crafter : listeners) {
|
||||
tile.sendGUINetworkData(this, crafter);
|
||||
}
|
||||
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToListeners(packet);
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,6 @@ import forestry.energy.gui.ContainerEngineBiogas;
|
||||
import forestry.energy.gui.GuiEngineBiogas;
|
||||
import forestry.energy.inventory.InventoryEngineBiogas;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -255,6 +253,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
super.writeData(data);
|
||||
data.writeBoolean(shutdown);
|
||||
tankManager.writeData(data);
|
||||
burnTank.writeData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -262,33 +261,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
super.readData(data);
|
||||
shutdown = data.readBoolean();
|
||||
tankManager.readData(data);
|
||||
}
|
||||
|
||||
/* GUI */
|
||||
@Override
|
||||
public void getGUINetworkData(int id, int data) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
currentOutput = data;
|
||||
break;
|
||||
case 1:
|
||||
energyManager.setEnergyStored(data);
|
||||
break;
|
||||
case 2:
|
||||
heat = data;
|
||||
break;
|
||||
case 3:
|
||||
burnTank.setCapacity(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container containerEngine, IContainerListener iCrafting) {
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 0, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 1, energyManager.getEnergyStored());
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 2, heat);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 3, burnTank.getCapacity());
|
||||
burnTank.readData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,8 +14,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -155,14 +153,6 @@ public class TileEngineClockwork extends TileEngine {
|
||||
|
||||
return fromClockwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container containerEngine, IContainerListener iCrafting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
|
||||
@@ -33,8 +33,6 @@ import forestry.energy.inventory.InventoryEngineElectric;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import ic2.api.energy.prefab.BasicSink;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -226,10 +224,8 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
// / SMP GUI
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeVarInt(currentOutput);
|
||||
data.writeVarInt(heat);
|
||||
super.writeGuiData(data);
|
||||
sockets.writeData(data);
|
||||
energyManager.writeData(data);
|
||||
final boolean hasIc2EnergySink = (ic2EnergySink != null);
|
||||
data.writeBoolean(hasIc2EnergySink);
|
||||
if (hasIc2EnergySink) {
|
||||
@@ -239,10 +235,8 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
currentOutput = data.readVarInt();
|
||||
heat = data.readVarInt();
|
||||
super.readGuiData(data);
|
||||
sockets.readData(data);
|
||||
energyManager.readData(data);
|
||||
final boolean hasIc2EnergySink = data.readBoolean();
|
||||
if (hasIc2EnergySink) {
|
||||
final int energyStored = data.readVarInt();
|
||||
@@ -250,16 +244,6 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
// handled by IStreamableGui
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container containerEngine, IContainerListener iCrafting) {
|
||||
// handled by IStreamableGui
|
||||
}
|
||||
|
||||
// / ENERGY CONFIG CHANGE
|
||||
public void changeEnergyConfig(int euChange, int rfChange, int storageChange) {
|
||||
euConfig.euForCycle += euChange;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.fuels.FuelManager;
|
||||
@@ -19,6 +21,8 @@ import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.inventory.AdjacentInventoryCache;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.tiles.TemperatureState;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
@@ -27,8 +31,6 @@ import forestry.energy.gui.ContainerEnginePeat;
|
||||
import forestry.energy.gui.GuiEnginePeat;
|
||||
import forestry.energy.inventory.InventoryEnginePeat;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -296,37 +298,19 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
nbttagcompound.setInteger("AshProduction", ashProduction);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
// / SMP GUI
|
||||
|
||||
@Override
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
burnTime = j;
|
||||
break;
|
||||
case 1:
|
||||
totalBurnTime = j;
|
||||
break;
|
||||
case 2:
|
||||
currentOutput = j;
|
||||
break;
|
||||
case 3:
|
||||
energyManager.setEnergyStored(j);
|
||||
break;
|
||||
case 4:
|
||||
heat = j;
|
||||
break;
|
||||
}
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeGuiData(data);
|
||||
data.writeInt(burnTime);
|
||||
data.writeInt(totalBurnTime);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendGUINetworkData(Container containerEngine, IContainerListener iCrafting) {
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 0, burnTime);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 1, totalBurnTime);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 2, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 3, energyManager.getEnergyStored());
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 4, heat);
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
super.readGuiData(data);
|
||||
burnTime = data.readInt();
|
||||
totalBurnTime = data.readInt();
|
||||
}
|
||||
|
||||
/* ITriggerProvider */
|
||||
|
||||
@@ -15,8 +15,6 @@ import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -35,6 +33,7 @@ import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.IRenderableTile;
|
||||
@@ -46,7 +45,7 @@ import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
import ic2.api.energy.prefab.BasicSource;
|
||||
|
||||
public class TileEuGenerator extends TileBase implements ISidedInventory, ILiquidTankTile, IRenderableTile {
|
||||
public class TileEuGenerator extends TileBase implements ISidedInventory, ILiquidTankTile, IRenderableTile, IStreamableGui {
|
||||
private static final int maxEnergy = 30000;
|
||||
|
||||
private final TankManager tankManager;
|
||||
@@ -183,19 +182,18 @@ public class TileEuGenerator extends TileBase implements ISidedInventory, ILiqui
|
||||
public TankRenderInfo getProductTankInfo() {
|
||||
return TankRenderInfo.EMPTY;
|
||||
}
|
||||
|
||||
/* SMP GUI */
|
||||
public void getGUINetworkData(int i, int j) {
|
||||
if (i == 0) {
|
||||
if (ic2EnergySource != null) {
|
||||
ic2EnergySource.setEnergyStored(j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
if (ic2EnergySource != null) {
|
||||
data.writeDouble(ic2EnergySource.getEnergyStored());
|
||||
}
|
||||
}
|
||||
|
||||
public void sendGUINetworkData(Container container, IContainerListener iCrafting) {
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
if (ic2EnergySource != null) {
|
||||
iCrafting.sendProgressBarUpdate(container, 0, (short) ic2EnergySource.getEnergyStored());
|
||||
ic2EnergySource.setEnergyStored(data.readDouble());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
package forestry.factory.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import forestry.core.gui.ContainerSocketed;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotLocked;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.packets.PacketItemStackDisplay;
|
||||
import forestry.factory.tiles.TileCentrifuge;
|
||||
|
||||
public class ContainerCentrifuge extends ContainerSocketed<TileCentrifuge> {
|
||||
@@ -23,14 +26,34 @@ public class ContainerCentrifuge extends ContainerSocketed<TileCentrifuge> {
|
||||
super(tile, player, 8, 84);
|
||||
|
||||
// Resource
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 0, 30, 37));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, 0, 16, 37));
|
||||
|
||||
// Craft Preview display
|
||||
addSlotToContainer(new SlotLocked(tile.getCraftPreviewInventory(), 0, 49, 37));
|
||||
|
||||
// Product Inventory
|
||||
for (int l = 0; l < 3; l++) {
|
||||
for (int k = 0; k < 3; k++) {
|
||||
addSlotToContainer(new SlotOutput(tile, 1 + k + l * 3, 98 + k * 18, 19 + l * 18));
|
||||
addSlotToContainer(new SlotOutput(tile, 1 + k + l * 3, 112 + k * 18, 19 + l * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack oldCraftPreview;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
IInventory craftPreviewInventory = tile.getCraftPreviewInventory();
|
||||
|
||||
ItemStack newCraftPreview = craftPreviewInventory.getStackInSlot(0);
|
||||
if (!ItemStack.areItemStacksEqual(oldCraftPreview, newCraftPreview)) {
|
||||
oldCraftPreview = newCraftPreview;
|
||||
|
||||
PacketItemStackDisplay packet = new PacketItemStackDisplay(tile, newCraftPreview);
|
||||
sendPacketToListeners(packet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class GuiCentrifuge extends GuiForestryTitled<ContainerCentrifuge, TileCe
|
||||
|
||||
public GuiCentrifuge(InventoryPlayer inventory, TileCentrifuge tile) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/centrifugesocket.png", new ContainerCentrifuge(inventory, tile), tile);
|
||||
widgetManager.add(new SocketWidget(this.widgetManager, 71, 37, tile, 0));
|
||||
widgetManager.add(new SocketWidget(this.widgetManager, 79, 37, tile, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,6 +29,7 @@ public class GuiCentrifuge extends GuiForestryTitled<ContainerCentrifuge, TileCe
|
||||
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
|
||||
|
||||
int progress = inventory.getProgressScaled(16);
|
||||
drawTexturedModalRect(guiLeft + 58, guiTop + 36 + 17 - progress, 176, 17 - progress, 4, progress);
|
||||
drawTexturedModalRect(guiLeft + 43, guiTop + 36 + 17 - progress, 176, 17 - progress, 4, progress);
|
||||
drawTexturedModalRect(guiLeft + 67, guiTop + 36 + 17 - progress, 176, 17 - progress, 4, progress);
|
||||
}
|
||||
}
|
||||
@@ -10,15 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISqueezerContainerRecipe {
|
||||
ItemStack getEmptyContainer();
|
||||
|
||||
int getProcessingTime();
|
||||
|
||||
@Nullable
|
||||
ItemStack getRemnants();
|
||||
|
||||
float getRemnantsChance();
|
||||
|
||||
@@ -10,22 +10,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
public class SqueezerContainerRecipe implements ISqueezerContainerRecipe {
|
||||
|
||||
private final ItemStack emptyContainer;
|
||||
private final int processingTime;
|
||||
@Nullable
|
||||
private final ItemStack remnants;
|
||||
private final float remnantsChance;
|
||||
|
||||
public SqueezerContainerRecipe(ItemStack emptyContainer, int processingTime, ItemStack remnants, float remnantsChance) {
|
||||
public SqueezerContainerRecipe(ItemStack emptyContainer, int processingTime, @Nullable ItemStack remnants, float remnantsChance) {
|
||||
this.emptyContainer = emptyContainer;
|
||||
this.processingTime = processingTime;
|
||||
this.remnants = remnants;
|
||||
@@ -42,6 +43,7 @@ public class SqueezerContainerRecipe implements ISqueezerContainerRecipe {
|
||||
return processingTime;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getRemnants() {
|
||||
return remnants;
|
||||
|
||||
@@ -2,7 +2,7 @@ package forestry.factory.recipes.jei;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.gui.GuiForestry;
|
||||
@@ -53,14 +53,17 @@ import mezz.jei.api.IJeiHelpers;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
import mezz.jei.api.gui.IAdvancedGuiHandler;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@JEIPlugin
|
||||
public class FactoryJeiPlugin extends BlankModPlugin {
|
||||
public static IJeiHelpers jeiHelpers;
|
||||
|
||||
@Override
|
||||
public void register(@Nonnull IModRegistry registry) {
|
||||
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
|
||||
jeiHelpers = registry.getJeiHelpers();
|
||||
IGuiHelper guiHelper = jeiHelpers.getGuiHelper();
|
||||
|
||||
registry.addRecipeCategories(
|
||||
@@ -101,7 +104,8 @@ public class FactoryJeiPlugin extends BlankModPlugin {
|
||||
|
||||
registry.addRecipeClickArea(GuiBottler.class, 80, 37, 26, 22, ForestryRecipeCategoryUid.BOTTLER);
|
||||
registry.addRecipeClickArea(GuiCarpenter.class, 98, 48, 21, 26, ForestryRecipeCategoryUid.CARPENTER);
|
||||
registry.addRecipeClickArea(GuiCentrifuge.class, 52, 22, 16, 48, ForestryRecipeCategoryUid.CENTRIFUGE);
|
||||
registry.addRecipeClickArea(GuiCentrifuge.class, 38, 22, 38, 14, ForestryRecipeCategoryUid.CENTRIFUGE);
|
||||
registry.addRecipeClickArea(GuiCentrifuge.class, 38, 54, 38, 14, ForestryRecipeCategoryUid.CENTRIFUGE);
|
||||
registry.addRecipeClickArea(GuiFabricator.class, 121, 53, 18, 18, ForestryRecipeCategoryUid.FABRICATOR);
|
||||
registry.addRecipeClickArea(GuiFermenter.class, 72, 40, 32, 18, ForestryRecipeCategoryUid.FERMENTER);
|
||||
registry.addRecipeClickArea(GuiMoistener.class, 123, 35, 19, 21, ForestryRecipeCategoryUid.MOISTENER);
|
||||
@@ -119,6 +123,7 @@ public class FactoryJeiPlugin extends BlankModPlugin {
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(blocks.rainmaker), ForestryRecipeCategoryUid.RAINMAKER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(blocks.squeezer), ForestryRecipeCategoryUid.SQUEEZER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(blocks.still), ForestryRecipeCategoryUid.STILL);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(blocks.worktable), VanillaRecipeCategoryUid.CRAFTING);
|
||||
|
||||
IRecipeTransferRegistry transferRegistry = registry.getRecipeTransferRegistry();
|
||||
transferRegistry.addRecipeTransferHandler(new WorktableRecipeTransferHandler());
|
||||
|
||||
@@ -2,13 +2,9 @@ package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
@@ -16,9 +12,11 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class BottlerRecipeCategory extends ForestryRecipeCategory {
|
||||
public class BottlerRecipeCategory extends ForestryRecipeCategory<BottlerRecipeWrapper> {
|
||||
|
||||
private static final int emptySlot = 0;
|
||||
private static final int outputSlot = 1;
|
||||
@@ -50,7 +48,7 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull BottlerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
@@ -58,11 +56,9 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory {
|
||||
guiItemStacks.init(outputSlot, false, 63, 38);
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
guiItemStacks.setFromRecipe(emptySlot, recipeWrapper.getInputs());
|
||||
guiItemStacks.setFromRecipe(outputSlot, recipeWrapper.getOutputs());
|
||||
|
||||
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
|
||||
|
||||
guiItemStacks.set(ingredients);
|
||||
guiFluidStacks.set(ingredients);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,12 @@ package forestry.factory.recipes.jei.bottler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class BottlerRecipeWrapper extends ForestryRecipeWrapper<BottlerRecipe> {
|
||||
|
||||
@@ -17,22 +15,13 @@ public class BottlerRecipeWrapper extends ForestryRecipeWrapper<BottlerRecipe> {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(getRecipe().input);
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
BottlerRecipe recipe = getRecipe();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return Collections.singletonList(getRecipe().empty);
|
||||
}
|
||||
ingredients.setInputs(ItemStack.class, Collections.singletonList(recipe.empty));
|
||||
ingredients.setInputs(FluidStack.class, Collections.singletonList(recipe.input));
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(getRecipe().filled);
|
||||
ingredients.setOutput(ItemStack.class, recipe.filled);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,15 @@
|
||||
package forestry.factory.recipes.jei.carpenter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import forestry.factory.recipes.jei.FactoryJeiPlugin;
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
@@ -20,9 +18,14 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IStackHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class CarpenterRecipeCategory extends ForestryRecipeCategory {
|
||||
public class CarpenterRecipeCategory extends ForestryRecipeCategory<CarpenterRecipeWrapper> {
|
||||
|
||||
private static final int boxSlot = 0;
|
||||
private static final int craftOutputSlot = 1;
|
||||
@@ -59,7 +62,7 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CarpenterRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
@@ -75,17 +78,27 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 141, 1, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
CarpenterRecipeWrapper wrapper = (CarpenterRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(boxSlot, wrapper.getRecipe().getBox());
|
||||
|
||||
craftingGridHelper.setOutput(guiItemStacks, wrapper.getOutputs());
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
Collections.addAll(inputs, wrapper.getRecipe().getCraftingGridRecipe().getIngredients());
|
||||
craftingGridHelper.setInput(guiItemStacks, inputs, wrapper.getRecipe().getCraftingGridRecipe().getWidth(), wrapper.getRecipe().getCraftingGridRecipe().getHeight());
|
||||
|
||||
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
|
||||
|
||||
|
||||
ICarpenterRecipe recipe = recipeWrapper.getRecipe();
|
||||
ItemStack box = recipe.getBox();
|
||||
if (box != null) {
|
||||
guiItemStacks.set(boxSlot, box);
|
||||
}
|
||||
|
||||
List<ItemStack> outputs = ingredients.getOutputs(ItemStack.class);
|
||||
craftingGridHelper.setOutput(guiItemStacks, outputs);
|
||||
|
||||
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
|
||||
|
||||
List<Object> inputs = Arrays.asList(craftingGridRecipe.getIngredients());
|
||||
IStackHelper stackHelper = FactoryJeiPlugin.jeiHelpers.getStackHelper();
|
||||
List<List<ItemStack>> craftInputs = stackHelper.expandRecipeItemStackInputs(inputs);
|
||||
craftingGridHelper.setInputStacks(guiItemStacks, craftInputs, craftingGridRecipe.getWidth(), craftingGridRecipe.getHeight());
|
||||
|
||||
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
|
||||
if (!fluidInputs.isEmpty()) {
|
||||
guiFluidStacks.set(inputTank, fluidInputs.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
package forestry.factory.recipes.jei.carpenter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.ICarpenterRecipe;
|
||||
import forestry.api.recipes.IDescriptiveRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.jei.FactoryJeiPlugin;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IStackHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterRecipe> {
|
||||
|
||||
@@ -18,25 +20,26 @@ public class CarpenterRecipeWrapper extends ForestryRecipeWrapper<ICarpenterReci
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
Collections.addAll(inputs, getRecipe().getCraftingGridRecipe().getIngredients());
|
||||
inputs.add(getRecipe().getBox());
|
||||
return inputs;
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ICarpenterRecipe recipe = getRecipe();
|
||||
IDescriptiveRecipe craftingGridRecipe = recipe.getCraftingGridRecipe();
|
||||
Object[] inputs = craftingGridRecipe.getIngredients();
|
||||
IStackHelper stackHelper = FactoryJeiPlugin.jeiHelpers.getStackHelper();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(getRecipe().getFluidResource());
|
||||
}
|
||||
List<List<ItemStack>> inputStacks = stackHelper.expandRecipeItemStackInputs(Arrays.asList(inputs));
|
||||
ItemStack box = recipe.getBox();
|
||||
if (box != null) {
|
||||
inputStacks.add(Collections.singletonList(box));
|
||||
}
|
||||
ingredients.setInputLists(ItemStack.class, inputStacks);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return Collections.singletonList(getRecipe().getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
FluidStack fluidResource = recipe.getFluidResource();
|
||||
if (fluidResource != null) {
|
||||
ingredients.setInputs(FluidStack.class, Collections.singletonList(fluidResource));
|
||||
}
|
||||
|
||||
ItemStack recipeOutput = craftingGridRecipe.getRecipeOutput();
|
||||
ingredients.setOutput(ItemStack.class, recipeOutput);
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -2,29 +2,28 @@ package forestry.factory.recipes.jei.centrifuge;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.PriorityQueue;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.recipes.jei.ForestryTooltipCallback;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
public class CentrifugeRecipeCategory extends ForestryRecipeCategory<CentrifugeRecipeWrapper> {
|
||||
|
||||
private static final int[][] OUTPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
|
||||
|
||||
@@ -43,7 +42,7 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawableAnimated arrow;
|
||||
|
||||
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 25, 18, 126, 54), "tile.for.centrifuge.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 11, 18, 154, 54), "tile.for.centrifuge.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 0, 4, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
@@ -57,18 +56,21 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
@Override
|
||||
public void drawAnimations(@Nonnull Minecraft minecraft) {
|
||||
arrow.draw(minecraft, 33, 18);
|
||||
arrow.draw(minecraft, 32, 18);
|
||||
arrow.draw(minecraft, 56, 18);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull CentrifugeRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
|
||||
guiItemStacks.init(inputSlot, true, 4, 18);
|
||||
guiItemStacks.setFromRecipe(inputSlot, recipeWrapper.getInputs());
|
||||
CentrifugeRecipeWrapper centrifugeWrapper = (CentrifugeRecipeWrapper) recipeWrapper;
|
||||
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
|
||||
guiItemStacks.set(inputSlot, inputs.get(0));
|
||||
|
||||
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
setResults(tooltip, centrifugeWrapper.getRecipe().getAllProducts(), guiItemStacks);
|
||||
Map<ItemStack, Float> products = recipeWrapper.getRecipe().getAllProducts();
|
||||
setResults(tooltip, products, guiItemStacks);
|
||||
guiItemStacks.addTooltipCallback(tooltip);
|
||||
}
|
||||
|
||||
@@ -86,7 +88,7 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
if (i >= OUTPUTS.length) {
|
||||
return;
|
||||
}
|
||||
int x = 72 + OUTPUTS[i][0] * 18;
|
||||
int x = 100 + OUTPUTS[i][0] * 18;
|
||||
int y = OUTPUTS[i][1] * 18;
|
||||
int slotIndex = outputSlot + i;
|
||||
guiItemStacks.init(slotIndex, false, x, y);
|
||||
|
||||
+10
-10
@@ -1,11 +1,14 @@
|
||||
package forestry.factory.recipes.jei.centrifuge;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CentrifugeRecipeWrapper extends ForestryRecipeWrapper<ICentrifugeRecipe> {
|
||||
|
||||
@@ -13,16 +16,13 @@ public class CentrifugeRecipeWrapper extends ForestryRecipeWrapper<ICentrifugeRe
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs() {
|
||||
return Collections.singletonList(getRecipe().getInput());
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ICentrifugeRecipe recipe = getRecipe();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getOutputs() {
|
||||
return Collections.singletonList(getRecipe().getAllProducts().keySet());
|
||||
}
|
||||
ingredients.setInputs(ItemStack.class, Collections.singletonList(recipe.getInput()));
|
||||
|
||||
Set<ItemStack> outputs = recipe.getAllProducts().keySet();
|
||||
ingredients.setOutputs(ItemStack.class, new ArrayList<>(outputs));
|
||||
}
|
||||
}
|
||||
+29
-23
@@ -2,30 +2,28 @@ package forestry.factory.recipes.jei.fabricator;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.api.recipes.IFabricatorSmeltingRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.render.ForestryResource;
|
||||
import forestry.factory.recipes.FabricatorSmeltingRecipeManager;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.ICraftingGridHelper;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FabricatorRecipeCategory extends ForestryRecipeCategory {
|
||||
public class FabricatorRecipeCategory extends ForestryRecipeCategory<FabricatorRecipeWrapper> {
|
||||
|
||||
private static final int planSlot = 0;
|
||||
private static final int smeltingInputSlot = 1;
|
||||
@@ -51,7 +49,7 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FabricatorRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
@@ -69,25 +67,33 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 6, 32, 16, 16, 2000, false, null);
|
||||
|
||||
FabricatorRecipeWrapper wrapper = (FabricatorRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(planSlot, wrapper.getRecipe().getPlan());
|
||||
|
||||
|
||||
IFabricatorRecipe recipe = recipeWrapper.getRecipe();
|
||||
|
||||
ItemStack plan = recipe.getPlan();
|
||||
if (plan != null) {
|
||||
guiItemStacks.set(planSlot, plan);
|
||||
}
|
||||
|
||||
List<ItemStack> smeltingInput = new ArrayList<>();
|
||||
for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(wrapper.getRecipe().getLiquid().getFluid())) {
|
||||
Fluid recipeFluid = recipe.getLiquid().getFluid();
|
||||
for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(recipeFluid)) {
|
||||
smeltingInput.add(s.getResource());
|
||||
}
|
||||
if (!smeltingInput.isEmpty()) {
|
||||
guiItemStacks.set(smeltingInputSlot, smeltingInput);
|
||||
}
|
||||
|
||||
craftingGridHelper.setOutput(guiItemStacks, wrapper.getOutputs());
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
Collections.addAll(inputs, wrapper.getRecipe().getIngredients());
|
||||
craftingGridHelper.setInput(guiItemStacks, inputs, wrapper.getRecipe().getWidth(), wrapper.getRecipe().getHeight());
|
||||
|
||||
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
|
||||
|
||||
|
||||
List<ItemStack> itemOutputs = ingredients.getOutputs(ItemStack.class);
|
||||
craftingGridHelper.setOutput(guiItemStacks, itemOutputs);
|
||||
|
||||
List<List<ItemStack>> itemStackInputs = ingredients.getInputs(ItemStack.class);
|
||||
craftingGridHelper.setInputStacks(guiItemStacks, itemStackInputs, recipe.getWidth(), recipe.getHeight());
|
||||
|
||||
List<List<FluidStack>> fluidInputs = ingredients.getInputs(FluidStack.class);
|
||||
if (!fluidInputs.isEmpty()) {
|
||||
guiFluidStacks.set(inputTank, fluidInputs.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<Fluid, List<IFabricatorSmeltingRecipe>> getSmeltingInputs() {
|
||||
|
||||
+15
-22
@@ -1,16 +1,17 @@
|
||||
package forestry.factory.recipes.jei.fabricator;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFabricatorRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import forestry.factory.recipes.jei.FactoryJeiPlugin;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IStackHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FabricatorRecipeWrapper extends ForestryRecipeWrapper<IFabricatorRecipe> {
|
||||
|
||||
@@ -18,25 +19,17 @@ public class FabricatorRecipeWrapper extends ForestryRecipeWrapper<IFabricatorRe
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<Object> inputs = new ArrayList<>();
|
||||
Collections.addAll(inputs, getRecipe().getIngredients());
|
||||
inputs.add(getRecipe().getPlan());
|
||||
return inputs;
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
IFabricatorRecipe recipe = getRecipe();
|
||||
IStackHelper stackHelper = FactoryJeiPlugin.jeiHelpers.getStackHelper();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(getRecipe().getLiquid());
|
||||
}
|
||||
Object[] itemInputs = recipe.getIngredients();
|
||||
List<List<ItemStack>> itemStackInputs = stackHelper.expandRecipeItemStackInputs(Arrays.asList(itemInputs));
|
||||
ingredients.setInputLists(ItemStack.class, itemStackInputs);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return Collections.singletonList(getRecipe().getRecipeOutput());
|
||||
}
|
||||
ingredients.setInputs(FluidStack.class, Collections.singletonList(getRecipe().getLiquid()));
|
||||
|
||||
ingredients.setOutput(ItemStack.class, recipe.getRecipeOutput());
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,10 @@
|
||||
package forestry.factory.recipes.jei.fermenter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
@@ -21,6 +12,9 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRecipeWrapper> {
|
||||
|
||||
@@ -61,7 +55,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRec
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermenterRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermenterRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
@@ -70,16 +64,9 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRec
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 3000, false, tankOverlay);
|
||||
guiFluidStacks.init(outputTank, false, 91, 1, 16, 58, 3000, false, tankOverlay);
|
||||
|
||||
guiItemStacks.set(resourceSlot, recipeWrapper.getFermentable());
|
||||
List<ItemStack> fuels = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
fuels.add(fuel.getItem());
|
||||
}
|
||||
guiItemStacks.set(fuelSlot, fuels);
|
||||
|
||||
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
|
||||
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
|
||||
|
||||
guiItemStacks.set(ingredients);
|
||||
guiFluidStacks.set(ingredients);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,18 +2,18 @@ package forestry.factory.recipes.jei.fermenter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterRecipe> {
|
||||
|
||||
@@ -25,39 +25,32 @@ public class FermenterRecipeWrapper extends ForestryRecipeWrapper<IFermenterReci
|
||||
this.fermentable = fermentable;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
List<ItemStack> fuelInputs = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
inputs.add(fuel.getItem());
|
||||
fuelInputs.add(fuel.getItem());
|
||||
}
|
||||
inputs.add(fermentable);
|
||||
return inputs;
|
||||
|
||||
ingredients.setInputLists(ItemStack.class, Arrays.asList(
|
||||
Collections.singletonList(fermentable),
|
||||
fuelInputs
|
||||
));
|
||||
|
||||
FluidStack fluidInput = getRecipe().getFluidResource().copy();
|
||||
fluidInput.amount = getRecipe().getFermentationValue();
|
||||
ingredients.setInput(FluidStack.class, fluidInput);
|
||||
|
||||
int amount = Math.round(getRecipe().getFermentationValue() * getRecipe().getModifier());
|
||||
if (fermentable.getItem() instanceof IVariableFermentable) {
|
||||
amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
|
||||
}
|
||||
FluidStack fluidOutput = new FluidStack(getRecipe().getOutput(), amount);
|
||||
ingredients.setOutput(FluidStack.class, fluidOutput);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getFermentable() {
|
||||
return fermentable;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
FluidStack input = getRecipe().getFluidResource().copy();
|
||||
input.amount = getRecipe().getFermentationValue();
|
||||
return Collections.singletonList(input);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
int amount = Math.round(getRecipe().getFermentationValue() * getRecipe().getModifier());
|
||||
if (fermentable.getItem() instanceof IVariableFermentable) {
|
||||
amount *= ((IVariableFermentable) fermentable.getItem()).getFermentationModifier(fermentable);
|
||||
}
|
||||
FluidStack output = new FluidStack(getRecipe().getOutput(), amount);
|
||||
return Collections.singletonList(output);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,15 +2,9 @@ package forestry.factory.recipes.jei.moistener;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
@@ -18,9 +12,11 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
public class MoistenerRecipeCategory extends ForestryRecipeCategory<MoistenerRecipeWrapper> {
|
||||
|
||||
private static final int resourceSlot = 0;
|
||||
private static final int productSlot = 1;
|
||||
@@ -60,7 +56,7 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull MoistenerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
@@ -71,16 +67,9 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
guiItemStacks.init(fuelProductSlot, false, 89, 21);
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
MoistenerRecipeWrapper wrapper = (MoistenerRecipeWrapper) recipeWrapper;
|
||||
guiItemStacks.set(resourceSlot, wrapper.getRecipe().getResource());
|
||||
guiItemStacks.set(fuelItemSlot, wrapper.getFuel().getItem());
|
||||
|
||||
guiItemStacks.set(productSlot, wrapper.getRecipe().getProduct());
|
||||
guiItemStacks.set(fuelProductSlot, wrapper.getFuel().getProduct());
|
||||
|
||||
guiFluidStacks.set(inputTank, FluidRegistry.getFluidStack("water", 10000));
|
||||
|
||||
|
||||
guiItemStacks.set(ingredients);
|
||||
guiFluidStacks.set(ingredients);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,11 +4,13 @@ import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.recipes.IMoistenerRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerRecipe> {
|
||||
|
||||
@@ -20,26 +22,27 @@ public class MoistenerRecipeWrapper extends ForestryRecipeWrapper<IMoistenerReci
|
||||
this.fuel = fuel;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
inputs.add(getRecipe().getResource());
|
||||
if (fuel.getItem() != null) {
|
||||
inputs.add(fuel.getItem());
|
||||
}
|
||||
return inputs;
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
IMoistenerRecipe recipe = getRecipe();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
List<ItemStack> outputs = new ArrayList<>();
|
||||
outputs.add(getRecipe().getProduct());
|
||||
if (fuel.getProduct() != null) {
|
||||
outputs.add(fuel.getProduct());
|
||||
List<ItemStack> itemStackInputs = new ArrayList<>();
|
||||
itemStackInputs.add(recipe.getResource());
|
||||
ItemStack fuelItem = fuel.getItem();
|
||||
if (fuelItem != null) {
|
||||
itemStackInputs.add(fuelItem);
|
||||
}
|
||||
return outputs;
|
||||
ingredients.setInputs(ItemStack.class, itemStackInputs);
|
||||
|
||||
List<ItemStack> itemStackOutputs = new ArrayList<>();
|
||||
itemStackOutputs.add(recipe.getProduct());
|
||||
ItemStack fuelProduct = fuel.getProduct();
|
||||
if (fuelProduct != null) {
|
||||
itemStackOutputs.add(fuelProduct);
|
||||
}
|
||||
ingredients.setOutputs(ItemStack.class, itemStackOutputs);
|
||||
|
||||
ingredients.setInput(FluidStack.class, new FluidStack(FluidRegistry.WATER, recipe.getTimePerItem() / 4));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
package forestry.factory.recipes.jei.rainmaker;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class RainmakerRecipeCategory extends ForestryRecipeCategory {
|
||||
public class RainmakerRecipeCategory extends ForestryRecipeCategory<RainmakerRecipeWrapper> {
|
||||
private static final int SLOT_INPUT_INDEX = 0;
|
||||
private final IDrawable slot;
|
||||
|
||||
@@ -37,13 +33,9 @@ public class RainmakerRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull RainmakerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
guiItemStacks.init(SLOT_INPUT_INDEX, true, 0, 0);
|
||||
if (recipeWrapper instanceof RainmakerRecipeWrapper) {
|
||||
RainmakerRecipeWrapper rainmakerRecipeWrapper = (RainmakerRecipeWrapper) recipeWrapper;
|
||||
List<ItemStack> input = rainmakerRecipeWrapper.getInputs().get(SLOT_INPUT_INDEX);
|
||||
guiItemStacks.set(SLOT_INPUT_INDEX, input);
|
||||
}
|
||||
guiItemStacks.set(ingredients);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ public class RainmakerRecipeHandler implements IRecipeHandler<RainmakerRecipeWra
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull RainmakerRecipeWrapper wrapper) {
|
||||
return !wrapper.getInputs().isEmpty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,13 @@ package forestry.factory.recipes.jei.rainmaker;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RainmakerRecipeWrapper extends BlankRecipeWrapper {
|
||||
@Nonnull
|
||||
@@ -21,10 +19,9 @@ public class RainmakerRecipeWrapper extends BlankRecipeWrapper {
|
||||
this.substrate = substrate;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<List<ItemStack>> getInputs() {
|
||||
return Collections.singletonList(Collections.singletonList(substrate.getItem()));
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, Collections.singletonList(substrate.getItem()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-17
@@ -1,11 +1,6 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
|
||||
@@ -14,18 +9,6 @@ public abstract class AbstractSqueezerRecipeWrapper<R> extends ForestryRecipeWra
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public abstract List<ItemStack> getInputs();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public abstract List<FluidStack> getFluidOutputs();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public abstract List<ItemStack> getOutputs();
|
||||
|
||||
/**
|
||||
* @return Chance remnants will be produced by a single recipe cycle, from 0 to 1.
|
||||
*/
|
||||
|
||||
+14
-19
@@ -2,14 +2,12 @@ package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
public class SqueezerContainerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueezerContainerRecipe> {
|
||||
|
||||
@@ -21,22 +19,19 @@ public class SqueezerContainerRecipeWrapper extends AbstractSqueezerRecipeWrappe
|
||||
this.filledContainer = filledContainer;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return Collections.singletonList(filledContainer);
|
||||
}
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputs(ItemStack.class, Collections.singletonList(filledContainer));
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return Collections.singletonList(FluidContainerRegistry.getFluidForFilledItem(filledContainer));
|
||||
}
|
||||
ItemStack remnants = getRecipe().getRemnants();
|
||||
if (remnants != null) {
|
||||
ingredients.setOutput(ItemStack.class, remnants);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return Collections.singletonList(getRecipe().getRemnants());
|
||||
FluidStack fluidContained = FluidUtil.getFluidContained(filledContainer);
|
||||
if (fluidContained != null) {
|
||||
ingredients.setOutput(FluidStack.class, fluidContained);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.recipes.jei.ForestryTooltipCallback;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
@@ -19,9 +13,11 @@ import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
public class SqueezerRecipeCategory extends ForestryRecipeCategory<AbstractSqueezerRecipeWrapper> {
|
||||
|
||||
private static final int[][] INPUTS = new int[][]{{0, 0}, {1, 0}, {2, 0}, {0, 1}, {1, 1}, {2, 1}, {0, 2}, {1, 2}, {2, 2}};
|
||||
|
||||
@@ -56,33 +52,22 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull AbstractSqueezerRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
AbstractSqueezerRecipeWrapper<?> wrapper = (AbstractSqueezerRecipeWrapper) recipeWrapper;
|
||||
|
||||
float chance = wrapper.getRemnantsChance();
|
||||
|
||||
guiFluidStacks.init(outputTank, false, 113, 2, 16, 58, 10000, false, tankOverlay);
|
||||
guiFluidStacks.set(outputTank, wrapper.getFluidOutputs());
|
||||
|
||||
guiItemStacks.init(craftOutputSlot, false, 87, 43);
|
||||
guiItemStacks.set(craftOutputSlot, wrapper.getOutputs());
|
||||
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
tooltip.addChanceTooltip(craftOutputSlot, chance);
|
||||
setIngredients(guiItemStacks, wrapper.getInputs());
|
||||
|
||||
guiItemStacks.addTooltipCallback(tooltip);
|
||||
}
|
||||
|
||||
private static void setIngredients(@Nonnull IGuiItemStackGroup guiItemStacks, @Nonnull List<ItemStack> inputs) {
|
||||
int i = 0;
|
||||
for (ItemStack stack : inputs) {
|
||||
for (int i = 0; i < INPUTS.length; i++) {
|
||||
guiItemStacks.init(craftInputSlot + i, true, 7 + INPUTS[i][0] * 18, 4 + INPUTS[i][1] * 18);
|
||||
guiItemStacks.set(craftInputSlot + i, stack);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
guiItemStacks.init(craftOutputSlot, false, 87, 43);
|
||||
guiFluidStacks.init(outputTank, false, 113, 2, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
float chance = recipeWrapper.getRemnantsChance();
|
||||
tooltip.addChanceTooltip(craftOutputSlot, chance);
|
||||
guiItemStacks.addTooltipCallback(tooltip);
|
||||
|
||||
guiItemStacks.set(ingredients);
|
||||
guiFluidStacks.set(ingredients);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import mezz.jei.api.recipe.IRecipeHandler;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements IRecipeHandler<R> {
|
||||
public class SqueezerRecipeHandler<R extends AbstractSqueezerRecipeWrapper> implements IRecipeHandler<R> {
|
||||
|
||||
@Nonnull
|
||||
private final Class<R> recipeClass;
|
||||
@@ -42,12 +42,6 @@ public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements I
|
||||
|
||||
@Override
|
||||
public boolean isRecipeValid(@Nonnull R wrapper) {
|
||||
if (wrapper.getFluidOutputs() == null || wrapper.getFluidOutputs().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (wrapper.getInputs() == null || wrapper.getInputs().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,30 @@
|
||||
package forestry.factory.recipes.jei.squeezer;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import java.util.Arrays;
|
||||
|
||||
import forestry.api.recipes.ISqueezerRecipe;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class SqueezerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueezerRecipe> {
|
||||
|
||||
public SqueezerRecipeWrapper(@Nonnull ISqueezerRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
List<ItemStack> inputs = new ArrayList<>();
|
||||
Collections.addAll(inputs, getRecipe().getResources());
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return Collections.singletonList(getRecipe().getFluidOutput());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ItemStack[] resources = getRecipe().getResources();
|
||||
ingredients.setInputs(ItemStack.class, Arrays.asList(resources));
|
||||
|
||||
ItemStack remnants = getRecipe().getRemnants();
|
||||
return remnants == null ? Collections.emptyList() : Collections.singletonList(remnants);
|
||||
if (remnants != null) {
|
||||
ingredients.setOutput(ItemStack.class, remnants);
|
||||
}
|
||||
|
||||
ingredients.setOutput(FluidStack.class, getRecipe().getFluidOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,20 +2,19 @@ package forestry.factory.recipes.jei.still;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategory;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
import mezz.jei.api.IGuiHelper;
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.gui.IDrawableAnimated;
|
||||
import mezz.jei.api.gui.IDrawableStatic;
|
||||
import mezz.jei.api.gui.IGuiFluidStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class StillRecipeCategory extends ForestryRecipeCategory {
|
||||
|
||||
@@ -49,14 +48,13 @@ public class StillRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper, @Nonnull IIngredients ingredients) {
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 10000, false, tankOverlay);
|
||||
guiFluidStacks.init(outputTank, false, 91, 1, 16, 58, 10000, false, tankOverlay);
|
||||
|
||||
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
|
||||
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
|
||||
|
||||
guiFluidStacks.set(ingredients);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,11 @@ package forestry.factory.recipes.jei.still;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IStillRecipe;
|
||||
import forestry.core.recipes.jei.ForestryRecipeWrapper;
|
||||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class StillRecipeWrapper extends ForestryRecipeWrapper<IStillRecipe> {
|
||||
|
||||
@@ -15,16 +14,9 @@ public class StillRecipeWrapper extends ForestryRecipeWrapper<IStillRecipe> {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return Collections.singletonList(getRecipe().getInput());
|
||||
public void getIngredients(@Nonnull IIngredients ingredients) {
|
||||
ingredients.setInputs(FluidStack.class, Collections.singletonList(getRecipe().getInput()));
|
||||
ingredients.setOutput(FluidStack.class, getRecipe().getOutput());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<FluidStack> getFluidOutputs() {
|
||||
return Collections.singletonList(getRecipe().getOutput());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
|
||||
private final FilteredTank resourceTank;
|
||||
private final TankManager tankManager;
|
||||
private final InventoryAdapterTile craftingInventory;
|
||||
private final InventoryAdapterTile craftingInventory;
|
||||
private final InventoryCraftResult craftPreviewInventory;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -16,11 +16,12 @@ import java.util.Collection;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitBoard;
|
||||
@@ -34,6 +35,7 @@ import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.tiles.IItemStackDisplay;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.factory.gui.ContainerCentrifuge;
|
||||
@@ -41,12 +43,13 @@ import forestry.factory.gui.GuiCentrifuge;
|
||||
import forestry.factory.inventory.InventoryCentrifuge;
|
||||
import forestry.factory.recipes.CentrifugeRecipeManager;
|
||||
|
||||
public class TileCentrifuge extends TilePowered implements ISocketable, ISidedInventory {
|
||||
public class TileCentrifuge extends TilePowered implements ISocketable, ISidedInventory, IItemStackDisplay {
|
||||
private static final int TICKS_PER_RECIPE_TIME = 1;
|
||||
private static final int ENERGY_PER_WORK_CYCLE = 3200;
|
||||
private static final int ENERGY_PER_RECIPE_TIME = ENERGY_PER_WORK_CYCLE / 20;
|
||||
|
||||
private final InventoryAdapter sockets = new InventoryAdapter(1, "sockets");
|
||||
private final InventoryCraftResult craftPreviewInventory;
|
||||
|
||||
private ICentrifugeRecipe currentRecipe;
|
||||
|
||||
@@ -55,6 +58,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
public TileCentrifuge() {
|
||||
super("centrifuge", 800, Constants.MACHINE_MAX_ENERGY);
|
||||
setInternalInventory(new InventoryCentrifuge(this));
|
||||
craftPreviewInventory = new InventoryCraftResult();
|
||||
}
|
||||
|
||||
/* LOADING & SAVING */
|
||||
@@ -113,13 +117,13 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
|
||||
@Override
|
||||
public boolean workCycle() {
|
||||
|
||||
// If we add pending products, we skip to the next work cycle.
|
||||
if (tryAddPending()) {
|
||||
return false;
|
||||
setCurrentPreviewItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!pendingProducts.isEmpty()) {
|
||||
setCurrentPreviewItem();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -132,8 +136,8 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
pendingProducts.addAll(products);
|
||||
|
||||
getInternalInventory().decrStackSize(InventoryCentrifuge.SLOT_RESOURCE, 1);
|
||||
|
||||
tryAddPending();
|
||||
|
||||
setCurrentPreviewItem();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -180,6 +184,9 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
|
||||
@Override
|
||||
public boolean hasWork() {
|
||||
if(!pendingProducts.isEmpty()){
|
||||
return true;
|
||||
}
|
||||
checkRecipe();
|
||||
|
||||
boolean hasResource = getStackInSlot(InventoryCentrifuge.SLOT_RESOURCE) != null;
|
||||
@@ -254,4 +261,21 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerCentrifuge(player.inventory, this);
|
||||
}
|
||||
|
||||
public IInventory getCraftPreviewInventory() {
|
||||
return craftPreviewInventory;
|
||||
}
|
||||
|
||||
private void setCurrentPreviewItem(){
|
||||
if(!pendingProducts.isEmpty()){
|
||||
craftPreviewInventory.setInventorySlotContents(0, pendingProducts.peek());
|
||||
}else{
|
||||
craftPreviewInventory.setInventorySlotContents(0, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItemStackForDisplay(ItemStack itemStack) {
|
||||
craftPreviewInventory.setInventorySlotContents(0, itemStack);
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import forestry.factory.recipes.MemorizedRecipe;
|
||||
import forestry.factory.recipes.RecipeMemory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryBasic;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -118,39 +119,47 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
}
|
||||
|
||||
private boolean canCraftCurrentRecipe() {
|
||||
if (currentRecipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack[] recipeItems = InventoryUtil.getStacks(currentRecipe.getCraftMatrix());
|
||||
ItemStack[] inventory = InventoryUtil.getStacks(this);
|
||||
InventoryCraftingForestry crafting = RecipeUtil.getCraftRecipe(recipeItems, inventory, worldObj, currentRecipe.getRecipeOutput());
|
||||
return crafting != null;
|
||||
return craftRecipe(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCraftingStart(EntityPlayer player) {
|
||||
return craftRecipe(false);
|
||||
}
|
||||
|
||||
private boolean craftRecipe(boolean simulate) {
|
||||
if (currentRecipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack[] recipeItems = InventoryUtil.getStacks(currentRecipe.getCraftMatrix());
|
||||
ItemStack[] inventory = InventoryUtil.getStacks(this);
|
||||
InventoryCraftingForestry crafting = RecipeUtil.getCraftRecipe(recipeItems, inventory, worldObj, currentRecipe.getRecipeOutput());
|
||||
ItemStack[] inventoryStacks = InventoryUtil.getStacks(this);
|
||||
InventoryCraftingForestry crafting = RecipeUtil.getCraftRecipe(recipeItems, inventoryStacks, worldObj, currentRecipe.getRecipeOutput());
|
||||
if (crafting == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
recipeItems = InventoryUtil.getStacks(crafting);
|
||||
|
||||
IInventory inventory;
|
||||
if (simulate) {
|
||||
inventory = new InventoryBasic("copy", false, this.getSizeInventory());
|
||||
InventoryUtil.deepCopyInventoryContents(this, inventory);
|
||||
} else {
|
||||
inventory = this;
|
||||
}
|
||||
|
||||
// craft recipe should exactly match ingredients here, so no oreDict or tool matching
|
||||
ItemStack[] removed = InventoryUtil.removeSets(this, 1, recipeItems, player, false, false, false);
|
||||
ItemStack[] removed = InventoryUtil.removeSets(inventory, 1, recipeItems, null, false, false, false);
|
||||
if (removed == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// update crafting display to match the ingredients that were actually used
|
||||
setCraftingDisplay(crafting);
|
||||
if (!simulate) {
|
||||
// update crafting display to match the ingredients that were actually used
|
||||
setCraftingDisplay(crafting);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,18 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.tiles;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.multiblock.IFarmComponent;
|
||||
import forestry.core.inventory.AdjacentInventoryCache;
|
||||
import forestry.core.tiles.AdjacentTileCache;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.InvWrapper;
|
||||
import net.minecraftforge.items.wrapper.SidedInvWrapper;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
@@ -64,6 +67,20 @@ public class TileFarmHatch extends TileFarm implements ISidedInventory, IFarmCom
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(@Nonnull Capability<?> capability, @Nonnull EnumFacing facing) {
|
||||
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCapability(@Nonnull Capability<T> capability, @Nonnull EnumFacing facing) {
|
||||
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
|
||||
SidedInvWrapper sidedInvWrapper = new SidedInvWrapper(this, facing);
|
||||
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(sidedInvWrapper);
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
@@ -38,6 +38,7 @@ import net.minecraftforge.oredict.RecipeSorter;
|
||||
import forestry.Forestry;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.IAlleleButterflyCocoon;
|
||||
@@ -130,6 +131,8 @@ public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
MothDefinition.initMoths();
|
||||
ButterflyDefinition.initButterflies();
|
||||
AlleleButterflyCocoon.createLoot();
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(ButterflyManager.butterflyRoot));
|
||||
|
||||
blocks.butterflyChest.init();
|
||||
|
||||
|
||||
@@ -165,5 +165,10 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
return BOUNDING_BOX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return BOUNDING_BOX;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -57,192 +58,201 @@ public class FlutterlyzerPlugin implements IAlyzerPlugin {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage1(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), butterfly, EnumButterflyChromosome.SPECIES, null, null);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.size"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SIZE).getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.SIZE).getName(), butterfly, EnumButterflyChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.lifespan"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.LIFESPAN).getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.LIFESPAN).getName(), butterfly,
|
||||
EnumButterflyChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.speed"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SPEED).getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.SPEED).getName(), butterfly, EnumButterflyChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.metabolism"), GenericRatings.rateMetabolism(butterfly.getGenome().getMetabolism()),
|
||||
GenericRatings.rateMetabolism(((IAlleleInteger) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.METABOLISM)).getValue()), butterfly, EnumButterflyChromosome.METABOLISM);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawFertilityInfo(butterfly.getGenome().getFertility(), GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.FERTILITY)
|
||||
.isDominant()), 8);
|
||||
guiAlyzer.drawFertilityInfo(((IAlleleInteger) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY)).getValue(), GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(butterfly
|
||||
.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY).isDominant()), 8);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flowers"), butterfly.getGenome().getFlowerProvider().getDescription(),
|
||||
((IAlleleFlowers) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FLOWER_PROVIDER)).getProvider()
|
||||
.getDescription(), butterfly, EnumButterflyChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.effect"), butterfly.getGenome().getEffect().getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.EFFECT).getName(), butterfly,
|
||||
EnumButterflyChromosome.EFFECT);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawSpeciesRow(Translator.translateToLocal("for.gui.species"), butterfly, EnumButterflyChromosome.SPECIES, null, null);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.size"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SIZE).getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.SIZE).getName(), butterfly, EnumButterflyChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.lifespan"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.LIFESPAN).getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.LIFESPAN).getName(), butterfly,
|
||||
EnumButterflyChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.speed"), butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.SPEED).getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.SPEED).getName(), butterfly, EnumButterflyChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.metabolism"), GenericRatings.rateMetabolism(butterfly.getGenome().getMetabolism()),
|
||||
GenericRatings.rateMetabolism(((IAlleleInteger) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.METABOLISM)).getValue()), butterfly, EnumButterflyChromosome.METABOLISM);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.fertility"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawFertilityInfo(butterfly.getGenome().getFertility(), GuiAlyzer.COLUMN_1, gui.getColorCoding(butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.FERTILITY)
|
||||
.isDominant()), 8);
|
||||
gui.drawFertilityInfo(((IAlleleInteger) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY)).getValue(), GuiAlyzer.COLUMN_2, gui.getColorCoding(butterfly
|
||||
.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY).isDominant()), 8);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.flowers"), butterfly.getGenome().getFlowerProvider().getDescription(),
|
||||
((IAlleleFlowers) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FLOWER_PROVIDER)).getProvider()
|
||||
.getDescription(), butterfly, EnumButterflyChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.effect"), butterfly.getGenome().getEffect().getName(),
|
||||
butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.EFFECT).getName(), butterfly,
|
||||
EnumButterflyChromosome.EFFECT);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage2(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()), butterfly, EnumButterflyChromosome.SPECIES);
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()), butterfly, EnumButterflyChromosome.SPECIES);
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
String yes = Translator.translateToLocal("for.yes");
|
||||
String no = Translator.translateToLocal("for.no");
|
||||
|
||||
String diurnal0, diurnal1, nocturnal0, nocturnal1;
|
||||
if (butterfly.getGenome().getNocturnal()) {
|
||||
nocturnal0 = diurnal0 = yes;
|
||||
} else {
|
||||
nocturnal0 = butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.NOCTURNAL)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
diurnal1 = !butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
|
||||
textLayout.newLine();
|
||||
|
||||
String primary = StringUtil.readableBoolean(butterfly.getGenome().getTolerantFlyer(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TOLERANT_FLYER)).getValue(), yes,
|
||||
no);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, butterfly, EnumButterflyChromosome.TOLERANT_FLYER);
|
||||
textLayout.newLine();
|
||||
|
||||
primary = StringUtil.readableBoolean(butterfly.getGenome().getFireResist(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FIRE_RESIST)).getValue(), yes,
|
||||
no);
|
||||
|
||||
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.fireresist"), primary, secondary, butterfly, EnumButterflyChromosome.FIRE_RESIST);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()), butterfly, EnumButterflyChromosome.SPECIES);
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
gui.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()), butterfly, EnumButterflyChromosome.SPECIES);
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
|
||||
gui.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
|
||||
gui.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
String yes = Translator.translateToLocal("for.yes");
|
||||
String no = Translator.translateToLocal("for.no");
|
||||
|
||||
String diurnal0, diurnal1, nocturnal0, nocturnal1;
|
||||
if (butterfly.getGenome().getNocturnal()) {
|
||||
nocturnal0 = diurnal0 = yes;
|
||||
} else {
|
||||
nocturnal0 = butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.NOCTURNAL)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
diurnal1 = !butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, gui.getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, gui.getColorCoding(false));
|
||||
textLayout.newLine();
|
||||
|
||||
String primary = StringUtil.readableBoolean(butterfly.getGenome().getTolerantFlyer(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TOLERANT_FLYER)).getValue(), yes,
|
||||
no);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, butterfly, EnumButterflyChromosome.TOLERANT_FLYER);
|
||||
textLayout.newLine();
|
||||
|
||||
primary = StringUtil.readableBoolean(butterfly.getGenome().getFireResist(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FIRE_RESIST)).getValue(), yes,
|
||||
no);
|
||||
|
||||
gui.drawRow(Translator.translateToLocal("for.gui.fireresist"), primary, secondary, butterfly, EnumButterflyChromosome.FIRE_RESIST);
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void drawAnalyticsPage3(GuiAlyzer gui, ItemStack itemStack) {
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextLayoutHelper textLayout = gui.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.loot.butterfly") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : butterfly.getGenome().getPrimary().getButterflyLoot().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, gui.getGuiLeft() + x, gui.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
public void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack) {
|
||||
if(gui instanceof GuiAlyzer){
|
||||
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
|
||||
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
|
||||
if (butterfly == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.loot.caterpillar") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : butterfly.getGenome().getPrimary().getCaterpillarLoot().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, gui.getGuiLeft() + x, gui.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
|
||||
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
|
||||
|
||||
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.loot.butterfly") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
int x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : butterfly.getGenome().getPrimary().getButterflyLoot().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, guiAlyzer.getGuiLeft() + x, guiAlyzer.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(Translator.translateToLocal("for.gui.loot.caterpillar") + ":", GuiAlyzer.COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
for (ItemStack stack : butterfly.getGenome().getPrimary().getCaterpillarLoot().keySet()) {
|
||||
Proxies.common.getClientInstance().getRenderItem().renderItemIntoGUI(stack, guiAlyzer.getGuiLeft() + x, guiAlyzer.getGuiTop() + textLayout.getLineY());
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = GuiAlyzer.COLUMN_0;
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -211,7 +211,7 @@ public class TileCocoon extends TileEntity implements IStreamable, IOwnedTile, I
|
||||
}
|
||||
|
||||
public ButterflyHatch getButterflyHatch(World world, BlockPos pos) {
|
||||
if (GreenhouseManager.greenhouseHelper.getGreenhouseController(world, pos) == null) {
|
||||
if (GreenhouseManager.greenhouseHelper == null || GreenhouseManager.greenhouseHelper.getGreenhouseController(world, pos) == null) {
|
||||
return null;
|
||||
}
|
||||
IGreenhouseController controller = GreenhouseManager.greenhouseHelper.getGreenhouseController(world, pos);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 644 B After Width: | Height: | Size: 3.6 KiB |
Reference in new issue
Block a user