mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 17:44:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05c6f4effa | ||
|
|
b9c36df910 | ||
|
|
d2fe7ac8a4 | ||
|
|
2bdca1266a | ||
|
|
dd3cc6aef9 | ||
|
|
41c20ea97a | ||
|
|
2dbc507486 | ||
|
|
a56200228f | ||
|
|
951d38abfa | ||
|
|
542cbab826 | ||
|
|
17237e41f8 | ||
|
|
c7f268f200 | ||
|
|
645dba903d | ||
|
|
1ac4acdb47 | ||
|
|
74aa33e80c | ||
|
|
6f6b45abcf | ||
|
|
7297a6a5d3 | ||
|
|
5ef76cffca | ||
|
|
9284f84645 | ||
|
|
85ba33e1ff | ||
|
|
9f5f5e7812 | ||
|
|
8617c4a79f | ||
|
|
e9809238de | ||
|
|
c0a22f4a28 | ||
|
|
41c6fb15b3 | ||
|
|
b5d65e83f0 | ||
|
|
1a7c148a7e | ||
|
|
ead630aa51 | ||
|
|
85b71c785a | ||
|
|
04cb58dfa2 | ||
|
|
3822e90ada | ||
|
|
af5cb93689 | ||
|
|
6a62024dd4 | ||
|
|
bedb7ffe85 | ||
|
|
4a21641bcd | ||
|
|
21d0b832b9 |
No files matched your search
+3
-3
@@ -1,10 +1,10 @@
|
||||
mcversion=1.9.4
|
||||
forgeversion=12.17.0.1957
|
||||
forgeversion=12.17.0.1968
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
jei_version=3.6.0.+
|
||||
jei_version=3.6.4.+
|
||||
ic2_version=2.5.5-ex19
|
||||
|
||||
version_major=5
|
||||
version_minor=0
|
||||
version_patch=14
|
||||
version_patch=24
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
#Tue Jun 21 15:23:47 PDT 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
|
||||
+1
-1
Submodule lang updated: 9be86d3c99...a8bbc7bd1c.
@@ -49,7 +49,7 @@ import forestry.plugins.PluginManager;
|
||||
name = "Forestry",
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[12.17.0.1949,);"
|
||||
dependencies = "required-after:Forge@[12.17.0.1963,);"
|
||||
+ "after:Buildcraft|Core@[7.2,);"
|
||||
+ "after:BuildCraft|Energy@[7.2,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
@@ -57,7 +57,7 @@ import forestry.plugins.PluginManager;
|
||||
+ "after:IC2@[2.3.235,);"
|
||||
+ "after:Natura@[2.2.0,);"
|
||||
+ "after:HardcoreEnderExpansion;"
|
||||
+ "after:JEI@[3.6.0,);"
|
||||
+ "after:JEI@[3.6.4,);"
|
||||
+ "after:basemetals;")
|
||||
public class Forestry {
|
||||
|
||||
|
||||
@@ -50,12 +50,4 @@ public interface IAlleleBeeSpecies extends IAlleleSpecies {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 3.6.
|
||||
* @return Path of the texture to use for entity rendering.
|
||||
*/
|
||||
@Deprecated
|
||||
String getEntityTexture();
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -32,6 +34,7 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
*/
|
||||
Iterable<IBeeListener> getBeeListeners();
|
||||
|
||||
@Nonnull
|
||||
IBeeHousingInventory getBeeInventory();
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
|
||||
+4
-3
@@ -5,8 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface IBeeMutationCustom extends IBeeMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IBeeMutationBuilder extends IMutationBuilder {
|
||||
@Override
|
||||
IBeeMutation build();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface IBeeMutationFactory {
|
||||
/**
|
||||
* Creates a new bee mutation.
|
||||
* Automatically registered with BeeManager.beeRoot.registerMutation()
|
||||
* See IBeeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See IBeeMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentBee0 A parent bee for this mutation
|
||||
* @param parentBee1 A parent bee for this mutation
|
||||
@@ -19,5 +19,5 @@ public interface IBeeMutationFactory {
|
||||
* @param chance The chance that breeding the two parent bees will result in this mutation
|
||||
* @return a new bee mutation.
|
||||
*/
|
||||
IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
|
||||
IBeeMutationBuilder createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
/**
|
||||
@@ -18,6 +21,7 @@ import forestry.api.core.IModelManager;
|
||||
* There is no default implementation because every sapling has a unique icon.
|
||||
*/
|
||||
public interface IGermlingModelProvider {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumGermlingType type);
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
* @return Integer denoting the size of the tree trunk.
|
||||
*/
|
||||
@Override
|
||||
int getGirth(World world, BlockPos pos);
|
||||
int getGirth();
|
||||
|
||||
/**
|
||||
* @return Growth conditions at the given position.
|
||||
|
||||
+4
-3
@@ -5,8 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface ITreeMutationCustom extends ITreeMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface ITreeMutationBuilder extends IMutationBuilder {
|
||||
@Override
|
||||
ITreeMutation build();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface ITreeMutationFactory {
|
||||
/**
|
||||
* Creates a new tree mutation.
|
||||
* Automatically registered with TreeManager.treeRoot.registerMutation()
|
||||
* See ITreeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See ITreeMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentTree0 A parent tree for this mutation
|
||||
* @param parentTree1 A parent tree for this mutation
|
||||
@@ -19,5 +19,5 @@ public interface ITreeMutationFactory {
|
||||
* @param chance The chance that breeding the two parent trees will result in this mutation
|
||||
* @return a new tree mutation.
|
||||
*/
|
||||
ITreeMutationCustom createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, IAllele[] result, int chance);
|
||||
ITreeMutationBuilder createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -30,6 +30,4 @@ public interface IModelManager {
|
||||
|
||||
void registerItemModel(Item item, ItemMeshDefinition definition);
|
||||
|
||||
void registerVariant(Item item, ResourceLocation... resources);
|
||||
|
||||
}
|
||||
+16
-13
@@ -6,6 +6,7 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
@@ -13,40 +14,42 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
/** Set custom mutation requirements */
|
||||
public interface IMutationCustom extends IMutation {
|
||||
public interface IMutationBuilder {
|
||||
|
||||
IMutation build();
|
||||
|
||||
/** Prevent this mutation from being shown in the analyzers */
|
||||
IMutationCustom setIsSecret();
|
||||
IMutationBuilder setIsSecret();
|
||||
|
||||
/** Require a specific temperature for this mutation to occur */
|
||||
IMutationCustom restrictTemperature(EnumTemperature temperature);
|
||||
IMutationBuilder restrictTemperature(EnumTemperature temperature);
|
||||
|
||||
IMutationCustom restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature);
|
||||
IMutationBuilder restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature);
|
||||
|
||||
/** Require a specific humidity for this mutation to occur */
|
||||
IMutationCustom restrictHumidity(EnumHumidity humidity);
|
||||
IMutationBuilder restrictHumidity(EnumHumidity humidity);
|
||||
|
||||
IMutationCustom restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity);
|
||||
IMutationBuilder restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity);
|
||||
|
||||
/**
|
||||
* Restrict this mutation to certain types of biomes.
|
||||
* @param types The types of biomes this mutation can occur.
|
||||
*/
|
||||
IMutationCustom restrictBiomeType(BiomeDictionary.Type... types);
|
||||
IMutationBuilder restrictBiomeType(BiomeDictionary.Type... types);
|
||||
|
||||
/** Restrict the days of the year that this mutation can occur */
|
||||
IMutationCustom restrictDateRange(int startMonth, int startDay, int endMonth, int endDay);
|
||||
IMutationBuilder restrictDateRange(int startMonth, int startDay, int endMonth, int endDay);
|
||||
|
||||
/** Restrict the time of day that this mutation can occur */
|
||||
IMutationCustom requireDay();
|
||||
IMutationBuilder requireDay();
|
||||
|
||||
IMutationCustom requireNight();
|
||||
IMutationBuilder requireNight();
|
||||
|
||||
/** Require a specific resource to be under the location of the mutation */
|
||||
IMutationCustom requireResource(Block block, int meta);
|
||||
IMutationBuilder requireResource(IBlockState requiredBlockState);
|
||||
|
||||
IMutationCustom requireResource(String oreDictName);
|
||||
IMutationBuilder requireResource(String oreDictName);
|
||||
|
||||
/** Require some other custom mutation condition */
|
||||
IMutationCustom addMutationCondition(IMutationCondition mutationCondition);
|
||||
IMutationBuilder addMutationCondition(IMutationCondition mutationCondition);
|
||||
}
|
||||
+4
-3
@@ -5,8 +5,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface IButterflyMutationCustom extends IButterflyMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IButterflyMutationBuilder extends IMutationBuilder {
|
||||
@Override
|
||||
IButterflyMutation build();
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public interface IButterflyMutationFactory {
|
||||
/**
|
||||
* Creates a new butterfly mutation.
|
||||
* Automatically registered with ButterflyManager.butterflyRoot.registerMutation()
|
||||
* See IButterflyMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See IButterflyMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentButterfly0 A parent butterfly for this mutation
|
||||
* @param parentButterfly1 A parent butterfly for this mutation
|
||||
@@ -19,5 +19,5 @@ public interface IButterflyMutationFactory {
|
||||
* @param chance The chance that breeding the two parent butterfly's will result in this mutation
|
||||
* @return a new butterfly mutation.
|
||||
*/
|
||||
IButterflyMutationCustom createMutation(IAlleleButterflySpecies parentButterfly0, IAlleleButterflySpecies parentButterfly1, IAllele[] result, int chance);
|
||||
IButterflyMutationBuilder createMutation(IAlleleButterflySpecies parentButterfly0, IAlleleButterflySpecies parentButterfly1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -17,9 +17,5 @@ public interface IMailAddress extends INbtWritable {
|
||||
|
||||
boolean isValid();
|
||||
|
||||
boolean isPlayer();
|
||||
|
||||
boolean isTrader();
|
||||
|
||||
GameProfile getPlayerProfile();
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.mail;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,9 +19,10 @@ public interface IPostRegistry {
|
||||
IPostOffice getPostOffice(World world);
|
||||
|
||||
/* MAIL ADDRESSES */
|
||||
IMailAddress getMailAddress(GameProfile gameProfile);
|
||||
|
||||
IMailAddress getMailAddress(String traderName);
|
||||
@Nonnull
|
||||
IMailAddress getMailAddress(@Nonnull GameProfile gameProfile);
|
||||
|
||||
IMailAddress getMailAddress(@Nonnull String traderName);
|
||||
|
||||
/* LETTERS */
|
||||
boolean isLetter(ItemStack itemstack);
|
||||
|
||||
@@ -18,7 +18,7 @@ import forestry.api.arboriculture.ITreeGenome;
|
||||
|
||||
public interface ITreeGenData {
|
||||
|
||||
int getGirth(World world, BlockPos pos);
|
||||
int getGirth();
|
||||
|
||||
float getHeightModifier();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -233,18 +234,20 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
if (beeType == EnumBeeType.PRINCESS) {
|
||||
tickBreed();
|
||||
} else if (beeType == EnumBeeType.QUEEN) {
|
||||
queenWorkTick(queen);
|
||||
queenWorkTick(queen, queenStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
if (!housing.getWorldObj().isRemote) {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
}
|
||||
}
|
||||
|
||||
private void queenWorkTick(IBee queen) {
|
||||
private void queenWorkTick(@Nullable IBee queen, @Nonnull ItemStack queenStack) {
|
||||
if (queen == null) {
|
||||
beeProgress = 0;
|
||||
beeProgressMax = 0;
|
||||
@@ -270,7 +273,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
// Write the changed queen back into the item stack.
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
queen.writeToNBT(nbttagcompound);
|
||||
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
|
||||
queenStack.setTagCompound(nbttagcompound);
|
||||
housing.getBeeInventory().setQueen(queenStack);
|
||||
}
|
||||
|
||||
beeProgress = queen.getHealth();
|
||||
|
||||
@@ -14,9 +14,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -38,6 +36,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.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
@@ -560,9 +559,9 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{items.honeydew.getItemStack()}, honeyDropFluid);
|
||||
|
||||
ItemStack phosphor = PluginCore.items.phosphor.getItemStack(2);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, Fluids.LAVA.getFluid(2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND, 1, 1)}, Fluids.LAVA.getFluid(2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.DIRT)}, Fluids.LAVA.getFluid(1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND)}, new FluidStack(FluidRegistry.WATER, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.SAND, 1, 1)}, new FluidStack(FluidRegistry.LAVA, 2000));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{phosphor, new ItemStack(Blocks.DIRT)}, new FluidStack(FluidRegistry.LAVA, 1600));
|
||||
|
||||
// / CARPENTER
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.FOR_HONEY.getFluid(500), null, PluginCore.items.craftingMaterial.getScentedPaneling(),
|
||||
@@ -571,14 +570,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'J', items.royalJelly,
|
||||
'W', PluginCore.items.beeswax,
|
||||
'P', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1));
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(30, Fluids.WATER.getFluid(600), null, blocks.candle.getUnlitCandle(24),
|
||||
|
||||
RecipeManagers.carpenterManager.addRecipe(30, new FluidStack(FluidRegistry.WATER, 600), null, blocks.candle.getUnlitCandle(24),
|
||||
" X ",
|
||||
"###",
|
||||
"###",
|
||||
'#', PluginCore.items.beeswax,
|
||||
'X', Items.STRING);
|
||||
RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(200), null, blocks.candle.getUnlitCandle(6),
|
||||
RecipeManagers.carpenterManager.addRecipe(10, new FluidStack(FluidRegistry.WATER, 200), null, blocks.candle.getUnlitCandle(6),
|
||||
"#X#",
|
||||
'#', PluginCore.items.beeswax,
|
||||
'X', PluginCore.items.craftingMaterial.getSilkWisp());
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
@@ -14,7 +13,7 @@ import forestry.apiculture.genetics.BeeGenome;
|
||||
|
||||
import mezz.jei.api.BlankModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.INbtRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
|
||||
@JEIPlugin
|
||||
@@ -40,19 +39,19 @@ public class ApicultureJeiPlugin extends BlankModPlugin {
|
||||
|
||||
registry.addDescription(new ItemStack(PluginApiculture.items.scoop), "for.jei.description.scoop");
|
||||
|
||||
INbtRegistry nbtRegistry = registry.getJeiHelpers().getNbtRegistry();
|
||||
nbtRegistry.registerNbtInterpreter(PluginApiculture.items.beeDroneGE, BeeNbtInterpreter.INSTANCE);
|
||||
nbtRegistry.registerNbtInterpreter(PluginApiculture.items.beePrincessGE, BeeNbtInterpreter.INSTANCE);
|
||||
nbtRegistry.registerNbtInterpreter(PluginApiculture.items.beeQueenGE, BeeNbtInterpreter.INSTANCE);
|
||||
ISubtypeRegistry subtypeRegistry = registry.getJeiHelpers().getSubtypeRegistry();
|
||||
subtypeRegistry.registerNbtInterpreter(PluginApiculture.items.beeDroneGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
subtypeRegistry.registerNbtInterpreter(PluginApiculture.items.beePrincessGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
subtypeRegistry.registerNbtInterpreter(PluginApiculture.items.beeQueenGE, BeeSubtypeInterpreter.INSTANCE);
|
||||
}
|
||||
|
||||
private static class BeeNbtInterpreter implements INbtRegistry.INbtInterpreter {
|
||||
public static BeeNbtInterpreter INSTANCE = new BeeNbtInterpreter();
|
||||
private static class BeeSubtypeInterpreter implements ISubtypeRegistry.ISubtypeInterpreter {
|
||||
public static BeeSubtypeInterpreter INSTANCE = new BeeSubtypeInterpreter();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getSubtypeInfoFromNbt(@Nonnull NBTTagCompound nbtTagCompound) {
|
||||
IAlleleSpecies species = BeeGenome.getSpeciesDirectly(nbtTagCompound);
|
||||
public String getSubtypeInfo(@Nonnull ItemStack itemStack) {
|
||||
IAlleleSpecies species = BeeGenome.getSpeciesDirectly(itemStack);
|
||||
return species == null ? null : species.getUID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.render.ForestryResource;
|
||||
|
||||
public class EntityBee extends EntityCreature implements IAnimals {
|
||||
|
||||
private static final String DEFAULT_TEXTURE = Constants.TEXTURE_PATH_ENTITIES + "/bees/honeyBee.png";
|
||||
|
||||
private IBee contained;
|
||||
private IAlleleBeeSpecies species;
|
||||
private EnumBeeType type = EnumBeeType.DRONE;
|
||||
|
||||
private String beeTexture = DEFAULT_TEXTURE;
|
||||
private long lastUpdate;
|
||||
|
||||
public EntityBee(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
private void resetAppearance() {
|
||||
beeTexture = species.getEntityTexture();
|
||||
}
|
||||
|
||||
public EntityBee setIndividual(IBee bee) {
|
||||
if (bee != null) {
|
||||
contained = bee;
|
||||
} else {
|
||||
contained = BeeManager.beeRoot.templateAsIndividual(BeeManager.beeRoot.getDefaultTemplate());
|
||||
}
|
||||
|
||||
//isImmuneToFire = contained.getGenome().getFireResist();
|
||||
setSpecies(contained.getGenome().getPrimary());
|
||||
//dataWatcher.updateObject(DATAWATCHER_ID_SPECIES, species.getUID());
|
||||
//dataWatcher.updateObject(DATAWATCHER_ID_SCALE, (int)(contained.getSize() * 100));
|
||||
return this;
|
||||
}
|
||||
|
||||
public IBee getBee() {
|
||||
return contained;
|
||||
}
|
||||
|
||||
public EntityBee setType(EnumBeeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EnumBeeType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public EntityBee setSpecies(IAlleleBeeSpecies species) {
|
||||
this.species = species;
|
||||
resetAppearance();
|
||||
lastUpdate = worldObj.getTotalWorldTime();
|
||||
return this;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private ResourceLocation textureResource;
|
||||
private long lastTextureUpdate;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getTexture() {
|
||||
if (textureResource == null || lastTextureUpdate != lastUpdate) {
|
||||
textureResource = new ForestryResource(beeTexture);
|
||||
}
|
||||
|
||||
return textureResource;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -36,8 +37,11 @@ import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
|
||||
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
|
||||
@Nonnull
|
||||
private static final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener = new ApiaryBeeListener(this);
|
||||
@Nonnull
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -64,6 +68,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -72,6 +73,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
|
||||
@@ -29,7 +29,7 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesBuilder;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -1035,7 +1035,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
BeeManager.beeRoot.registerTemplate(template);
|
||||
}
|
||||
|
||||
protected final IBeeMutationCustom registerMutation(BeeDefinition parent1, BeeDefinition parent2, int chance) {
|
||||
protected final IBeeMutationBuilder registerMutation(BeeDefinition parent1, BeeDefinition parent2, int chance) {
|
||||
return BeeManager.beeMutationFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,17 +18,23 @@ import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
public class BeeMutation extends Mutation implements IBeeMutation, IBeeMutationBuilder {
|
||||
|
||||
public BeeMutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance) {
|
||||
super(bee0, bee1, result, chance);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBeeMutation build() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeRoot getRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
|
||||
@@ -12,16 +12,16 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.apiculture.IBeeMutationFactory;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class BeeMutationFactory implements IBeeMutationFactory {
|
||||
|
||||
@Override
|
||||
public IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance) {
|
||||
IBeeMutationCustom mutation = new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
BeeManager.beeRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
public IBeeMutationBuilder createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance) {
|
||||
BeeMutation beeMutation = new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
BeeManager.beeRoot.registerMutation(beeMutation);
|
||||
return beeMutation;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -47,7 +48,7 @@ public class DefaultBeeModelProvider implements IBeeModelProvider {
|
||||
}
|
||||
|
||||
models[beeType.ordinal()] = manager.getModelLocation(beeTypeNameBase);
|
||||
manager.registerVariant(item, new ResourceLocation("forestry:" + beeTypeNameBase));
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:" + beeTypeNameBase));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -195,9 +195,4 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
public int getSpriteColour(int renderPass) {
|
||||
return beeSpriteColourProvider.getSpriteColour(renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityTexture() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,7 @@ import forestry.core.utils.Translator;
|
||||
|
||||
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
|
||||
|
||||
@Nonnull
|
||||
private final InventoryBeeHousing inventory;
|
||||
private final IBeekeepingLogic beekeepingLogic;
|
||||
|
||||
@@ -77,6 +78,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
this.beeModifiers.add(new AlvearyBeeModifier());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -45,6 +46,7 @@ public class FakeAlvearyController extends FakeMultiblockController implements I
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return FakeBeeHousingInventory.instance;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -99,6 +100,7 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
|
||||
return getMultiblockLogic().getController().getBeeListeners();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return getMultiblockLogic().getController().getBeeInventory();
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
|
||||
@@ -50,9 +51,9 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
|
||||
super(BlockAlvearyType.HYGRO);
|
||||
|
||||
this.inventory = new InventoryHygroregulator(this);
|
||||
|
||||
Fluid water = Fluids.WATER.getFluid();
|
||||
Fluid lava = Fluids.LAVA.getFluid();
|
||||
|
||||
Fluid water = FluidRegistry.WATER;
|
||||
Fluid lava = FluidRegistry.LAVA;
|
||||
Fluid liquidIce = Fluids.ICE.getFluid();
|
||||
|
||||
this.liquidTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY).setFilters(water, lava, liquidIce);
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.render;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.apiculture.entities.EntityBee;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class RenderBeeEntity extends RenderLiving {
|
||||
|
||||
private final ModelBee beeModel;
|
||||
|
||||
public RenderBeeEntity() {
|
||||
super(Proxies.common.getClientInstance().getRenderManager(), new ModelBee(), 0.15f);
|
||||
beeModel = (ModelBee) mainModel;
|
||||
}
|
||||
|
||||
private void renderBee(EntityBee entity, double posX, double posY, double posZ, float par8, float par9) {
|
||||
beeModel.setType(entity.getType());
|
||||
this.doRender(entity, posX, posY, posZ, par8, par9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityLiving entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||
renderBee((EntityBee) entity, x, y, z, entityYaw, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return ((EntityBee) entity).getTexture();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
|
||||
public class FakeBeeHousingInventory implements IBeeHousingInventory {
|
||||
@Nonnull
|
||||
public static final FakeBeeHousingInventory instance = new FakeBeeHousingInventory();
|
||||
|
||||
private FakeBeeHousingInventory() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -30,8 +31,11 @@ import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
|
||||
public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
@Nonnull
|
||||
private final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener = new ApiaryBeeListener(this);
|
||||
@Nonnull
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
|
||||
public TileApiary() {
|
||||
@@ -39,6 +43,7 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
setInternalInventory(inventory);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -24,9 +25,12 @@ import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
|
||||
public class TileBeeHouse extends TileBeeHousingBase {
|
||||
@Nonnull
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener;
|
||||
@Nonnull
|
||||
private final InventoryBeeHousing beeInventory;
|
||||
|
||||
public TileBeeHouse() {
|
||||
@@ -38,6 +42,7 @@ public class TileBeeHouse extends TileBeeHousingBase {
|
||||
setInternalInventory(beeInventory);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
|
||||
@@ -293,6 +293,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Random;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -51,7 +52,7 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
|
||||
}
|
||||
|
||||
@@ -100,7 +101,6 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
|
||||
return new ItemStack(getItem());
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.block.BlockPlanks.EnumType;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -119,7 +120,7 @@ public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends Block
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodMeshDefinition(this));
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import java.util.Collections;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -42,7 +43,7 @@ public class BlockForestryStairs<T extends Enum<T> & IWoodType> extends BlockSta
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -103,7 +104,7 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -181,7 +182,7 @@ public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends Bl
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public final void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -120,7 +121,7 @@ public abstract class BlockForestryPlanks<T extends Enum<T> & IWoodType> extends
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -132,7 +133,7 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerVariant(item, WoodHelper.getResourceLocations(this));
|
||||
ModelBakery.registerItemVariants(item, WoodHelper.getResourceLocations(this));
|
||||
manager.registerItemModel(item, new WoodHelper.WoodMeshDefinition(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ public class Tree extends Individual implements ITree, IPlantable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGirth(World world, BlockPos pos) {
|
||||
public int getGirth() {
|
||||
return genome.getGirth();
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import forestry.api.arboriculture.ILeafSpriteProvider;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenerator;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeMutationCustom;
|
||||
import forestry.api.arboriculture.ITreeMutationBuilder;
|
||||
import forestry.api.arboriculture.IWoodProvider;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
@@ -1056,7 +1056,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
|
||||
TreeManager.treeRoot.registerTemplate(template);
|
||||
}
|
||||
|
||||
protected final ITreeMutationCustom registerMutation(TreeDefinition parent1, TreeDefinition parent2, int chance) {
|
||||
protected final ITreeMutationBuilder registerMutation(TreeDefinition parent1, TreeDefinition parent2, int chance) {
|
||||
return TreeManager.treeMutationFactory.createMutation(parent1.species, parent2.species, getTemplate(), chance);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,18 +15,24 @@ import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeMutationCustom;
|
||||
import forestry.api.arboriculture.ITreeMutation;
|
||||
import forestry.api.arboriculture.ITreeMutationBuilder;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class TreeMutation extends Mutation implements ITreeMutationCustom {
|
||||
public class TreeMutation extends Mutation implements ITreeMutation, ITreeMutationBuilder {
|
||||
|
||||
public TreeMutation(IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, IAllele[] template, int chance) {
|
||||
super(allele0, allele1, template, chance);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ITreeMutation build() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITreeRoot getRoot() {
|
||||
return TreeManager.treeRoot;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITreeMutationCustom;
|
||||
import forestry.api.arboriculture.ITreeMutationBuilder;
|
||||
import forestry.api.arboriculture.ITreeMutationFactory;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -19,9 +19,9 @@ import forestry.api.genetics.IAllele;
|
||||
public class TreeMutationFactory implements ITreeMutationFactory {
|
||||
|
||||
@Override
|
||||
public ITreeMutationCustom createMutation(IAlleleTreeSpecies parent0, IAlleleTreeSpecies parent1, IAllele[] result, int chance) {
|
||||
ITreeMutationCustom mutation = new TreeMutation(parent0, parent1, result, chance);
|
||||
TreeManager.treeRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
public ITreeMutationBuilder createMutation(IAlleleTreeSpecies parent0, IAlleleTreeSpecies parent1, IAllele[] result, int chance) {
|
||||
TreeMutation treeMutation = new TreeMutation(parent0, parent1, result, chance);
|
||||
TreeManager.treeRoot.registerMutation(treeMutation);
|
||||
return treeMutation;
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,14 @@ package forestry.arboriculture.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.IGermlingModelProvider;
|
||||
import forestry.api.core.IModelManager;
|
||||
@@ -31,14 +35,15 @@ public class ModelProviderGermling implements IGermlingModelProvider {
|
||||
this.name = modelUid.substring("forestry.".length());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels(Item item, IModelManager manager, EnumGermlingType type) {
|
||||
if(type == EnumGermlingType.SAPLING){
|
||||
germlingModel = manager.getModelLocation("germlings/sapling." + name);
|
||||
manager.registerVariant(item, new ResourceLocation("forestry:germlings/sapling." + name));
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:germlings/sapling." + name));
|
||||
}else if(type == EnumGermlingType.POLLEN){
|
||||
pollenModel = manager.getModelLocation("pollen");
|
||||
manager.registerVariant(item, new ResourceLocation("forestry:pollen"));
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:pollen"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(@Nullable GameProfile owner) {
|
||||
public void setOwner(@Nonnull GameProfile owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.arboriculture.blocks.BlockSapling;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -61,6 +62,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
}
|
||||
|
||||
if (genPos != null) {
|
||||
clearSaplings(world, genPos);
|
||||
List<BlockPos> branchEnds = new ArrayList<>(generateTrunk(world, rand, wood, genPos));
|
||||
Collections.sort(branchEnds, TopDownBlockPosComparator.INSTANCE);
|
||||
generateLeaves(world, rand, leaf, branchEnds, genPos);
|
||||
@@ -96,6 +98,18 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
@Nullable
|
||||
public abstract BlockPos getValidGrowthPos(World world, BlockPos pos);
|
||||
|
||||
public void clearSaplings(World world, BlockPos genPos) {
|
||||
int treeGirth = tree.getGirth();
|
||||
for (int x = 0; x < treeGirth; x++) {
|
||||
for (int z = 0; z < treeGirth; z++) {
|
||||
BlockPos saplingPos = genPos.add(x, 0, z);
|
||||
if (world.getBlockState(saplingPos).getBlock() instanceof BlockSapling) {
|
||||
world.setBlockToAir(saplingPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasPods() {
|
||||
return tree.allowsFruitBlocks();
|
||||
}
|
||||
|
||||
@@ -47,12 +47,13 @@ public class WorldGenCherry extends WorldGenTree {
|
||||
|
||||
@Override
|
||||
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
|
||||
int leafSpawn = height + 1;
|
||||
int leafSpawn = height + 2;
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn, 0), girth, (float) 1 + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn, 0), girth, 1 + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
|
||||
|
||||
for (BlockPos branchEnd : branchEnds) {
|
||||
WorldGenHelper.generateCircle(world, rand, branchEnd, 4, 3, 2, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
WorldGenHelper.generateCircle(world, rand, branchEnd.up(), 3, 3, 1, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
WorldGenHelper.generateCircle(world, rand, branchEnd, 4, 3, 1, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,10 @@ public class WorldGenEbony extends WorldGenTree {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<BlockPos> generateTrunk(World world, Random rand, TreeBlockTypeLog wood, BlockPos startPos) {
|
||||
int offset = (girth - 1) / 2;
|
||||
int trunksGenerated = 0;
|
||||
|
||||
for (int x = -offset; x < -offset + girth; x++) {
|
||||
for (int z = -offset; z < -offset + girth; z++) {
|
||||
for (int x = 0; x < girth; x++) {
|
||||
for (int z = 0; z < girth; z++) {
|
||||
if (rand.nextFloat() < 0.6f) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
WorldGenHelper.addBlock(world, startPos.add(x, y, z), wood, WorldGenHelper.EnumReplaceMode.ALL);
|
||||
@@ -68,8 +67,8 @@ public class WorldGenEbony extends WorldGenTree {
|
||||
h = height / 2 + rand.nextInt(height / 2);
|
||||
}
|
||||
|
||||
int x_off = -girth + rand.nextInt(2 * girth);
|
||||
int y_off = -girth + rand.nextInt(2 * girth);
|
||||
int x_off = rand.nextInt(girth);
|
||||
int y_off = rand.nextInt(girth);
|
||||
|
||||
BlockPos center = startPos.add(x_off, h, y_off);
|
||||
int radius = 1 + rand.nextInt(girth);
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class WorldGenTree extends WorldGenArboriculture {
|
||||
public final void preGenerate(World world, Random rand, BlockPos startPos) {
|
||||
super.preGenerate(world, rand, startPos);
|
||||
height = determineHeight(world, rand, baseHeight, heightVariation);
|
||||
girth = tree.getGirth(world, startPos);
|
||||
girth = tree.getGirth();
|
||||
}
|
||||
|
||||
protected int modifyByHeight(World world, int val, int min, int max) {
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -27,6 +26,8 @@ import net.minecraft.world.storage.loot.functions.LootFunctionManager;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -265,7 +266,7 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
// / CARPENTER
|
||||
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, PluginCore.items.portableAlyzer.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(100, new FluidStack(FluidRegistry.WATER, 2000), null, PluginCore.items.portableAlyzer.getItemStack(),
|
||||
"X#X", "X#X", "RDR",
|
||||
'#', OreDictUtil.PANE_GLASS,
|
||||
'X', OreDictUtil.INGOT_TIN,
|
||||
@@ -340,9 +341,9 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can");
|
||||
if (bogEarthOutputCan > 0) {
|
||||
ItemStack bogEarth = blocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, bogEarthOutputCan);
|
||||
ItemStack canWater = PluginFluids.items.getContainer(EnumContainerType.CAN, Fluids.WATER);
|
||||
ItemStack waxCapsuleWater = PluginFluids.items.getContainer(EnumContainerType.CAPSULE, Fluids.WATER);
|
||||
ItemStack refractoryWater = PluginFluids.items.getContainer(EnumContainerType.REFRACTORY, Fluids.WATER);
|
||||
ItemStack canWater = PluginFluids.items.getContainer(EnumContainerType.CAN, FluidRegistry.WATER);
|
||||
ItemStack waxCapsuleWater = PluginFluids.items.getContainer(EnumContainerType.CAPSULE, FluidRegistry.WATER);
|
||||
ItemStack refractoryWater = PluginFluids.items.getContainer(EnumContainerType.REFRACTORY, FluidRegistry.WATER);
|
||||
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', canWater, 'Y', OreDictUtil.SAND);
|
||||
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waxCapsuleWater, 'Y', OreDictUtil.SAND);
|
||||
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', refractoryWater, 'Y', OreDictUtil.SAND);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PluginFluids extends BlankForestryPlugin {
|
||||
|
||||
@Override
|
||||
public void registerItemsAndBlocks() {
|
||||
for (Fluids fluidType : Fluids.FORESTRY_FLUIDs) {
|
||||
for (Fluids fluidType : Fluids.values()) {
|
||||
createFluid(fluidType);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.access;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -100,7 +101,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(GameProfile owner) {
|
||||
public void setOwner(@Nonnull GameProfile owner) {
|
||||
this.owner = owner;
|
||||
for (IAccessOwnerListener listener : accessOwnerListeners) {
|
||||
listener.onOwnerSet(owner);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.access;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -90,7 +91,7 @@ public class FakeAccessHandler implements IAccessHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(GameProfile owner) {
|
||||
public void setOwner(@Nonnull GameProfile owner) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.access;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -17,10 +20,11 @@ import com.mojang.authlib.GameProfile;
|
||||
public interface IOwnable {
|
||||
|
||||
boolean isOwned();
|
||||
|
||||
|
||||
@Nullable
|
||||
GameProfile getOwner();
|
||||
|
||||
void setOwner(GameProfile owner);
|
||||
|
||||
void setOwner(@Nonnull GameProfile owner);
|
||||
|
||||
boolean isOwner(EntityPlayer player);
|
||||
|
||||
|
||||
@@ -69,5 +69,6 @@ public class BlockRegistryCore extends BlockRegistry {
|
||||
|
||||
// register some common oreDict names for our recipes
|
||||
OreDictionary.registerOre(OreDictUtil.CRAFTING_TABLE_WOOD, Blocks.CRAFTING_TABLE);
|
||||
OreDictionary.registerOre(OreDictUtil.TRAPDOOR_WOOD, Blocks.TRAPDOOR);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public final class CommandSaveStats extends SubCommand {
|
||||
}
|
||||
}
|
||||
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Constants.MOD_ID + "/stats/" + player.getDisplayName() + '-' + saveHelper.getFileSuffix() + ".log");
|
||||
File file = new File(Proxies.common.getForestryRoot(), "config/" + Constants.MOD_ID + "/stats/" + player.getDisplayNameString() + '-' + saveHelper.getFileSuffix() + ".log");
|
||||
try {
|
||||
File folder = file.getParentFile();
|
||||
if (folder != null && !folder.exists()) {
|
||||
|
||||
@@ -242,8 +242,8 @@ public class Config {
|
||||
|
||||
private static void loadConfigFluids(File configFile) {
|
||||
configFluid = new LocalizedConfiguration(configFile, "1.0.0");
|
||||
|
||||
for (Fluids fluid : Fluids.FORESTRY_FLUIDs) {
|
||||
|
||||
for (Fluids fluid : Fluids.values()) {
|
||||
String fluidName = Translator.translateToLocal("fluid." + fluid.getTag());
|
||||
|
||||
boolean enabledFluid = !Config.disabledFluids.contains(fluid.getTag());
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.entities;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -27,7 +26,9 @@ public class ParticleColoredDripParticle extends Particle {
|
||||
private int bobTimer;
|
||||
|
||||
public ParticleColoredDripParticle(World world, double x, double y, double z, float red, float green, float blue) {
|
||||
super(world, x, y, z);
|
||||
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
this.motionX = this.motionY = this.motionZ = 0.0D;
|
||||
|
||||
this.particleRed = red;
|
||||
this.particleGreen = green;
|
||||
this.particleBlue = blue;
|
||||
@@ -37,6 +38,7 @@ public class ParticleColoredDripParticle extends Particle {
|
||||
this.particleGravity = 0.06F;
|
||||
this.bobTimer = 40;
|
||||
this.particleMaxAge = (int) (64.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.motionX = this.motionY = this.motionZ = 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,15 +76,21 @@ public class ParticleColoredDripParticle extends Particle {
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
|
||||
IBlockState state = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)));
|
||||
Block block = state.getBlock();
|
||||
Material material = block.getMaterial(state);
|
||||
|
||||
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
|
||||
Material material = iblockstate.getMaterial();
|
||||
|
||||
if (material.isLiquid() || material.isSolid()) {
|
||||
double d0 = MathHelper.floor_double(this.posY) + 1 - BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state));
|
||||
|
||||
if (this.posY < d0) {
|
||||
double d0 = 0.0D;
|
||||
|
||||
if (iblockstate.getBlock() instanceof BlockLiquid) {
|
||||
d0 = BlockLiquid.getLiquidHeightPercent(iblockstate.getValue(BlockLiquid.LEVEL));
|
||||
}
|
||||
|
||||
double d1 = (double) (MathHelper.floor_double(this.posY) + 1) - d0;
|
||||
|
||||
if (this.posY < d1) {
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
}
|
||||
|
||||
public BlockForestryFluid(Fluids forestryFluid, int flammability, boolean flammable) {
|
||||
this(forestryFluid.getFluid(), flammability, flammable, forestryFluid.getColor());
|
||||
this(forestryFluid.getFluid(), flammability, flammable, forestryFluid.getParticleColor());
|
||||
}
|
||||
|
||||
private BlockForestryFluid(Fluid fluid, int flammability, boolean flammable, Color color) {
|
||||
@@ -119,8 +119,8 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
double px = d0 + rand.nextFloat();
|
||||
double py = d1 - 1.05D;
|
||||
double pz = d2 + rand.nextFloat();
|
||||
|
||||
Particle fx = new ParticleColoredDripParticle(worldIn, px, py, pz, color.getRed(), color.getGreen(), color.getBlue());
|
||||
|
||||
Particle fx = new ParticleColoredDripParticle(worldIn, px, py, pz, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f);
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,19 +120,8 @@ public enum Fluids {
|
||||
public Block makeBlock() {
|
||||
return new BlockForestryFluid(this);
|
||||
}
|
||||
},
|
||||
// Vanilla
|
||||
WATER(new Color(0x2432ec)),
|
||||
LAVA(new Color(0xfd461f)),
|
||||
// BuildCraft
|
||||
FUEL(new Color(0xffff00)),
|
||||
OIL(new Color(0x404040)),
|
||||
// Railcraft
|
||||
CREOSOTE(new Color(0x635c03)),
|
||||
STEAM(new Color(0x91938F));
|
||||
|
||||
public static final Fluids[] FORESTRY_FLUIDs = {BIO_ETHANOL, BIOMASS, GLASS, FOR_HONEY, ICE, JUICE, MILK, SEED_OIL, SHORT_MEAD};
|
||||
|
||||
};
|
||||
|
||||
private static final Map<String, Fluids> tagToFluid = new HashMap<>();
|
||||
|
||||
static {
|
||||
@@ -144,17 +133,17 @@ public enum Fluids {
|
||||
private final String tag;
|
||||
private final int density, viscosity;
|
||||
@Nonnull
|
||||
private final Color color;
|
||||
private final Color particleColor;
|
||||
|
||||
private final ResourceLocation[] resources = new ResourceLocation[2];
|
||||
|
||||
Fluids(@Nonnull Color color) {
|
||||
this(color, 1000, 1000);
|
||||
|
||||
Fluids(@Nonnull Color particleColor) {
|
||||
this(particleColor, 1000, 1000);
|
||||
}
|
||||
|
||||
Fluids(@Nonnull Color color, int density, int viscosity) {
|
||||
|
||||
Fluids(@Nonnull Color particleColor, int density, int viscosity) {
|
||||
this.tag = name().toLowerCase(Locale.ENGLISH).replace('_', '.');
|
||||
this.color = color;
|
||||
this.particleColor = particleColor;
|
||||
this.density = density;
|
||||
this.viscosity = viscosity;
|
||||
|
||||
@@ -197,8 +186,8 @@ public enum Fluids {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public final Color getColor() {
|
||||
return color;
|
||||
public final Color getParticleColor() {
|
||||
return particleColor;
|
||||
}
|
||||
|
||||
public final boolean is(Fluid fluid) {
|
||||
@@ -231,21 +220,6 @@ public enum Fluids {
|
||||
return a.isFluidEqual(b);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Color getFluidColor(FluidStack fluidStack) {
|
||||
if (fluidStack != null) {
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
if (fluid != null) {
|
||||
Fluids fluidDefinition = tagToFluid.get(fluid.getName());
|
||||
if (fluidDefinition != null) {
|
||||
return fluidDefinition.getColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Fluids.WATER.getColor();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Fluids getFluidDefinition(FluidStack fluidStack) {
|
||||
if (fluidStack != null) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
@@ -48,7 +49,7 @@ public class PipetteContents implements INbtWritable {
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
return contents.amount >= 1000;
|
||||
return contents.amount >= Fluid.BUCKET_VOLUME;
|
||||
}
|
||||
|
||||
public void addTooltip(List<String> list) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -25,10 +26,11 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public abstract class Mutation implements IMutationCustom {
|
||||
public abstract class Mutation implements IMutation, IMutationBuilder {
|
||||
|
||||
private final int chance;
|
||||
|
||||
@@ -107,8 +109,8 @@ public abstract class Mutation implements IMutationCustom {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mutation requireResource(Block block, int meta) {
|
||||
IMutationCondition mutationCondition = new MutationConditionRequiresResource(block, meta);
|
||||
public Mutation requireResource(IBlockState blockState) {
|
||||
IMutationCondition mutationCondition = new MutationConditionRequiresResource(blockState);
|
||||
return addMutationCondition(mutationCondition);
|
||||
}
|
||||
|
||||
|
||||
+9
-16
@@ -10,9 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -25,30 +23,25 @@ import forestry.core.utils.Translator;
|
||||
|
||||
public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
|
||||
private final ItemStack blockRequired;
|
||||
private final IBlockState requiredBlockState;
|
||||
|
||||
public MutationConditionRequiresResource(Block block, int meta) {
|
||||
blockRequired = new ItemStack(block, 1, meta);
|
||||
public MutationConditionRequiresResource(IBlockState requiredBlockState) {
|
||||
this.requiredBlockState = requiredBlockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
Block block;
|
||||
int meta;
|
||||
int i = 1;
|
||||
IBlockState blockState;
|
||||
do {
|
||||
BlockPos blockPos = new BlockPos(pos.getX(), pos.getY() - i, pos.getY());
|
||||
IBlockState blockState = world.getBlockState(blockPos);
|
||||
block = blockState.getBlock();
|
||||
meta = block.getMetaFromState(blockState);
|
||||
i++;
|
||||
} while (block instanceof IBeeHousing);
|
||||
pos = pos.down();
|
||||
blockState = world.getBlockState(pos);
|
||||
} while (blockState.getBlock() instanceof IBeeHousing);
|
||||
|
||||
return ItemStackUtil.equals(block, meta, blockRequired) ? 1 : 0;
|
||||
return this.requiredBlockState == blockState ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return Translator.translateToLocalFormatted("for.mutation.condition.resource", blockRequired.getDisplayName());
|
||||
return Translator.translateToLocalFormatted("for.mutation.condition.resource", requiredBlockState.getBlock().getLocalizedName());
|
||||
}
|
||||
}
|
||||
@@ -23,16 +23,11 @@ import forestry.core.tiles.EscritoireGame;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
|
||||
public class ContainerEscritoire extends ContainerTile<TileEscritoire> implements IGuiSelectable {
|
||||
|
||||
private final EntityPlayer player;
|
||||
|
||||
private long lastUpdate;
|
||||
|
||||
public ContainerEscritoire(EntityPlayer player, TileEscritoire tile) {
|
||||
super(tile, player.inventory, 34, 153);
|
||||
|
||||
this.player = player;
|
||||
|
||||
// Analyze slot
|
||||
addSlotToContainer(new SlotFiltered(this.tile, InventoryEscritoire.SLOT_ANALYZE, 97, 67).setPickupWatcher(this.tile).setStackLimit(1));
|
||||
|
||||
@@ -54,7 +49,7 @@ public class ContainerEscritoire extends ContainerTile<TileEscritoire> implement
|
||||
long gameLastUpdate = tile.getGame().getLastUpdate();
|
||||
if (lastUpdate != gameLastUpdate) {
|
||||
lastUpdate = gameLastUpdate;
|
||||
Proxies.net.sendToPlayer(new PacketGuiUpdate(tile), player);
|
||||
sendPacketToListeners(new PacketGuiUpdate(tile));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
@@ -62,7 +63,7 @@ public class ContainerLiquidTanksHelper<T extends TileEntity & ILiquidTankTile>
|
||||
if (pipette.canPipette(itemstack) && liquidAmount > 0) {
|
||||
if (liquidAmount > 0) {
|
||||
if (tank instanceof FluidTank) {
|
||||
FluidStack fillAmount = ((FluidTank) tank).drainInternal(1000, false);
|
||||
FluidStack fillAmount = ((FluidTank) tank).drainInternal(Fluid.BUCKET_VOLUME, false);
|
||||
int filled = pipette.fill(itemstack, fillAmount, true);
|
||||
tank.drain(filled, true);
|
||||
player.updateHeldItem();
|
||||
|
||||
@@ -91,6 +91,7 @@ public class GameTokenWidget extends Widget {
|
||||
|
||||
@Override
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
game.choose(index);
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, 0));
|
||||
}
|
||||
}
|
||||
@@ -154,27 +154,21 @@ public class InventoryAdapter implements IInventoryAdapter, IStreamable {
|
||||
}
|
||||
|
||||
/* ISIDEDINVENTORY */
|
||||
private int[][] slotMap;
|
||||
private int[] slotMap;
|
||||
|
||||
@Override
|
||||
public int[] getSlotsForFace(EnumFacing side) {
|
||||
if (allowAutomation) {
|
||||
return slotMap[side.ordinal()];
|
||||
return slotMap;
|
||||
}
|
||||
return Constants.SLOTS_NONE;
|
||||
}
|
||||
|
||||
private void configureSided() {
|
||||
slotMap = new int[6][0];
|
||||
|
||||
int count = getSizeInventory();
|
||||
int[] slots = new int[count];
|
||||
slotMap = new int[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
slots[i] = i;
|
||||
}
|
||||
|
||||
for (EnumFacing side : EnumFacing.VALUES) {
|
||||
slotMap[side.getIndex()] = slots;
|
||||
slotMap[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class InventoryEscritoire extends InventoryAdapterTile<TileEscritoire> {
|
||||
}
|
||||
|
||||
if (slotIndex == SLOT_ANALYZE) {
|
||||
return AlleleManager.alleleRegistry.isIndividual(itemStack);
|
||||
return AlleleManager.alleleRegistry.isIndividual(itemStack) || GeneticsUtil.getGeneticEquivalent(itemStack) != null;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -75,17 +75,16 @@ public class InventoryEscritoire extends InventoryAdapterTile<TileEscritoire> {
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
super.setInventorySlotContents(slotIndex, itemstack);
|
||||
if (tile.getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
if (slotIndex == SLOT_ANALYZE && !tile.getWorld().isRemote) {
|
||||
if (slotIndex == SLOT_ANALYZE) {
|
||||
if (!AlleleManager.alleleRegistry.isIndividual(getStackInSlot(SLOT_ANALYZE)) && getStackInSlot(SLOT_ANALYZE) != null) {
|
||||
ItemStack ersatz = GeneticsUtil.convertToGeneticEquivalent(getStackInSlot(SLOT_ANALYZE));
|
||||
if (ersatz != null) {
|
||||
setInventorySlotContents(SLOT_ANALYZE, ersatz);
|
||||
super.setInventorySlotContents(SLOT_ANALYZE, ersatz);
|
||||
}
|
||||
}
|
||||
tile.getGame().initialize(getStackInSlot(SLOT_ANALYZE));
|
||||
if (tile.getWorld() != null && !tile.getWorld().isRemote) {
|
||||
tile.getGame().initialize(getStackInSlot(SLOT_ANALYZE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ package forestry.core.items;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -22,14 +22,16 @@ import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.FoodStats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
@@ -40,9 +42,11 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.CreativeTabForestry;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class ItemFluidContainerForestry extends ItemForestry implements IColoredItem {
|
||||
public class ItemFluidContainerForestry extends ItemForestry {
|
||||
private final EnumContainerType type;
|
||||
|
||||
public ItemFluidContainerForestry(EnumContainerType type) {
|
||||
@@ -54,8 +58,9 @@ public class ItemFluidContainerForestry extends ItemForestry implements IColored
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 0, "liquids/" + type.toString().toLowerCase(Locale.ENGLISH) + "_empty");
|
||||
manager.registerItemModel(item, 1, "liquids/" + type.toString().toLowerCase(Locale.ENGLISH));
|
||||
String identifier = "liquids/" + type.toString().toLowerCase(Locale.ENGLISH);
|
||||
manager.registerItemModel(item, 0, identifier + "_empty");
|
||||
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(new ResourceLocation(Constants.MOD_ID, identifier), "inventory"));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -74,16 +79,6 @@ public class ItemFluidContainerForestry extends ItemForestry implements IColored
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColorFromItemstack(ItemStack itemStack, int tintIndex) {
|
||||
if (tintIndex > 0) {
|
||||
FluidStack fluidStack = getContained(itemStack);
|
||||
return Fluids.getFluidColor(fluidStack).getRGB();
|
||||
} else {
|
||||
return 0xffffff;
|
||||
}
|
||||
}
|
||||
|
||||
public EnumContainerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.core.items;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -58,7 +59,6 @@ public class ItemPipette extends ItemForestry implements IToolPipette, IFluidCon
|
||||
}
|
||||
|
||||
contained = new PipetteContents(new FluidStack(liquid, filled));
|
||||
filled = liquid.amount;
|
||||
} else {
|
||||
if (contained.getContents().amount >= limit) {
|
||||
return 0;
|
||||
@@ -106,8 +106,8 @@ public class ItemPipette extends ItemForestry implements IToolPipette, IFluidCon
|
||||
models = new ModelResourceLocation[2];
|
||||
models[0] = manager.getModelLocation("pipette.0");
|
||||
models[1] = manager.getModelLocation("pipette.1");
|
||||
manager.registerVariant(item, new ResourceLocation("forestry:pipette.0"));
|
||||
manager.registerVariant(item, new ResourceLocation("forestry:pipette.1"));
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:pipette.0"));
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:pipette.1"));
|
||||
manager.registerItemModel(item, new PipetteMeshDefinition());
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ItemPipette extends ItemForestry implements IToolPipette, IFluidCon
|
||||
contained.getContents().amount -= drained;
|
||||
|
||||
if (contained.getContents().amount <= 0) {
|
||||
pipette.setTagCompound(null);
|
||||
pipette.setTagCompound(new NBTTagCompound());
|
||||
pipette.setItemDamage(0);
|
||||
} else {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
@@ -13,11 +13,15 @@ package forestry.core.items;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
|
||||
public class ItemRegistryFluids extends ItemRegistry {
|
||||
public final ItemFluidContainerForestry canEmpty;
|
||||
public final ItemFluidContainerForestry waxCapsuleEmpty;
|
||||
@@ -26,9 +30,13 @@ public class ItemRegistryFluids extends ItemRegistry {
|
||||
private final Map<EnumContainerType, ItemFluidContainerForestry> containers = new EnumMap<>(EnumContainerType.class);
|
||||
|
||||
public ItemStack getContainer(EnumContainerType type, Fluids fluid) {
|
||||
return getContainer(type, fluid.getFluid());
|
||||
}
|
||||
|
||||
public ItemStack getContainer(EnumContainerType type, Fluid fluid) {
|
||||
ItemStack container = new ItemStack(containers.get(type));
|
||||
IFluidHandler fluidHandler = FluidUtil.getFluidHandler(container);
|
||||
fluidHandler.fill(fluid.getFluid(Integer.MAX_VALUE), true);
|
||||
fluidHandler.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ public class ItemWrench extends ItemForestry {//implements IToolWrench {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (block.rotateBlock(world, pos, side)) {
|
||||
player.swingArm(hand);
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
Block block = worldIn.getBlockState(pos).getBlock();
|
||||
if (block.rotateBlock(worldIn, pos, facing)) {
|
||||
playerIn.swingArm(hand);
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
return EnumActionResult.FAIL;
|
||||
|
||||
@@ -143,12 +143,7 @@ public class ModelManager implements IModelManager {
|
||||
public void registerItemModel(Item item, ItemMeshDefinition definition) {
|
||||
ModelLoader.setCustomMeshDefinition(item, definition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerVariant(Item item, ResourceLocation... resources) {
|
||||
ModelBakery.registerItemVariants(item, resources);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(Item item) {
|
||||
String itemName = ItemStackUtil.getItemNameFromRegistry(item).getResourcePath();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.network.packets;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -30,8 +31,8 @@ public class PacketItemStackDisplay extends PacketCoordinates implements IForest
|
||||
|
||||
public PacketItemStackDisplay() {
|
||||
}
|
||||
|
||||
public <T extends TileForestry & IItemStackDisplay> PacketItemStackDisplay(T tile, ItemStack itemStack) {
|
||||
|
||||
public <T extends TileForestry & IItemStackDisplay> PacketItemStackDisplay(T tile, @Nullable ItemStack itemStack) {
|
||||
super(tile);
|
||||
this.itemStack = itemStack;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ProxyCommon {
|
||||
public boolean isOp(EntityPlayer player) {
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
UserListOpsEntry userlistopsentry = server.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile());
|
||||
return userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel();
|
||||
return userlistopsentry != null && userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel();
|
||||
}
|
||||
|
||||
public double getBlockReachDistance(EntityPlayer entityplayer) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
@@ -42,8 +43,8 @@ public abstract class RecipeUtil {
|
||||
if (RecipeManagers.fermenterManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.0f, output.getFluid(1), Fluids.WATER.getFluid(1));
|
||||
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.0f, output.getFluid(1), new FluidStack(FluidRegistry.WATER, 1));
|
||||
|
||||
if (FluidRegistry.isFluidRegistered(Fluids.JUICE.getFluid())) {
|
||||
RecipeManagers.fermenterManager.addRecipe(resource, fermentationValue, 1.5f, output.getFluid(1), Fluids.JUICE.getFluid(1));
|
||||
|
||||
@@ -6,8 +6,9 @@ import forestry.core.utils.Translator;
|
||||
|
||||
import mezz.jei.api.gui.IDrawable;
|
||||
import mezz.jei.api.recipe.BlankRecipeCategory;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public abstract class ForestryRecipeCategory extends BlankRecipeCategory {
|
||||
public abstract class ForestryRecipeCategory<T extends IRecipeWrapper> extends BlankRecipeCategory<T> {
|
||||
@Nonnull
|
||||
private final IDrawable background;
|
||||
@Nonnull
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.jei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
public class JEIUtils {
|
||||
|
||||
public static List<ItemStack> getItemVariations(ItemStack base) {
|
||||
List<ItemStack> variations = new ArrayList<>();
|
||||
base.getItem().getSubItems(base.getItem(), null, variations);
|
||||
Iterator<ItemStack> itr = variations.iterator();
|
||||
ItemStack stack;
|
||||
while (itr.hasNext()) {
|
||||
stack = itr.next();
|
||||
if (!base.isItemEqual(stack) || !stack.hasTagCompound()) {
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
if (variations.isEmpty()) {
|
||||
return Collections.singletonList(base);
|
||||
}
|
||||
return variations;
|
||||
}
|
||||
|
||||
public static FluidStack getFluidStack(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
FluidStack fluidStack = null;
|
||||
if (stack.getItem() instanceof IFluidContainerItem) {
|
||||
fluidStack = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
|
||||
}
|
||||
if (fluidStack == null) {
|
||||
fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack);
|
||||
}
|
||||
if (fluidStack == null && Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock) {
|
||||
Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid();
|
||||
if (fluid != null) {
|
||||
fluidStack = new FluidStack(fluid, 1000);
|
||||
}
|
||||
}
|
||||
return fluidStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean areFluidsSameType(FluidStack fluidStack1, FluidStack fluidStack2) {
|
||||
if (fluidStack1 == null || fluidStack2 == null) {
|
||||
return false;
|
||||
}
|
||||
return fluidStack1.getFluid() == fluidStack2.getFluid();
|
||||
}
|
||||
}
|
||||
@@ -10,16 +10,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.render;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.InventoryEscritoire;
|
||||
import forestry.core.models.ModelEscritoire;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
@@ -27,77 +31,81 @@ import forestry.core.tiles.TileEscritoire;
|
||||
public class RenderEscritoire extends TileEntitySpecialRenderer<TileEscritoire> {
|
||||
|
||||
private static final ResourceLocation texture = new ForestryResource(Constants.TEXTURE_PATH_BLOCKS + "/escritoire.png");
|
||||
private final ModelEscritoire modelEscritoire;
|
||||
|
||||
public RenderEscritoire() {
|
||||
modelEscritoire = new ModelEscritoire();
|
||||
|
||||
}
|
||||
private final ModelEscritoire modelEscritoire = new ModelEscritoire();
|
||||
private final EntityItem dummyEntityItem = new EntityItem(null);
|
||||
private long lastTick;
|
||||
|
||||
/**
|
||||
* @param escritoire If it null its render the item else it render the tile entity.
|
||||
*/
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEscritoire escritoire, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
public void renderTileEntityAt(@Nullable TileEscritoire escritoire, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (escritoire != null) {
|
||||
IBlockState blockState = escritoire.getWorldObj().getBlockState(escritoire.getPos());
|
||||
World world = escritoire.getWorldObj();
|
||||
IBlockState blockState = world.getBlockState(escritoire.getPos());
|
||||
if (blockState != null && blockState.getBlock() instanceof BlockBase) {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
render(escritoire.getStackInSlot(InventoryEscritoire.SLOT_ANALYZE), facing, x, y, z);
|
||||
render(escritoire.getIndividualOnDisplay(), world, facing, x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render(null, EnumFacing.SOUTH, x, y, z);
|
||||
render(null, null, EnumFacing.SOUTH, x, y, z);
|
||||
}
|
||||
|
||||
private void render(ItemStack itemstack, EnumFacing orientation, double x, double y, double z) {
|
||||
|
||||
private void render(@Nullable ItemStack itemstack, @Nullable World world, EnumFacing orientation, double x, double y, double z) {
|
||||
float factor = (float) (1.0 / 16.0);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float) x + 0.5f, (float) y + 0.875f, (float) z + 0.5f);
|
||||
|
||||
float[] angle = {(float) Math.PI, 0, 0};
|
||||
|
||||
if (orientation == null) {
|
||||
orientation = EnumFacing.WEST;
|
||||
{
|
||||
GlStateManager.translate((float) x + 0.5f, (float) y + 0.875f, (float) z + 0.5f);
|
||||
|
||||
float[] angle = {(float) Math.PI, 0, 0};
|
||||
|
||||
if (orientation == null) {
|
||||
orientation = EnumFacing.WEST;
|
||||
}
|
||||
switch (orientation) {
|
||||
case EAST:
|
||||
angle[1] = (float) Math.PI / 2;
|
||||
break;
|
||||
case SOUTH:
|
||||
break;
|
||||
case NORTH:
|
||||
angle[1] = (float) Math.PI;
|
||||
break;
|
||||
case WEST:
|
||||
default:
|
||||
angle[1] = -(float) Math.PI / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
Proxies.render.bindTexture(texture);
|
||||
modelEscritoire.render(null, angle[0], angle[1], angle[2], 0f, 0f, factor);
|
||||
}
|
||||
switch (orientation) {
|
||||
case EAST:
|
||||
angle[1] = (float) Math.PI / 2;
|
||||
break;
|
||||
case SOUTH:
|
||||
break;
|
||||
case NORTH:
|
||||
angle[1] = (float) Math.PI;
|
||||
break;
|
||||
case WEST:
|
||||
default:
|
||||
angle[1] = -(float) Math.PI / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
Proxies.render.bindTexture(texture);
|
||||
modelEscritoire.render(null, angle[0], angle[1], angle[2], 0f, 0f, factor);
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
/*
|
||||
if(itemstack != null) {
|
||||
float renderScale = 1.0f;
|
||||
|
||||
if (itemstack != null && world != null) {
|
||||
dummyEntityItem.worldObj = world;
|
||||
|
||||
float renderScale = 0.75f;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float) x, (float) y, (float) z);
|
||||
GlStateManager.translate(0.6f, 0.8f, 0.5f);
|
||||
GlStateManager.rotate(90.0f, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.scale(renderScale, renderScale, renderScale);
|
||||
|
||||
RenderItem.renderInFrame = true;
|
||||
dummyEntityItem.setEntityItemStack(itemstack);
|
||||
customRenderItem.doRenderItem(dummyEntityItem, 0, 0, 0, 0, 0);
|
||||
RenderItem.renderInFrame = false;
|
||||
{
|
||||
GlStateManager.translate((float) x + 0.5f, (float) y + 0.6f, (float) z + 0.5f);
|
||||
GlStateManager.scale(renderScale, renderScale, renderScale);
|
||||
dummyEntityItem.setEntityItemStack(itemstack);
|
||||
|
||||
if (world.getTotalWorldTime() != lastTick) {
|
||||
lastTick = world.getTotalWorldTime();
|
||||
dummyEntityItem.onUpdate();
|
||||
}
|
||||
|
||||
RenderManager rendermanager = Proxies.common.getClientInstance().getRenderManager();
|
||||
rendermanager.doRenderEntity(dummyEntityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
*/
|
||||
|
||||
dummyEntityItem.worldObj = null; // prevent leaking the world object
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IRenderableTile;
|
||||
import forestry.core.tiles.TileBase;
|
||||
@@ -171,8 +172,10 @@ public class RenderMachine extends TileEntitySpecialRenderer<TileBase> {
|
||||
if (textureResourceTankLevel == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Color primaryTankColor = renderInfo.getFluidColor();
|
||||
|
||||
// TODO: render fluid overlay on tank
|
||||
Fluids fluidDefinition = Fluids.getFluidDefinition(renderInfo.getFluidStack());
|
||||
Color primaryTankColor = fluidDefinition == null ? Color.BLUE : fluidDefinition.getParticleColor();
|
||||
float[] colors = new float[3];
|
||||
primaryTankColor.getRGBColorComponents(colors);
|
||||
GlStateManager.color(colors[0], colors[1], colors[2], 1.0f);
|
||||
|
||||
@@ -11,34 +11,33 @@
|
||||
package forestry.core.render;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
|
||||
public class TankRenderInfo {
|
||||
public static final TankRenderInfo EMPTY = new TankRenderInfo(Fluids.WATER.getColor(), EnumTankLevel.EMPTY);
|
||||
public static final TankRenderInfo EMPTY = new TankRenderInfo(new FluidStack(FluidRegistry.WATER, 0), EnumTankLevel.EMPTY);
|
||||
|
||||
@Nonnull
|
||||
private final Color fluidColor;
|
||||
private final FluidStack fluidStack;
|
||||
@Nonnull
|
||||
private final EnumTankLevel level;
|
||||
|
||||
public TankRenderInfo(@Nonnull IFluidTank fluidTank) {
|
||||
this(Fluids.getFluidColor(fluidTank.getFluid()), EnumTankLevel.rateTankLevel(fluidTank));
|
||||
this(fluidTank.getFluid(), EnumTankLevel.rateTankLevel(fluidTank));
|
||||
}
|
||||
|
||||
public TankRenderInfo(@Nonnull Color fluidColor, @Nonnull EnumTankLevel level) {
|
||||
this.fluidColor = fluidColor;
|
||||
|
||||
public TankRenderInfo(@Nonnull FluidStack fluidStack, @Nonnull EnumTankLevel level) {
|
||||
this.fluidStack = fluidStack;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
public Color getFluidColor() {
|
||||
return fluidColor;
|
||||
public FluidStack getFluidStack() {
|
||||
return fluidStack;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
public EnumTankLevel getLevel() {
|
||||
return level;
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -72,10 +73,10 @@ public class EscritoireGameBoard implements INbtWritable, IStreamable {
|
||||
tokenCount = getTokenCount(genome);
|
||||
|
||||
for (int i = 0; i < tokenCount / 2; i++) {
|
||||
IIndividual token = root.templateAsIndividual(root.getRandomTemplate(rand));
|
||||
ItemStack pair = root.getMemberStack(token, root.getIconType());
|
||||
gameTokens.add(new EscritoireGameToken(pair));
|
||||
gameTokens.add(new EscritoireGameToken(pair));
|
||||
IAllele[] randomTemplate = root.getRandomTemplate(rand);
|
||||
String speciesUid = randomTemplate[root.getSpeciesChromosomeType().ordinal()].getUID();
|
||||
gameTokens.add(new EscritoireGameToken(speciesUid));
|
||||
gameTokens.add(new EscritoireGameToken(speciesUid));
|
||||
}
|
||||
Collections.shuffle(gameTokens);
|
||||
return true;
|
||||
|
||||
@@ -14,17 +14,19 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.utils.ColourUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
|
||||
@@ -41,6 +43,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
private static final String[] OVERLAY_FAILED = new String[]{"errors/errored"};
|
||||
private static final String[] OVERLAY_SELECTED = new String[]{"errors/unknown"};
|
||||
|
||||
@Nullable
|
||||
private IIndividual tokenIndividual;
|
||||
@Nullable
|
||||
private ItemStack tokenStack;
|
||||
@Nonnull
|
||||
@@ -51,8 +55,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
// required for IStreamable serialization
|
||||
}
|
||||
|
||||
public EscritoireGameToken(@Nullable ItemStack tokenStack) {
|
||||
this.tokenStack = tokenStack;
|
||||
public EscritoireGameToken(@Nullable String speciesUid) {
|
||||
setTokenSpecies(speciesUid);
|
||||
}
|
||||
|
||||
public EscritoireGameToken(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
@@ -61,8 +65,29 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
state = State.values()[stateOrdinal];
|
||||
}
|
||||
|
||||
// legacy
|
||||
if (nbttagcompound.hasKey("tokenStack")) {
|
||||
tokenStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("tokenStack"));
|
||||
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(tokenStack);
|
||||
tokenIndividual = speciesRoot.getMember(tokenStack);
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("tokenSpecies")) {
|
||||
String speciesUid = nbttagcompound.getString("tokenSpecies");
|
||||
setTokenSpecies(speciesUid);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTokenSpecies(String speciesUid) {
|
||||
IAllele allele = AlleleManager.alleleRegistry.getAllele(speciesUid);
|
||||
if (allele instanceof IAlleleSpecies) {
|
||||
IAlleleSpecies species = (IAlleleSpecies) allele;
|
||||
ISpeciesRoot root = species.getRoot();
|
||||
IAllele[] template = root.getTemplate(speciesUid);
|
||||
if (template != null) {
|
||||
this.tokenIndividual = root.templateAsIndividual(template);
|
||||
this.tokenStack = root.getMemberStack(this.tokenIndividual, root.getIconType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,12 +133,11 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
}
|
||||
|
||||
public int getTokenColour() {
|
||||
if (tokenStack == null || !isVisible()) {
|
||||
if (tokenIndividual == null || !isVisible()) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(tokenStack);
|
||||
int iconColor = individual.getGenome().getPrimary().getSpriteColour(0);
|
||||
int iconColor = tokenIndividual.getGenome().getPrimary().getSpriteColour(0);
|
||||
|
||||
if (state == State.MATCHED) {
|
||||
return ColourUtil.multiplyRGBComponents(iconColor, 0.7f);
|
||||
@@ -146,10 +170,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInteger("state", state.ordinal());
|
||||
|
||||
if (tokenStack != null) {
|
||||
NBTTagCompound stackcompound = new NBTTagCompound();
|
||||
tokenStack.writeToNBT(stackcompound);
|
||||
nbttagcompound.setTag("tokenStack", stackcompound);
|
||||
if (tokenIndividual != null) {
|
||||
nbttagcompound.setString("tokenSpecies", tokenIndividual.getGenome().getPrimary().getUID());
|
||||
}
|
||||
return nbttagcompound;
|
||||
}
|
||||
@@ -158,12 +180,20 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
@Override
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeEnum(state, State.VALUES);
|
||||
data.writeItemStack(tokenStack);
|
||||
if (tokenIndividual != null) {
|
||||
data.writeBoolean(true);
|
||||
data.writeUTF(tokenIndividual.getGenome().getPrimary().getUID());
|
||||
} else {
|
||||
data.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
state = data.readEnum(State.VALUES);
|
||||
tokenStack = data.readItemStack();
|
||||
if (data.readBoolean()) {
|
||||
String speciesUid = data.readUTF();
|
||||
setTokenSpecies(speciesUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,16 +25,20 @@ import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.gui.ContainerEscritoire;
|
||||
import forestry.core.gui.GuiEscritoire;
|
||||
import forestry.core.inventory.InventoryAnalyzer;
|
||||
import forestry.core.inventory.InventoryEscritoire;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.network.packets.PacketItemStackDisplay;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
|
||||
public class TileEscritoire extends TileBase implements ISidedInventory, ISlotPickupWatcher, IStreamableGui {
|
||||
public class TileEscritoire extends TileBase implements ISidedInventory, ISlotPickupWatcher, IStreamableGui, IItemStackDisplay {
|
||||
|
||||
private final EscritoireGame game = new EscritoireGame();
|
||||
private ItemStack individualOnDisplayClient;
|
||||
|
||||
public TileEscritoire() {
|
||||
super("escritoire");
|
||||
@@ -116,15 +120,39 @@ public class TileEscritoire extends TileBase implements ISidedInventory, ISlotPi
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
game.readData(data);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
ItemStack displayStack = getIndividualOnDisplay();
|
||||
data.writeItemStack(displayStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
super.readData(data);
|
||||
individualOnDisplayClient = data.readItemStack();
|
||||
}
|
||||
|
||||
/* ISlotPickupWatcher */
|
||||
@Override
|
||||
public void onPickupFromSlot(int slotIndex, EntityPlayer player) {
|
||||
if (slotIndex == InventoryEscritoire.SLOT_ANALYZE) {
|
||||
game.reset();
|
||||
PacketItemStackDisplay packet = new PacketItemStackDisplay(this, getIndividualOnDisplay());
|
||||
Proxies.net.sendNetworkPacket(packet, worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||
super.setInventorySlotContents(slotIndex, itemstack);
|
||||
if (slotIndex == InventoryEscritoire.SLOT_ANALYZE) {
|
||||
PacketItemStackDisplay packet = new PacketItemStackDisplay(this, getIndividualOnDisplay());
|
||||
Proxies.net.sendNetworkPacket(packet, worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiEscritoire(player, this);
|
||||
@@ -134,4 +162,19 @@ public class TileEscritoire extends TileBase implements ISidedInventory, ISlotPi
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerEscritoire(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleItemStackForDisplay(ItemStack itemStack) {
|
||||
if (!ItemStack.areItemStacksEqual(itemStack, individualOnDisplayClient)) {
|
||||
individualOnDisplayClient = itemStack;
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getIndividualOnDisplay() {
|
||||
if (worldObj.isRemote) {
|
||||
return individualOnDisplayClient;
|
||||
}
|
||||
return getStackInSlot(InventoryAnalyzer.SLOT_ANALYZE);
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,17 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.BlockOldLog;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.BlockStaticLiquid;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -31,16 +37,8 @@ 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.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
|
||||
import cofh.api.energy.IEnergyConnection;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
|
||||
public abstract class BlockUtil {
|
||||
|
||||
private static final int slabWoodId = OreDictionary.getOreID("slabWood");
|
||||
@@ -343,4 +341,17 @@ public abstract class BlockUtil {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends Comparable<T>> IProperty<T> getProperty(Block block, String propertyName, Class<T> valueClass) {
|
||||
for (IProperty<?> property : block.getDefaultState().getPropertyNames()) {
|
||||
if (property.getName().equals(propertyName)) {
|
||||
if (property.getValueClass().isAssignableFrom(valueClass)) {
|
||||
//noinspection unchecked
|
||||
return (IProperty<T>) property;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class OreDictUtil {
|
||||
public static final String FENCE_GATE_WOOD = "fenceGateWood";
|
||||
public static final String STAIR_WOOD = "stairWood";
|
||||
public static final String DOOR_WOOD = "doorWood";
|
||||
public static final String TRAPDOOR_WOOD = "trapdoorWood";
|
||||
public static final String TREE_LEAVES = "treeLeaves";
|
||||
|
||||
public static final String EMPTIED_LETTER_ORE_DICT = "emptiedLetter";
|
||||
|
||||
@@ -32,7 +32,6 @@ import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
@@ -111,7 +110,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
} else if (shutdown)
|
||||
|
||||
{
|
||||
if (heatingTank.getFluidAmount() > 0 && Fluids.LAVA.is(heatingTank.getFluid())) {
|
||||
if (heatingTank.getFluidAmount() > 0 && heatingTank.getFluid().getFluid() == FluidRegistry.LAVA) {
|
||||
addHeat(Constants.ENGINE_HEAT_VALUE_LAVA);
|
||||
heatingTank.drainInternal(1, true);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
@@ -152,7 +153,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.BIOMASS.getFluid(), new EngineBronzeFuel(Fluids.BIOMASS.getFluid(),
|
||||
Constants.ENGINE_FUEL_VALUE_BIOMASS, (int) (Constants.ENGINE_CYCLE_DURATION_BIOMASS * ForestryAPI.activeMode.getFloatSetting("fuel.biomass.biogas")), 1));
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.WATER.getFluid(), new EngineBronzeFuel(Fluids.WATER.getFluid(),
|
||||
FuelManager.bronzeEngineFuel.put(FluidRegistry.WATER, new EngineBronzeFuel(FluidRegistry.WATER,
|
||||
Constants.ENGINE_FUEL_VALUE_WATER, Constants.ENGINE_CYCLE_DURATION_WATER, 3));
|
||||
FuelManager.bronzeEngineFuel.put(Fluids.MILK.getFluid(), new EngineBronzeFuel(Fluids.MILK.getFluid(),
|
||||
Constants.ENGINE_FUEL_VALUE_MILK, Constants.ENGINE_CYCLE_DURATION_MILK, 3));
|
||||
@@ -269,8 +270,8 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.WHEAT_SEEDS)}, seedOil);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.PUMPKIN_SEEDS)}, seedOil);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.MELON_SEEDS)}, seedOil);
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{PluginCore.items.phosphor.getItemStack(2), new ItemStack(Blocks.COBBLESTONE)}, Fluids.LAVA.getFluid(1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.CACTUS)}, Fluids.WATER.getFluid(500));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{PluginCore.items.phosphor.getItemStack(2), new ItemStack(Blocks.COBBLESTONE)}, new FluidStack(FluidRegistry.LAVA, 1600));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.CACTUS)}, new FluidStack(FluidRegistry.WATER, 500));
|
||||
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.SNOWBALL), PluginCore.items.craftingMaterial.getIceShard(4)}, Fluids.ICE.getFluid(4000));
|
||||
|
||||
// STILL
|
||||
@@ -323,30 +324,30 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
"#",
|
||||
"#",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(250), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 250), null,
|
||||
PluginCore.items.woodPulp.getItemStack(4),
|
||||
"#",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(250), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 250), null,
|
||||
new ItemStack(Items.PAPER, 1),
|
||||
"#",
|
||||
"#",
|
||||
'#', "pulpWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 1000), null,
|
||||
new ItemStack(PluginCore.blocks.humus, 9),
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'#', Blocks.DIRT,
|
||||
'X', PluginCore.items.mulch);
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null,
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 1000), null,
|
||||
PluginCore.blocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, 8),
|
||||
"#X#",
|
||||
"XYX", "#X#",
|
||||
'#', Blocks.DIRT,
|
||||
'X', "sand",
|
||||
'Y', PluginCore.items.mulch);
|
||||
RecipeManagers.carpenterManager.addRecipe(75, Fluids.WATER.getFluid(5000), null, PluginCore.items.hardenedCasing.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(75, new FluidStack(FluidRegistry.WATER, 5000), null, PluginCore.items.hardenedCasing.getItemStack(),
|
||||
"# #",
|
||||
" Y ",
|
||||
"# #",
|
||||
@@ -355,21 +356,21 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
|
||||
// / CHIPSETS
|
||||
ItemCircuitBoard circuitBoard = PluginCore.items.circuitboards;
|
||||
RecipeManagers.carpenterManager.addRecipe(20, Fluids.WATER.getFluid(1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.BASIC, null, new ICircuit[]{}),
|
||||
RecipeManagers.carpenterManager.addRecipe(20, new FluidStack(FluidRegistry.WATER, 1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.BASIC, null, new ICircuit[]{}),
|
||||
"R R", "R#R", "R R", '#', "ingotTin", 'R', "dustRedstone");
|
||||
RecipeManagers.carpenterManager.addRecipe(40, Fluids.WATER.getFluid(1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.ENHANCED, null, new ICircuit[]{}),
|
||||
RecipeManagers.carpenterManager.addRecipe(40, new FluidStack(FluidRegistry.WATER, 1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.ENHANCED, null, new ICircuit[]{}),
|
||||
"R#R", "R#R", "R#R", '#', "ingotBronze", 'R', "dustRedstone");
|
||||
RecipeManagers.carpenterManager.addRecipe(80, Fluids.WATER.getFluid(1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.REFINED, null, new ICircuit[]{}),
|
||||
RecipeManagers.carpenterManager.addRecipe(80, new FluidStack(FluidRegistry.WATER, 1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.REFINED, null, new ICircuit[]{}),
|
||||
"R#R", "R#R", "R#R", '#', "ingotIron", 'R', "dustRedstone");
|
||||
RecipeManagers.carpenterManager.addRecipe(80, Fluids.WATER.getFluid(1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.INTRICATE, null, new ICircuit[]{}),
|
||||
RecipeManagers.carpenterManager.addRecipe(80, new FluidStack(FluidRegistry.WATER, 1000), null, ItemCircuitBoard.createCircuitboard(EnumCircuitBoardType.INTRICATE, null, new ICircuit[]{}),
|
||||
"R#R", "R#R", "R#R", '#', "ingotGold", 'R', "dustRedstone");
|
||||
RecipeManagers.carpenterManager.addRecipe(40, Fluids.WATER.getFluid(1000), null, PluginCore.items.solderingIron.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(40, new FluidStack(FluidRegistry.WATER, 1000), null, PluginCore.items.solderingIron.getItemStack(),
|
||||
" # ", "# #", " B", '#', "ingotIron", 'B', "ingotBronze");
|
||||
|
||||
// RAIN SUBSTRATES
|
||||
ItemRegistryApiculture beeItems = PluginApiculture.items;
|
||||
if (beeItems != null) {
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.items.iodineCharge.getItemStack(),
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 1000), null, PluginCore.items.iodineCharge.getItemStack(),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -377,7 +378,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', Items.GUNPOWDER,
|
||||
'Y', PluginFluids.items.canEmpty,
|
||||
'Z', beeItems.honeyDrop);
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.items.craftingMaterial.getDissipationCharge(),
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 1000), null, PluginCore.items.craftingMaterial.getDissipationCharge(),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -392,14 +393,14 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
PluginCore.items.craftingMaterial.getPulsatingMesh());
|
||||
|
||||
// Woven Silk
|
||||
RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(500), null, PluginCore.items.craftingMaterial.getWovenSilk(),
|
||||
RecipeManagers.carpenterManager.addRecipe(10, new FluidStack(FluidRegistry.WATER, 500), null, PluginCore.items.craftingMaterial.getWovenSilk(),
|
||||
"###",
|
||||
"###",
|
||||
"###",
|
||||
'#', PluginCore.items.craftingMaterial.getSilkWisp());
|
||||
|
||||
// Boxes
|
||||
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.items.carton.getItemStack(2),
|
||||
RecipeManagers.carpenterManager.addRecipe(5, new FluidStack(FluidRegistry.WATER, 1000), null, PluginCore.items.carton.getItemStack(2),
|
||||
" # ", "# #", " # ", '#', "pulpWood");
|
||||
|
||||
// Assembly Kits
|
||||
|
||||
@@ -29,6 +29,10 @@ public class FermenterRecipe implements IFermenterRecipe {
|
||||
if (resource == null) {
|
||||
throw new NullPointerException("Fermenter Resource cannot be null!");
|
||||
}
|
||||
|
||||
if (resource.getItem() == null) {
|
||||
throw new NullPointerException("Fermenter Resource item cannot be null!");
|
||||
}
|
||||
|
||||
if (output == null) {
|
||||
throw new NullPointerException("Fermenter Output cannot be null!");
|
||||
|
||||
@@ -17,11 +17,11 @@ import java.util.Set;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import forestry.api.recipes.IFermenterManager;
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class FermenterRecipeManager implements IFermenterManager {
|
||||
@@ -38,7 +38,7 @@ public class FermenterRecipeManager implements IFermenterManager {
|
||||
|
||||
@Override
|
||||
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output) {
|
||||
addRecipe(resource, fermentationValue, modifier, output, Fluids.WATER.getFluid(1000));
|
||||
addRecipe(resource, fermentationValue, modifier, output, new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
public static IFermenterRecipe findMatchingRecipe(ItemStack res, FluidStack liqu) {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class FactoryJeiPlugin extends BlankModPlugin {
|
||||
registry.addRecipes(CarpenterRecipeMaker.getCarpenterRecipes());
|
||||
registry.addRecipes(CentrifugeRecipeMaker.getCentrifugeRecipe());
|
||||
registry.addRecipes(FabricatorRecipeMaker.getFabricatorRecipes());
|
||||
registry.addRecipes(FermenterRecipeMaker.getFermenterRecipes());
|
||||
registry.addRecipes(FermenterRecipeMaker.getFermenterRecipes(jeiHelpers.getStackHelper()));
|
||||
registry.addRecipes(MoistenerRecipeMaker.getMoistenerRecipes());
|
||||
registry.addRecipes(RainmakerRecipeMaker.getRecipes());
|
||||
registry.addRecipes(SqueezerRecipeMaker.getSqueezerRecipes());
|
||||
|
||||
@@ -23,7 +23,7 @@ import mezz.jei.api.gui.IGuiItemStackGroup;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||
|
||||
public class FermenterRecipeCategory extends ForestryRecipeCategory {
|
||||
public class FermenterRecipeCategory extends ForestryRecipeCategory<FermenterRecipeWrapper> {
|
||||
|
||||
private static final int resourceSlot = 0;
|
||||
private static final int fuelSlot = 1;
|
||||
@@ -62,7 +62,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper) {
|
||||
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull FermenterRecipeWrapper recipeWrapper) {
|
||||
IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks();
|
||||
IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks();
|
||||
|
||||
@@ -72,18 +72,15 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory {
|
||||
guiFluidStacks.init(inputTank, true, 1, 1, 16, 58, 3000, false, tankOverlay);
|
||||
guiFluidStacks.init(outputTank, false, 91, 1, 16, 58, 3000, false, tankOverlay);
|
||||
|
||||
FermenterRecipeWrapper wrapper = (FermenterRecipeWrapper) recipeWrapper;
|
||||
|
||||
guiItemStacks.set(resourceSlot, wrapper.getFermentable());
|
||||
guiItemStacks.set(resourceSlot, recipeWrapper.getFermentable());
|
||||
List<ItemStack> fuels = new ArrayList<>();
|
||||
for (FermenterFuel fuel : FuelManager.fermenterFuel.values()) {
|
||||
fuels.add(fuel.item);
|
||||
}
|
||||
guiItemStacks.set(fuelSlot, fuels);
|
||||
|
||||
guiFluidStacks.set(inputTank, wrapper.getFluidInputs());
|
||||
guiFluidStacks.set(outputTank, wrapper.getFluidOutputs());
|
||||
|
||||
guiFluidStacks.set(inputTank, recipeWrapper.getFluidInputs());
|
||||
guiFluidStacks.set(outputTank, recipeWrapper.getFluidOutputs());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,22 +8,29 @@ import net.minecraft.item.ItemStack;
|
||||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.IVariableFermentable;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.jei.JEIUtils;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.factory.recipes.jei.FactoryJeiPlugin;
|
||||
|
||||
import mezz.jei.api.recipe.IStackHelper;
|
||||
|
||||
public class FermenterRecipeMaker {
|
||||
|
||||
private FermenterRecipeMaker() {
|
||||
}
|
||||
|
||||
public static List<FermenterRecipeWrapper> getFermenterRecipes() {
|
||||
public static List<FermenterRecipeWrapper> getFermenterRecipes(IStackHelper stackHelper) {
|
||||
List<FermenterRecipeWrapper> recipes = new ArrayList<>();
|
||||
for (IFermenterRecipe recipe : RecipeManagers.fermenterManager.recipes()) {
|
||||
if (recipe.getResource() != null && recipe.getResource().getItem() instanceof IVariableFermentable) {
|
||||
for (ItemStack stack : JEIUtils.getItemVariations(recipe.getResource())) {
|
||||
recipes.add(new FermenterRecipeWrapper(recipe, stack));
|
||||
if (recipe.getResource() != null) {
|
||||
if (recipe.getResource().getItem() instanceof IVariableFermentable) {
|
||||
for (ItemStack stack : stackHelper.getSubtypes(recipe.getResource())) {
|
||||
recipes.add(new FermenterRecipeWrapper(recipe, stack));
|
||||
}
|
||||
} else {
|
||||
recipes.add(new FermenterRecipeWrapper(recipe, recipe.getResource()));
|
||||
}
|
||||
} else {
|
||||
recipes.add(new FermenterRecipeWrapper(recipe, recipe.getResource()));
|
||||
Log.error("Null resource for recipe");
|
||||
}
|
||||
}
|
||||
return recipes;
|
||||
|
||||
Loaded 100 of 147 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user