Compare commits

...
46 Commits
Author SHA1 Message Date
mezz c0a22f4a28 Split mutationCustom into mutationBuilder and Mutation
Remove EntityBee
Update MutationConditionRequiresResource to use blockState
2016-06-17 15:20:19 -07:00
mezz 41c6fb15b3 Make escritoire convert vanilla saplings for analysis 2016-06-17 15:17:43 -07:00
mezz b5d65e83f0 Render floating sapling over Escritoire when in use 2016-06-17 15:17:43 -07:00
mezz 1a7c148a7e Update JEI 2016-06-16 18:55:53 -07:00
mezz ead630aa51 Clean up fluids a bit 2016-06-16 14:50:57 -07:00
mezz 85b71c785a Fix colored fluid drip particles 2016-06-16 14:43:18 -07:00
mezz 04cb58dfa2 Use FluidRegistry Water and Lava 2016-06-16 14:38:12 -07:00
mezz 3822e90ada Fix #1299 use dynamic textures for fluid containers 2016-06-16 14:03:30 -07:00
mezz af5cb93689 Use ModelBakery directly, less layers of abstraction 2016-06-16 13:58:03 -07:00
mezz 6a62024dd4 Fix wrench rotation handling 2016-06-15 16:26:57 -07:00
mezz bedb7ffe85 Fix the save bee stats command 2016-06-15 16:04:53 -07:00
mezz 4a21641bcd Fix backpacks trying to interact with inventories in a sided way 2016-06-15 16:04:38 -07:00
mezz 21d0b832b9 Fix crash when mods ask for the inventory without a specific side 2016-06-15 00:03:20 -07:00
mezz ce9081249f Fix compatibility with Chisels & Bits 2016-06-14 16:17:12 -07:00
mezz f6786cd44a Fix #1289 Trade station price can show a negative stack in catalog 2016-06-13 23:08:34 -07:00
mezz a045c18a89 Fix #1300 Crash in CharcoalPileRenderer with WAILA 2016-06-13 21:43:54 -07:00
mezz d6af85ad77 Fix #1314 Crash with WAILA when looking at broken leaves 2016-06-13 21:39:28 -07:00
mezz af55bd86a2 Fix #1322 JEI missing most squeezer recipes 2016-06-13 21:33:32 -07:00
mezz 7aa840282f Fix #1229 Squeezer Recipes in JEI do not show chance % 2016-06-13 21:32:19 -07:00
mezz a5d57c4788 Add villager name localization 2016-06-13 21:30:54 -07:00
mezz 4d0c2d1ea2 Fix all hives spawning with the same flower pattern around them 2016-06-13 20:46:23 -07:00
mezz 840331b7d5 Refresh bee errors when queen is replaced or gui is opened 2016-06-13 19:21:42 -07:00
mezz df91b47b35 Fix missing import for SoundEvent on chest 2016-06-13 15:28:01 -07:00
mezz f400241ff4 Revert greenhouse climate changes. Close #1319 2016-06-13 15:27:19 -07:00
Nedelosk 8639148f20 Fix #1318 1.9.4 Crash with .153 version on world load 2016-06-13 22:56:29 +02:00
Nedelosk 28e7b561ea Fix a bug 2016-06-13 22:14:03 +02:00
Nedelosk ba7ef4228c Update PluginBiomesOPlenty.java 2016-06-13 21:54:53 +02:00
Nedelosk fcd3ee6feb Merge branch 'mc-1.9.4' of https://github.com/ForestryMC/ForestryMC into Greenhouse-Climate-Fix 2016-06-13 21:49:05 +02:00
The-Fireplace 6ddc9f3079 Fixed chests playing the open sound when they close (#1316) 2016-06-12 14:09:31 -07:00
Nedelosk cc53894473 Finish work 2016-06-12 20:42:09 +02:00
Nedelosk 2cd76bdad7 Rework sytem 2016-06-12 01:16:25 +02:00
mezz 92eab8d47a Fix #1308 Restore compatibility with old fluid pipes 2016-06-09 18:35:12 -07:00
mezz 12f5d7be6c Revert "Fix rare possible npe in random hive trade"
This reverts commit 4ba3370fc9.
2016-06-09 16:36:32 -07:00
mezz ab88e7d57c Fix #1311 Crash with WAILA and butterfly or using butterfly kill command 2016-06-09 16:35:33 -07:00
Nedelosk 725d85181d Update System 2016-06-09 21:50:43 +02:00
Nedelosk 23c9b2071b Clen Up and work on climate system 2016-06-09 20:19:13 +02:00
Nedelosk ae025a92fc Clean Up, Work on climate system 2016-06-08 21:58:10 +02:00
Nedelosk fbf30b1a73 Work on new climate system for the greenhouse 2016-06-08 19:25:18 +02:00
Nirek-K 4ba3370fc9 Fix rare possible npe in random hive trade 2016-06-08 11:07:16 -05:00
mezz c1a590961d Cleanup unused fields 2016-06-07 23:40:58 -07:00
mezz a1f7a678c1 Use ForgeRegistries instead of Item and Block registries 2016-06-07 23:40:33 -07:00
mezz 1117b820f1 Update to latest version of JEI 2016-06-07 23:34:01 -07:00
mezz 4681bf4cfb Update Chinese localization 2016-06-07 23:33:05 -07:00
Nirek-K b9dd19a556 Make hive bee trade a random one 2016-06-07 23:49:05 -05:00
Nirek-K f97a737185 Migrate new 1.7 villager trades, fix ic2 uid 2016-06-07 20:18:36 -05:00
mezz 68fb27410e #1295 Add Forestry recipes to the RecipeSorter 2016-06-06 19:00:44 -07:00
130 changed files with 817 additions and 697 deletions

No files matched your search

+3 -3
View File
@@ -1,10 +1,10 @@
mcversion=1.9.4
forgeversion=12.17.0.1950
forgeversion=12.17.0.1957
mcp_mappings=snapshot_20160525
jei_version=3.4.0.+
jei_version=3.6.4.+
ic2_version=2.5.5-ex19
version_major=5
version_minor=0
version_patch=9
version_patch=18
+1 -1
Submodule lang updated: 50cc3f6cfc...9be86d3c99.
+1
View File
@@ -57,6 +57,7 @@ import forestry.plugins.PluginManager;
+ "after:IC2@[2.3.235,);"
+ "after:Natura@[2.2.0,);"
+ "after:HardcoreEnderExpansion;"
+ "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,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);
}
@@ -36,6 +36,12 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
*/
void doWork();
/**
* Force the logic to refresh any cached values and error states.
* Call this when a player opens the gui so that all errors are up to date.
*/
void clearCachedValues();
/* CLIENT */
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.apiculture.hives;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -46,5 +48,5 @@ public interface IHiveDescription {
* Called after successful hive generation.
* world, x, y, z give the location of the new hive.
**/
void postGen(World world, BlockPos pos);
void postGen(World world, Random rand, BlockPos pos);
}
@@ -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
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.recipes;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -24,6 +26,7 @@ public interface ISqueezerRecipe extends IForestryRecipe {
/**
* @return Item stack representing the possible remnants from this recipe. (i.e. tin left over from tin cans)
*/
@Nullable
ItemStack getRemnants();
/**
@@ -197,6 +197,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
if (!ItemStack.areItemStacksEqual(this.queenStack, queenStack)) {
this.queen = BeeManager.beeRoot.getMember(queenStack);
this.queenStack = queenStack;
hasFlowersCache.clear();
queenCanWorkCache.clear();
}
if (errorLogic.setCondition(queen == null, EnumErrorCode.NO_QUEEN)) {
@@ -235,6 +237,13 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
}
}
@Override
public void clearCachedValues() {
hasFlowersCache.clear();
queenCanWorkCache.clear();
canWork();
}
private void queenWorkTick(IBee queen) {
if (queen == null) {
beeProgress = 0;
@@ -505,6 +514,11 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
return queenCanWorkCached;
}
public void clear() {
queenCanWorkCached.clear();
queenCanWorkCooldown = 0;
}
}
private static class PollenHandler {
@@ -37,6 +37,11 @@ public class FakeBeekeepingLogic implements IBeekeepingLogic {
}
@Override
public void clearCachedValues() {
}
@Override
public void syncToClient() {
@@ -97,6 +97,11 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
return returnVal;
}
public void clear() {
flowerCoords.clear();
cooldown = 0;
}
@Nonnull
public List<BlockPos> getFlowerCoords() {
return Collections.unmodifiableList(flowerCoords);
@@ -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;
@@ -130,16 +129,12 @@ public class PluginApiculture extends BlankForestryPlugin {
public static String beekeepingMode = "NORMAL";
private static float secondPrincessChance = 0;
public static final int ticksPerBeeWorkCycle = 550;
public static boolean fancyRenderedBees = false;
public static ItemRegistryApiculture items;
public static BlockRegistryApiculture blocks;
public static HiveRegistry hiveRegistry;
private final Map<String, String[]> defaultAcceptedFlowers = new HashMap<>();
private final Map<String, String[]> defaultPlantableFlowers = new HashMap<>();
public static VillagerRegistry.VillagerProfession villagerApiarist;
@Override
@@ -275,9 +270,12 @@ public class PluginApiculture extends BlankForestryPlugin {
villagerRegistry.register(villagerApiarist);
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
ItemStack wildcardDrone = new ItemStack(items.beeDroneGE, 1);
ItemStack apiary = new ItemStack(blocks.apiary);
ItemStack provenFrames = items.frameProven.getItemStack();
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
ItemStack endDrone = BeeDefinition.ENDED.getMemberStack(EnumBeeType.DRONE);
ItemStack propolis = new ItemStack(PluginApiculture.items.propolis,1);
VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist");
apiaristCareer.addTrade(1,
@@ -287,14 +285,16 @@ public class PluginApiculture extends BlankForestryPlugin {
);
apiaristCareer.addTrade(2,
new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 4), new ItemStack(items.smoker), null),
new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2))
new VillagerTradeLists.GiveItemForLogsAndEmeralds(apiary, new EntityVillager.PriceInfo(1, 1), new EntityVillager.PriceInfo(16, 32), new EntityVillager.PriceInfo(1, 2)),
new VillagerApiaristTrades.GiveRandomHiveDroneForItems(propolis, null, wildcardDrone, new EntityVillager.PriceInfo(2, 4))
);
apiaristCareer.addTrade(3,
new VillagerTradeLists.GiveEmeraldForItems(wildcardPrincess, null),
new VillagerTradeLists.GiveItemForEmeralds(new EntityVillager.PriceInfo(1, 2), provenFrames, new EntityVillager.PriceInfo(1, 6))
);
apiaristCareer.addTrade(4,
new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null)
new VillagerTradeLists.GiveItemForItemAndEmerald(wildcardPrincess, null, new EntityVillager.PriceInfo(10, 64), monasticDrone, null),
new VillagerTradeLists.GiveItemForTwoItems(wildcardPrincess, null,new ItemStack(Items.ENDER_EYE),new EntityVillager.PriceInfo(12, 16),endDrone, null)
);
}
@@ -559,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(),
@@ -570,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());
@@ -9,6 +9,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import forestry.api.apiculture.EnumBeeType;
import forestry.apiculture.genetics.BeeDefinition;
public class VillagerApiaristTrades {
public static class GiveRandomCombsForItems implements EntityVillager.ITradeList {
@@ -42,5 +45,46 @@ public class VillagerApiaristTrades {
recipeList.add(new MerchantRecipe(itemToBuy, randomComb));
}
}
public static class GiveRandomHiveDroneForItems implements EntityVillager.ITradeList {
@Nonnull
public ItemStack buyingItemStack;
@Nullable
public EntityVillager.PriceInfo buyingPriceInfo;
@Nonnull
public ItemStack buyingItemStackTwo;
@Nullable
public EntityVillager.PriceInfo buyingPriceItemTwoInfo;
public GiveRandomHiveDroneForItems(
@Nonnull ItemStack buyingItemStack,
@Nullable EntityVillager.PriceInfo buyingPriceInfo,
@Nonnull ItemStack buyingItemStackTwo,
@Nullable EntityVillager.PriceInfo buyingPriceItemTwoInfo) {
this.buyingItemStack = buyingItemStack;
this.buyingPriceInfo = buyingPriceInfo;
this.buyingItemStackTwo = buyingItemStackTwo;
this.buyingPriceItemTwoInfo = buyingPriceItemTwoInfo;
}
@Override
public void modifyMerchantRecipeList(@Nonnull MerchantRecipeList recipeList, @Nonnull Random random) {
int buyAmount = 1;
if (this.buyingPriceInfo != null) {
buyAmount = this.buyingPriceInfo.getPrice(random);
}
int buyTwoAmount = 1;
if (this.buyingPriceItemTwoInfo != null) {
buyTwoAmount = this.buyingPriceItemTwoInfo.getPrice(random);
}
BeeDefinition [] forestryMundane = new BeeDefinition[] { BeeDefinition.FOREST, BeeDefinition.MEADOWS, BeeDefinition.MODEST, BeeDefinition.WINTRY, BeeDefinition.TROPICAL, BeeDefinition.MARSHY };
ItemStack randomHiveDrone = forestryMundane[random.nextInt(forestryMundane.length)].getMemberStack(EnumBeeType.DRONE);
ItemStack buyItemStack = this.buyingItemStack.copy();
buyItemStack.stackSize = buyAmount;
ItemStack buyItemStackTwo = this.buyingItemStackTwo.copy();
buyItemStackTwo.stackSize = buyTwoAmount;
recipeList.add(new MerchantRecipe(buyItemStack, buyItemStackTwo, randomHiveDrone));
}
}
}
@@ -1,15 +1,19 @@
package forestry.apiculture.compat;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IAlleleSpecies;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.genetics.BeeGenome;
import mezz.jei.api.BlankModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.JEIPlugin;
@JEIPlugin
@@ -34,5 +38,21 @@ public class ApicultureJeiPlugin extends BlankModPlugin {
registry.addDescription(new ItemStack(PluginApiculture.items.habitatLocator), "for.jei.description.habitat.locator");
registry.addDescription(new ItemStack(PluginApiculture.items.scoop), "for.jei.description.scoop");
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 BeeSubtypeInterpreter implements ISubtypeRegistry.ISubtypeInterpreter {
public static BeeSubtypeInterpreter INSTANCE = new BeeSubtypeInterpreter();
@Nullable
@Override
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;
}
}
@@ -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;
}
}
@@ -22,6 +22,8 @@ public class ContainerAlveary extends ContainerTile<TileAlveary> {
public ContainerAlveary(InventoryPlayer player, TileAlveary tile) {
super(tile, player, 8, 108);
ContainerBeeHelper.addSlots(this, tile, false);
tile.getBeekeepingLogic().clearCachedValues();
}
private int beeProgress = -1;
@@ -22,6 +22,8 @@ public class ContainerBeeHousing extends ContainerTile<TileBeeHousingBase> imple
public ContainerBeeHousing(InventoryPlayer player, TileBeeHousingBase tile, boolean hasFrames) {
super(tile, player, 8, 108);
ContainerBeeHelper.addSlots(this, tile, hasFrames);
tile.getBeekeepingLogic().clearCachedValues();
}
private int beeProgress = -1;
@@ -21,6 +21,8 @@ public class ContainerMinecartBeehouse extends ContainerEntity<EntityMinecartBee
public ContainerMinecartBeehouse(InventoryPlayer player, EntityMinecartBeeHousingBase entity, boolean hasFrames) {
super(entity, player, 8, 108);
ContainerBeeHelper.addSlots(this, entity, hasFrames);
entity.getBeekeepingLogic().clearCachedValues();
}
private int beeProgress = -1;
@@ -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);
@@ -137,7 +137,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
int x = getPos().getX() + worldObj.rand.nextInt(40 * 2) - 40;
int z = getPos().getZ() + worldObj.rand.nextInt(40 * 2) - 40;
if (HiveDecorator.tryGenHive(worldObj, x, z, hive)) {
if (HiveDecorator.tryGenHive(worldObj, worldObj.rand, x, z, hive)) {
pendingSpawns.pop();
}
}
@@ -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();
}
}
@@ -13,6 +13,7 @@ package forestry.apiculture.worldgen;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
@@ -52,8 +53,8 @@ public final class Hive {
return hiveDescription.getGenChance();
}
public void postGen(World world, BlockPos pos) {
hiveDescription.postGen(world, pos);
public void postGen(World world, Random rand, BlockPos pos) {
hiveDescription.postGen(world, rand, pos);
}
public boolean isGoodBiome(Biome biome) {
@@ -48,7 +48,7 @@ public abstract class HiveDecorator {
List<Hive> hives = PluginApiculture.hiveRegistry.getHives();
if (Config.generateBeehivesDebug) {
decorateHivesDebug(world, chunkX, chunkZ, hives);
decorateHivesDebug(world, rand, chunkX, chunkZ, hives);
return;
}
@@ -72,7 +72,7 @@ public abstract class HiveDecorator {
for (Hive hive : hives) {
if (hive.genChance() * Config.getBeehivesAmount() >= rand.nextFloat() * 100.0f) {
if (hive.isGoodBiome(biome) && hive.isGoodHumidity(humidity)) {
if (tryGenHive(world, x, z, hive)) {
if (tryGenHive(world, rand, x, z, hive)) {
return;
}
}
@@ -81,7 +81,7 @@ public abstract class HiveDecorator {
}
}
private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> hives) {
private static void decorateHivesDebug(World world, Random rand, int chunkX, int chunkZ, List<Hive> hives) {
int worldX = (chunkX << 4) + 8;
int worldZ = (chunkZ << 4) + 8;
Biome biome = world.getBiome(new BlockPos(chunkX, 0, chunkZ));
@@ -95,13 +95,13 @@ public abstract class HiveDecorator {
continue;
}
tryGenHive(world, worldX + x, worldZ + z, hive);
tryGenHive(world, rand, worldX + x, worldZ + z, hive);
}
}
}
}
public static boolean tryGenHive(World world, int x, int z, Hive hive) {
public static boolean tryGenHive(World world, Random rand, int x, int z, Hive hive) {
final BlockPos hivePos = hive.getPosForHive(world, x, z);
@@ -123,10 +123,10 @@ public abstract class HiveDecorator {
return false;
}
return setHive(world, hivePos, hive);
return setHive(world, rand, hivePos, hive);
}
private static boolean setHive(World world, BlockPos pos, Hive hive) {
private static boolean setHive(World world, Random rand, BlockPos pos, Hive hive) {
IBlockState hiveState = hive.getHiveBlockState();
Block hiveBlock = hiveState.getBlock();
boolean placed = world.setBlockState(pos, hiveState, Constants.FLAG_BLOCK_SYNC);
@@ -143,7 +143,7 @@ public abstract class HiveDecorator {
hiveBlock.onBlockAdded(world, pos, state);
if (!Config.generateBeehivesDebug) {
hive.postGen(world, pos);
hive.postGen(world, rand, pos);
}
if (Config.logHivePlacement) {
@@ -13,6 +13,7 @@ package forestry.apiculture.worldgen;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
@@ -41,23 +42,23 @@ public enum HiveDescription implements IHiveDescription {
FOREST(IHiveRegistry.HiveType.FOREST, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, rand, pos, flowerStates);
}
},
MEADOWS(IHiveRegistry.HiveType.MEADOWS, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, rand, pos, flowerStates);
}
},
DESERT(IHiveRegistry.HiveType.DESERT, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, cactusStates);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, rand, pos, cactusStates);
}
},
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
@@ -69,21 +70,21 @@ public enum HiveDescription implements IHiveDescription {
},
SNOW(IHiveRegistry.HiveType.SNOW, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) {
@Override
public void postGen(World world, BlockPos pos) {
public void postGen(World world, Random rand, BlockPos pos) {
BlockPos posAbove = pos.up();
if (world.isAirBlock(posAbove)) {
world.setBlockState(posAbove, Blocks.SNOW_LAYER.getDefaultState(), Constants.FLAG_BLOCK_SYNC);
}
postGenFlowers(world, pos, flowerStates);
postGenFlowers(world, rand, pos, flowerStates);
}
},
SWAMP(IHiveRegistry.HiveType.SWAMP, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
public void postGen(World world, Random rand, BlockPos pos) {
super.postGen(world, rand, pos);
postGenFlowers(world, pos, mushroomStates);
postGenFlowers(world, rand, pos, mushroomStates);
}
};
@@ -146,15 +147,15 @@ public enum HiveDescription implements IHiveDescription {
}
@Override
public void postGen(World world, BlockPos pos) {
public void postGen(World world, Random rand, BlockPos pos) {
}
protected static void postGenFlowers(World world, BlockPos hivePos, List<IBlockState> flowerStates) {
protected static void postGenFlowers(World world, Random rand, BlockPos hivePos, List<IBlockState> flowerStates) {
int plantedCount = 0;
for (int i = 0; i < 10; i++) {
int xOffset = world.rand.nextInt(8) - 4;
int zOffset = world.rand.nextInt(8) - 4;
int xOffset = rand.nextInt(8) - 4;
int zOffset = rand.nextInt(8) - 4;
BlockPos blockPos = hivePos.add(xOffset, 0, zOffset);
if ((xOffset == 0 && zOffset == 0) || !world.isBlockLoaded(blockPos)) {
continue;
@@ -165,7 +166,7 @@ public enum HiveDescription implements IHiveDescription {
continue;
}
IBlockState state = flowerStates.get(world.rand.nextInt(flowerStates.size()));
IBlockState state = flowerStates.get(rand.nextInt(flowerStates.size()));
Block block = state.getBlock();
if (!block.canPlaceBlockAt(world, blockPos)) {
continue;
@@ -12,6 +12,7 @@ package forestry.apiculture.worldgen;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -68,7 +69,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription {
}
@Override
public void postGen(World world, BlockPos pos) {
public void postGen(World world, Random rand, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileHive) {
((TileHive) tile).setContained(bees);
@@ -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));
}
@@ -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;
@@ -59,11 +60,6 @@ public class BlockForestryFenceGate<T extends Enum<T> & IWoodType> extends Block
setCreativeTab(Tabs.tabArboriculture);
}
@Override
public Material getMaterial(IBlockState state) {
return MaterialArbWood.ARB_WOOD;
}
@Override
public boolean isFireproof() {
return fireproof;
@@ -124,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));
}
}
@@ -214,17 +214,16 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
@Override
public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) {
String speciesUid = TreeDefinition.Oak.getUID();
TileLeaves leaves = TileUtil.getTile(world, pos, TileLeaves.class);
if (leaves == null) {
return null;
if (leaves != null) {
ITree tree = leaves.getTree();
if (tree != null) {
speciesUid = tree.getGenome().getPrimary().getUID();
}
}
ITree tree = leaves.getTree();
if (tree == null) {
return null;
}
String speciesUid = tree.getGenome().getPrimary().getUID();
return Collections.singletonList(PluginArboriculture.blocks.getDecorativeLeaves(speciesUid));
}
@@ -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;
@@ -38,16 +39,11 @@ public class BlockForestryStairs<T extends Enum<T> & IWoodType> extends BlockSta
setHarvestLevel("axe", 0);
}
@Override
public Material getMaterial(IBlockState state) {
return MaterialArbWood.ARB_WOOD;
}
/* MODELS */
@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));
}
@@ -1,15 +0,0 @@
package forestry.arboriculture.blocks;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
public class MaterialArbWood extends Material {
public static final Material ARB_WOOD = new MaterialArbWood();
private MaterialArbWood() {
super(MapColor.WOOD);
setBurning();
}
}
@@ -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;
@@ -35,7 +36,6 @@ import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.blocks.MaterialArbWood;
import forestry.arboriculture.blocks.WoodTypeStateMapper;
import forestry.arboriculture.blocks.property.PropertyWoodType;
import forestry.core.proxy.Proxies;
@@ -48,7 +48,7 @@ public abstract class BlockForestryFence<T extends Enum<T> & IWoodType> extends
private final int blockNumber;
protected BlockForestryFence(boolean fireproof, int blockNumber) {
super(MaterialArbWood.ARB_WOOD, BlockPlanks.EnumType.OAK.getMapColor());
super(Material.WOOD, BlockPlanks.EnumType.OAK.getMapColor());
this.fireproof = fireproof;
this.blockNumber = blockNumber;
@@ -104,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;
@@ -29,7 +30,6 @@ import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.blocks.MaterialArbWood;
import forestry.arboriculture.blocks.WoodTypeStateMapper;
import forestry.arboriculture.blocks.property.PropertyWoodType;
import forestry.core.proxy.Proxies;
@@ -67,11 +67,6 @@ public abstract class BlockForestryLog<T extends Enum<T> & IWoodType> extends Bl
return blockNumber;
}
@Override
public final Material getMaterial(IBlockState state) {
return MaterialArbWood.ARB_WOOD;
}
private static EnumAxis getAxis(int meta) {
switch (meta & 12) {
case 0:
@@ -187,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));
}
@@ -6,8 +6,10 @@ import java.util.List;
import net.minecraft.block.Block;
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;
@@ -29,7 +31,6 @@ import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.blocks.MaterialArbWood;
import forestry.arboriculture.blocks.WoodTypeStateMapper;
import forestry.arboriculture.blocks.property.PropertyWoodType;
import forestry.core.proxy.Proxies;
@@ -42,7 +43,7 @@ public abstract class BlockForestryPlanks<T extends Enum<T> & IWoodType> extends
private final int blockNumber;
protected BlockForestryPlanks(boolean fireproof, int blockNumber) {
super(MaterialArbWood.ARB_WOOD);
super(Material.WOOD);
this.fireproof = fireproof;
this.blockNumber = blockNumber;
@@ -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));
}
@@ -7,9 +7,11 @@ import java.util.Random;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
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;
@@ -30,7 +32,6 @@ import forestry.api.core.IStateMapperRegister;
import forestry.api.core.Tabs;
import forestry.arboriculture.IWoodTyped;
import forestry.arboriculture.WoodHelper;
import forestry.arboriculture.blocks.MaterialArbWood;
import forestry.arboriculture.blocks.WoodTypeStateMapper;
import forestry.arboriculture.blocks.property.PropertyWoodType;
import forestry.core.proxy.Proxies;
@@ -43,7 +44,7 @@ public abstract class BlockForestrySlab<T extends Enum<T> & IWoodType> extends B
private final int blockNumber;
protected BlockForestrySlab(boolean fireproof, int blockNumber) {
super(MaterialArbWood.ARB_WOOD);
super(Material.WOOD);
this.fireproof = fireproof;
this.blockNumber = blockNumber;
@@ -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));
}
@@ -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"));
}
}
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.arboriculture.render;
import javax.annotation.Nonnull;
import static forestry.arboriculture.multiblock.EnumPilePosition.BACK;
import static forestry.arboriculture.multiblock.EnumPilePosition.CORNER_BACK_LEFT;
import static forestry.arboriculture.multiblock.EnumPilePosition.CORNER_BACK_RIGHT;
@@ -46,8 +48,12 @@ public class CharcoalPileRenderer extends TileEntitySpecialRenderer<TilePile> {
}
@Override
public void renderTileEntityAt(TilePile pile, double x, double y, double z, float p_147500_8_, int destroyStage) {
public void renderTileEntityAt(@Nonnull TilePile pile, double x, double y, double z, float p_147500_8_, int destroyStage) {
IBlockState state = pile.getWorld().getBlockState(pile.getPos());
if (!(state.getBlock() instanceof BlockPile)) {
return;
}
EnumPilePosition pilePosition = state.getValue(BlockPile.PILE_POSITION);
MultiblockLogic<ICharcoalPileControllerInternal> logic = pile.getMultiblockLogic();
if (pilePosition != EnumPilePosition.INTERIOR && logic.isConnected() && logic.getController() != null) {
+10 -5
View File
@@ -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,11 +26,14 @@ 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;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import forestry.api.circuits.ChipsetManager;
import forestry.api.core.ForestryAPI;
@@ -61,6 +63,7 @@ import forestry.core.network.IPacketRegistry;
import forestry.core.network.PacketRegistryCore;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.render.TextureManager;
import forestry.core.utils.ClimateUtil;
import forestry.core.utils.ForestryModEnvWarningCallable;
@@ -133,6 +136,8 @@ public class PluginCore extends BlankForestryPlugin {
AlleleHelper.instance.init();
Proxies.render.initRendering();
RecipeSorter.register("forestry:shaped", ShapedRecipeCustom.class, RecipeSorter.Category.SHAPED, "");
}
@Override
@@ -261,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,
@@ -336,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);
+19 -11
View File
@@ -10,6 +10,16 @@
******************************************************************************/
package forestry.core;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.api.fuels.FuelManager;
import forestry.api.fuels.GeneratorFuel;
@@ -23,14 +33,6 @@ import forestry.core.utils.Log;
import forestry.plugins.BlankForestryPlugin;
import forestry.plugins.ForestryPlugin;
import forestry.plugins.ForestryPluginUids;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.common.registry.GameRegistry;
@ForestryPlugin(pluginID = ForestryPluginUids.FLUIDS, name = "Fluids", author = "mezz", url = Constants.URL, unlocalizedDescription = "for.plugin.fluids.description")
public class PluginFluids extends BlankForestryPlugin {
@@ -62,14 +64,20 @@ public class PluginFluids extends BlankForestryPlugin {
if (fluidBlock != null) {
String name = "fluid." + forestryFluid.getTag();
fluidBlock.setUnlocalizedName("forestry." + name);
GameRegistry.registerBlock(fluidBlock, ItemBlock.class, name);
fluidBlock.setRegistryName(name);
GameRegistry.register(fluidBlock);
ItemBlock itemBlock = new ItemBlock(fluidBlock);
itemBlock.setRegistryName(name);
GameRegistry.register(itemBlock);
Proxies.render.registerFluidStateMapper(fluidBlock, forestryFluid);
if (forestryFluid.getOtherContainers().isEmpty()) {
FluidRegistry.addBucketForFluid(fluid);
}
}
} else {
ResourceLocation resourceLocation = GameData.getBlockRegistry().getNameForObject(fluidBlock);
ResourceLocation resourceLocation = ForgeRegistries.BLOCKS.getKey(fluidBlock);
Log.warning("Pre-existing {} fluid block detected, deferring to {}:{}, "
+ "this may cause issues if the server/client have different mod load orders, "
+ "recommended that you disable all but one instance of {} fluid blocks via your configs.", fluid.getName(), resourceLocation.getResourceDomain(), resourceLocation.getResourcePath(), fluid.getName());
@@ -84,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);
}
@@ -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);
}
}
+11 -37
View File
@@ -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) {
@@ -115,11 +115,15 @@ public abstract class Genome implements IGenome {
* Quickly gets the species without loading the whole genome.
* We need this because the client uses the species for rendering.
*/
protected static IAlleleSpecies getSpeciesDirectly(ItemStack itemStack) {
public static IAlleleSpecies getSpeciesDirectly(ItemStack itemStack) {
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
if (nbtTagCompound == null) {
return null;
}
return getSpeciesDirectly(nbtTagCompound);
}
public static IAlleleSpecies getSpeciesDirectly(@Nonnull NBTTagCompound nbtTagCompound) {
NBTTagCompound genomeNBT = nbtTagCompound.getCompoundTag("Genome");
if (genomeNBT == null) {
@@ -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);
}
@@ -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());
}
}
@@ -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();
@@ -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;
@@ -106,8 +107,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());
}
@@ -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();
@@ -32,7 +32,7 @@ public class DataInputStreamForestry extends DataInputStream {
if (!itemName.isEmpty()) {
Item item = ItemStackUtil.getItemFromRegistry(itemName);
byte stackSize = readByte();
int stackSize = readVarInt();
int meta = readVarInt();
itemstack = new ItemStack(item, stackSize, meta);
@@ -26,7 +26,7 @@ public class DataOutputStreamForestry extends DataOutputStream {
writeUTF("");
} else {
writeUTF(ItemStackUtil.getItemNameFromRegistryAsString(itemstack.getItem()));
writeByte(itemstack.stackSize);
writeVarInt(itemstack.stackSize);
writeVarInt(itemstack.getItemDamage());
if (itemstack.getItem().isDamageable() || itemstack.getItem().getShareTag()) {
@@ -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));
@@ -16,18 +16,6 @@ public class ForestryTooltipCallback implements ITooltipCallback<ItemStack> {
private final ArrayListMultimap<Integer, String> tooltips = ArrayListMultimap.create();
public void addToTooltip(int index, List<String> tooltip) {
tooltips.get(index).addAll(tooltip);
}
public void addToTooltip(int index, String tooltip) {
tooltips.get(index).add(tooltip);
}
public List<String> getTooltip(int index) {
return tooltips.get(index);
}
@Override
public void onTooltip(int index, boolean input, ItemStack ingredient, List<String> tooltip) {
List<String> tip = tooltips.get(index);
@@ -36,20 +24,18 @@ public class ForestryTooltipCallback implements ITooltipCallback<ItemStack> {
}
}
public void clearTooltip(){
tooltips.clear();
}
public void addChanceTooltip(int index, float chance) {
if (chance <= 0.0F) {
tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.never")));
} else if (chance < 0.01F) {
tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), Translator.translateToLocal("forestry.jei.chance.lessThan1")));
} else if (chance != 1.0F) {
NumberFormat percentFormat = NumberFormat.getPercentInstance();
percentFormat.setMaximumFractionDigits(2);
tooltips.get(index).add(TextFormatting.GRAY + String.format(Translator.translateToLocal("forestry.jei.chance"), String.valueOf(percentFormat.format(chance))));
if (chance < 0) {
chance = 0;
} else if (chance > 1.0) {
chance = 1.0f;
}
NumberFormat percentFormat = NumberFormat.getPercentInstance();
percentFormat.setMaximumFractionDigits(2);
String chanceString = String.valueOf(percentFormat.format(chance));
tooltips.get(index).add(TextFormatting.GRAY + Translator.translateToLocalFormatted("for.jei.chance", chanceString));
}
}
@@ -55,7 +55,7 @@ public class JEIUtils {
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);
fluidStack = new FluidStack(fluid, Fluid.BUCKET_VOLUME);
}
}
return fluidStack;
@@ -10,12 +10,17 @@
******************************************************************************/
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;
@@ -27,77 +32,79 @@ 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.getStackInSlot(InventoryEscritoire.SLOT_ANALYZE), 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.6f, (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();
}
*/
}
}
@@ -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;
@@ -12,11 +12,54 @@ package forestry.core.tiles;
import javax.annotation.Nonnull;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties;
import forestry.core.fluids.ITankManager;
public interface ILiquidTankTile extends ILocatable {
public interface ILiquidTankTile extends ILocatable, IFluidHandler {
@Nonnull
ITankManager getTankManager();
@Override
default int fill(EnumFacing from, FluidStack resource, boolean doFill) {
return getTankManager().fill(resource, doFill);
}
@Override
default FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
return getTankManager().drain(resource, doDrain);
}
@Override
default FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
return getTankManager().drain(maxDrain, doDrain);
}
@Override
default boolean canFill(EnumFacing from, Fluid fluid) {
return getTankManager().canFillFluidType(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
}
@Override
default boolean canDrain(EnumFacing from, Fluid fluid) {
return getTankManager().canDrainFluidType(new FluidStack(fluid, Fluid.BUCKET_VOLUME));
}
@Override
default FluidTankInfo[] getTankInfo(EnumFacing from) {
IFluidTankProperties[] tankProperties = getTankManager().getTankProperties();
FluidTankInfo[] tankInfos = new FluidTankInfo[tankProperties.length];
for (int i = 0; i < tankProperties.length; i++) {
IFluidTankProperties fluidTankProperties = tankProperties[i];
tankInfos[i] = new FluidTankInfo(fluidTankProperties.getContents(), fluidTankProperties.getCapacity());
}
return tankInfos;
}
}
@@ -15,6 +15,7 @@ import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import forestry.api.genetics.ISpeciesRoot;
@@ -68,7 +69,7 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
prevLidAngle = lidAngle;
if (numPlayersUsing > 0 && lidAngle == 0.0F) {
playLidSound("random.chestopen");
playLidSound(SoundEvents.BLOCK_CHEST_OPEN);
}
if (numPlayersUsing == 0 && lidAngle > 0.0F || numPlayersUsing > 0 && lidAngle < 1.0F) {
@@ -83,13 +84,13 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
lidAngle = Math.max(Math.min(lidAngle, 1), 0);
if (lidAngle < 0.5F && oldAngle >= 0.5F) {
playLidSound("random.chestclosed");
playLidSound(SoundEvents.BLOCK_CHEST_CLOSE);
}
}
}
private void playLidSound(String sound) {
this.worldObj.playSound(null, getPos(), SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
private void playLidSound(SoundEvent sound) {
this.worldObj.playSound(null, getPos(), sound, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
@Override
@@ -23,12 +23,12 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
import net.minecraftforge.oredict.OreDictionary;
public abstract class ItemStackUtil {
@@ -68,8 +68,8 @@ public abstract class ItemStackUtil {
if (item == null) {
return null;
}
FMLControlledNamespacedRegistry<Item> itemRegistry = GameData.getItemRegistry();
return itemRegistry.getNameForObject(item);
IForgeRegistry<Item> itemRegistry = ForgeRegistries.ITEMS;
return itemRegistry.getKey(item);
}
/**
@@ -125,12 +125,8 @@ public abstract class ItemStackUtil {
if (itemName == null) {
return null;
}
FMLControlledNamespacedRegistry<Item> itemRegistry = GameData.getItemRegistry();
int registryID = itemRegistry.getId(itemName);
if (registryID == -1) {
return null;
}
return itemRegistry.getRaw(registryID);
IForgeRegistry<Item> itemRegistry = ForgeRegistries.ITEMS;
return itemRegistry.getValue(itemName);
}
/**
@@ -141,8 +137,8 @@ public abstract class ItemStackUtil {
if (block == null) {
return null;
}
FMLControlledNamespacedRegistry<Block> blockRegistry = GameData.getBlockRegistry();
return blockRegistry.getNameForObject(block);
IForgeRegistry<Block> blockRegistry = ForgeRegistries.BLOCKS;
return blockRegistry.getKey(block);
}
/**
@@ -169,12 +165,8 @@ public abstract class ItemStackUtil {
if (itemName == null) {
return null;
}
FMLControlledNamespacedRegistry<Block> blockRegistry = GameData.getBlockRegistry();
int registryID = blockRegistry.getId(itemName);
if (registryID == -1) {
return null;
}
return blockRegistry.getRaw(registryID);
IForgeRegistry<Block> blockRegistry = ForgeRegistries.BLOCKS;
return blockRegistry.getValue(itemName);
}
/**
@@ -174,4 +174,59 @@ public class VillagerTradeLists {
recipeList.add(new MerchantRecipe(randomLog, new ItemStack(Items.EMERALD, emeraldsAmount), itemToSell));
}
}
public static class GiveItemForTwoItems implements EntityVillager.ITradeList {
@Nonnull
public ItemStack buyingItemStack;
@Nullable
public EntityVillager.PriceInfo buyingPriceInfo;
@Nonnull
public ItemStack buyingItemStackTwo;
@Nullable
public EntityVillager.PriceInfo buyingPriceItemTwoInfo;
@Nonnull
public ItemStack sellingItemstack;
@Nullable
public EntityVillager.PriceInfo sellingPriceInfo;
public GiveItemForTwoItems(
@Nonnull ItemStack buyingItemStack,
@Nullable EntityVillager.PriceInfo buyingPriceInfo,
@Nonnull ItemStack buyingItemStackTwo,
@Nullable EntityVillager.PriceInfo buyingPriceItemTwoInfo,
@Nonnull ItemStack sellingItemstack,
@Nullable EntityVillager.PriceInfo sellingPriceInfo) {
this.buyingItemStack = buyingItemStack;
this.buyingPriceInfo = buyingPriceInfo;
this.buyingItemStackTwo = buyingItemStackTwo;
this.buyingPriceItemTwoInfo = buyingPriceItemTwoInfo;
this.sellingItemstack = sellingItemstack;
this.sellingPriceInfo = sellingPriceInfo;
}
@Override
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) {
int buyAmount = 1;
if (this.buyingPriceInfo != null) {
buyAmount = this.buyingPriceInfo.getPrice(random);
}
int buyTwoAmount = 1;
if (this.buyingPriceItemTwoInfo != null) {
buyTwoAmount = this.buyingPriceItemTwoInfo.getPrice(random);
}
int sellAmount = 1;
if (this.sellingPriceInfo != null) {
sellAmount = this.sellingPriceInfo.getPrice(random);
}
ItemStack buyItemStack = this.buyingItemStack.copy();
buyItemStack.stackSize = buyAmount;
ItemStack buyItemStackTwo = this.buyingItemStackTwo.copy();
buyItemStackTwo.stackSize = buyTwoAmount;
ItemStack sellItemStack = this.sellingItemstack.copy();
sellItemStack.stackSize = sellAmount;
recipeList.add(new MerchantRecipe(buyItemStack, buyItemStackTwo, sellItemStack));
}
}
}
@@ -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
@@ -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) {
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.factory.recipes;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -21,10 +23,11 @@ public class SqueezerRecipe implements ISqueezerRecipe {
private final int processingTime;
private final ItemStack[] resources;
private final FluidStack fluidOutput;
@Nullable
private final ItemStack remnants;
private final float remnantsChance;
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, ItemStack remnants, float remnantsChance) {
public SqueezerRecipe(int processingTime, ItemStack[] resources, FluidStack fluidOutput, @Nullable ItemStack remnants, float remnantsChance) {
this.processingTime = processingTime;
this.resources = resources;
this.fluidOutput = fluidOutput;
@@ -38,6 +41,7 @@ public class SqueezerRecipe implements ISqueezerRecipe {
}
@Override
@Nullable
public ItemStack getRemnants() {
return remnants;
}
@@ -22,6 +22,12 @@ public class BottlerRecipeHandler implements IRecipeHandler<BottlerRecipeWrapper
return ForestryRecipeCategoryUid.BOTTLER;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull BottlerRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.BOTTLER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull BottlerRecipeWrapper recipe) {
@@ -22,6 +22,12 @@ public class CarpenterRecipeHandler implements IRecipeHandler<CarpenterRecipeWra
return ForestryRecipeCategoryUid.CARPENTER;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull CarpenterRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.CARPENTER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CarpenterRecipeWrapper recipe) {
@@ -5,6 +5,7 @@ import java.util.Comparator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import net.minecraft.client.Minecraft;
@@ -22,7 +23,6 @@ import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.gui.ingredients.GuiItemStackGroup;
public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
@@ -41,8 +41,7 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
private final static ResourceLocation guiTexture = new ForestryResource("textures/gui/centrifugesocket.png");
@Nonnull
private final IDrawableAnimated arrow;
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
super(guiHelper.createDrawable(guiTexture, 25, 18, 126, 54), "tile.for.centrifuge.name");
@@ -68,17 +67,17 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
guiItemStacks.init(inputSlot, true, 4, 18);
guiItemStacks.setFromRecipe(inputSlot, recipeWrapper.getInputs());
CentrifugeRecipeWrapper centrifugeWrapper = (CentrifugeRecipeWrapper) recipeWrapper;
tooltip.clearTooltip();
setResults(centrifugeWrapper.getRecipe().getAllProducts(), (GuiItemStackGroup) guiItemStacks);
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
setResults(tooltip, centrifugeWrapper.getRecipe().getAllProducts(), guiItemStacks);
guiItemStacks.addTooltipCallback(tooltip);
}
private void setResults(Map<ItemStack, Float> outputs, GuiItemStackGroup guiItemStacks) {
private static void setResults(ForestryTooltipCallback tooltip, Map<ItemStack, Float> outputs, IGuiItemStackGroup guiItemStacks) {
Set<Entry<ItemStack, Float>> entrySet = outputs.entrySet();
if (entrySet.isEmpty()) {
return;
}
PriorityQueue<Entry<ItemStack, Float>> sortByChance = new PriorityQueue<>(entrySet.size(), highestChanceComparator);
Queue<Entry<ItemStack, Float>> sortByChance = new PriorityQueue<>(entrySet.size(), highestChanceComparator);
sortByChance.addAll(entrySet);
int i = 0;
@@ -89,10 +88,10 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
}
int x = 72 + OUTPUTS[i][0] * 18;
int y = OUTPUTS[i][1] * 18;
int ID = outputSlot + i;
guiItemStacks.init(ID, false, x, y);
guiItemStacks.set(ID, stack.getKey());
tooltip.addChanceTooltip(ID + 1, stack.getValue());
int slotIndex = outputSlot + i;
guiItemStacks.init(slotIndex, false, x, y);
guiItemStacks.set(slotIndex, stack.getKey());
tooltip.addChanceTooltip(slotIndex, stack.getValue());
i++;
}
}
@@ -24,6 +24,12 @@ public class CentrifugeRecipeHandler implements IRecipeHandler<CentrifugeRecipeW
return ForestryRecipeCategoryUid.CENTRIFUGE;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull CentrifugeRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.CENTRIFUGE;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CentrifugeRecipeWrapper recipe) {
@@ -22,6 +22,12 @@ public class FabricatorRecipeHandler implements IRecipeHandler<FabricatorRecipeW
return ForestryRecipeCategoryUid.FABRICATOR;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull FabricatorRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.FABRICATOR;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull FabricatorRecipeWrapper recipe) {
@@ -22,6 +22,12 @@ public class FermenterRecipeHandler implements IRecipeHandler<FermenterRecipeWra
return ForestryRecipeCategoryUid.FERMENTER;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull FermenterRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.FERMENTER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull FermenterRecipeWrapper recipe) {
@@ -22,6 +22,12 @@ public class MoistenerRecipeHandler implements IRecipeHandler<MoistenerRecipeWra
return ForestryRecipeCategoryUid.MOISTENER;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull MoistenerRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.MOISTENER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull MoistenerRecipeWrapper recipe) {
@@ -20,6 +20,12 @@ public class RainmakerRecipeHandler implements IRecipeHandler<RainmakerRecipeWra
return ForestryRecipeCategoryUid.RAINMAKER;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull RainmakerRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.RAINMAKER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull RainmakerRecipeWrapper recipe) {
@@ -35,8 +35,7 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
private final IDrawableAnimated arrow;
@Nonnull
private final IDrawable tankOverlay;
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
public SqueezerRecipeCategory(@Nonnull IGuiHelper guiHelper) {
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 62), "tile.for.squeezer.name");
@@ -70,7 +69,7 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
guiItemStacks.init(craftOutputSlot, false, 87, 43);
guiItemStacks.set(craftOutputSlot, wrapper.getOutputs());
tooltip.clearTooltip();
ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
tooltip.addChanceTooltip(craftOutputSlot, chance);
setIngredients(guiItemStacks, wrapper.getInputs());
@@ -31,6 +31,12 @@ public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements I
return ForestryRecipeCategoryUid.SQUEEZER;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull R recipe) {
return ForestryRecipeCategoryUid.SQUEEZER;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull R recipe) {
@@ -45,16 +51,7 @@ public class SqueezerRecipeHandler<R extends ForestryRecipeWrapper> implements I
if (wrapper.getInputs() == null || wrapper.getInputs().isEmpty()) {
return false;
}
if (wrapper.getOutputs() == null || wrapper.getOutputs().isEmpty()) {
return false;
}
if (wrapper.getRecipe() instanceof ISqueezerContainerRecipe) {
ISqueezerContainerRecipe recipe = (ISqueezerContainerRecipe) wrapper.getRecipe();
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
} else {
ISqueezerRecipe recipe = (ISqueezerRecipe) wrapper.getRecipe();
return recipe.getProcessingTime() > 0 && recipe.getRemnantsChance() > 0;
}
return true;
}
}
@@ -34,7 +34,8 @@ public class SqueezerRecipeWrapper extends AbstractSqueezerRecipeWrapper<ISqueez
@Nonnull
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(getRecipe().getRemnants());
ItemStack remnants = getRecipe().getRemnants();
return remnants == null ? Collections.emptyList() : Collections.singletonList(remnants);
}
@Override
@@ -22,6 +22,12 @@ public class StillRecipeHandler implements IRecipeHandler<StillRecipeWrapper> {
return ForestryRecipeCategoryUid.STILL;
}
@Nonnull
@Override
public String getRecipeCategoryUid(@Nonnull StillRecipeWrapper recipe) {
return ForestryRecipeCategoryUid.STILL;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull StillRecipeWrapper recipe) {
@@ -32,7 +32,6 @@ import forestry.api.core.IErrorLogic;
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.network.DataInputStreamForestry;
@@ -45,7 +44,7 @@ import forestry.factory.gui.GuiRaintank;
import forestry.factory.inventory.InventoryRaintank;
public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTankTile {
private static final FluidStack STACK_WATER = Fluids.WATER.getFluid(Constants.RAINTANK_AMOUNT_PER_UPDATE);
private static final FluidStack STACK_WATER = new FluidStack(FluidRegistry.WATER, Constants.RAINTANK_AMOUNT_PER_UPDATE);
private final FilteredTank resourceTank;
private final TankManager tankManager;
@@ -119,14 +118,14 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
}
if (!isFilling()) {
FluidHelper.FillStatus canFill = FluidHelper.fillContainers(tankManager, this, InventoryRaintank.SLOT_RESOURCE, InventoryRaintank.SLOT_PRODUCT, Fluids.WATER.getFluid(), false);
FluidHelper.FillStatus canFill = FluidHelper.fillContainers(tankManager, this, InventoryRaintank.SLOT_RESOURCE, InventoryRaintank.SLOT_PRODUCT, FluidRegistry.WATER, false);
if (canFill == FluidHelper.FillStatus.SUCCESS) {
fillingTime = Constants.RAINTANK_FILLING_TIME;
}
} else {
fillingTime--;
if (fillingTime <= 0) {
FluidHelper.FillStatus filled = FluidHelper.fillContainers(tankManager, this, InventoryRaintank.SLOT_RESOURCE, InventoryRaintank.SLOT_PRODUCT, Fluids.WATER.getFluid(), true);
FluidHelper.FillStatus filled = FluidHelper.fillContainers(tankManager, this, InventoryRaintank.SLOT_RESOURCE, InventoryRaintank.SLOT_PRODUCT, FluidRegistry.WATER, true);
if (filled == FluidHelper.FillStatus.SUCCESS) {
fillingTime = 0;
}
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff. Show more