mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 17:44:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a37ad0666 | ||
|
|
13d4907bff | ||
|
|
78725009c1 | ||
|
|
a1bc9144bd | ||
|
|
b897056824 | ||
|
|
87563b6c97 | ||
|
|
62d6294da2 | ||
|
|
b4d71543db | ||
|
|
73db1a608a | ||
|
|
1c6b60122e | ||
|
|
1e7a042b53 | ||
|
|
bf08336bc5 | ||
|
|
62cbf31ac2 | ||
|
|
a2eac214b4 | ||
|
|
32933ce90b | ||
|
|
44cdc191fc | ||
|
|
e4f77e42d3 | ||
|
|
9f91832c7e | ||
|
|
6d4af0fb5d | ||
|
|
4345739a87 | ||
|
|
0a881a81f8 | ||
|
|
b066f7ad4c | ||
|
|
a19380347a | ||
|
|
9bc1211e57 | ||
|
|
cbce5d0fc0 | ||
|
|
b20b56c5d4 | ||
|
|
27041c205c | ||
|
|
09ea20729d | ||
|
|
736e6c5fa2 | ||
|
|
e96f4fc8a0 |
No files matched your search
+5
-13
@@ -5,15 +5,17 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.47"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.matthewprenger.cursegradle" version "1.0.9"
|
||||
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.32"
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"
|
||||
|
||||
version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
|
||||
if (project.hasProperty('buildQualifier')) {
|
||||
@@ -149,17 +151,7 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||
untaggedName = "Current release ${project.version}"
|
||||
fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331"
|
||||
toRef = "HEAD"
|
||||
templateContent = """
|
||||
Please help the Forestry project by <a href="https://github.com/ForestryMC/ForestryMC/issues">reporting issues here.</a><br/>
|
||||
{{#tags}}
|
||||
<h3>{{name}}</h3>
|
||||
<ul>
|
||||
{{#commits}}
|
||||
<li>{{{message}}} - {{authorName}}</li>
|
||||
{{/commits}}
|
||||
</ul>
|
||||
{{/tags}}
|
||||
"""
|
||||
templateContent = file('changelog.mustache').getText('UTF-8')
|
||||
}
|
||||
|
||||
curseforge {
|
||||
@@ -168,7 +160,7 @@ curseforge {
|
||||
id = '59751'
|
||||
changelog = file('changelog.html')
|
||||
changelogType = 'html'
|
||||
releaseType = 'alpha'
|
||||
releaseType = 'beta'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Please help the Forestry project by <a href="https://github.com/ForestryMC/ForestryMC/issues">reporting issues here.</a><br/>
|
||||
{{#tags}}
|
||||
<h3>{{name}}</h3>
|
||||
<ul>
|
||||
{{#commits}}
|
||||
<li>{{{message}}} - {{authorName}}</li>
|
||||
{{/commits}}
|
||||
</ul>
|
||||
{{/tags}}
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
mcversion=1.12
|
||||
forgeversion=14.21.1.2387
|
||||
mcp_mappings=snapshot_20170702
|
||||
forgeversion=14.21.1.2424
|
||||
mcp_mappings=snapshot_20170703
|
||||
|
||||
tesla_version=1.0.60
|
||||
jei_version=4.7.0.67
|
||||
jei_version=4.7.2.77
|
||||
ic2_version=2.7.30-ex111
|
||||
|
||||
version_major=5
|
||||
version_minor=4
|
||||
version_patch=1
|
||||
version_minor=5
|
||||
version_patch=0
|
||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Sat Jun 24 19:47:39 PDT 2017
|
||||
#Mon Jul 03 15:24:47 PDT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
|
||||
@@ -42,11 +42,6 @@ case "`uname`" in
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@@ -114,6 +109,7 @@ fi
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
|
||||
@@ -15,12 +15,9 @@ import com.google.common.base.Preconditions;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
@@ -44,7 +41,6 @@ import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.multiblock.MultiblockEventHandler;
|
||||
import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.MigrationHelper;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
@@ -60,8 +56,8 @@ import forestry.plugins.compat.PluginIC2;
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.12]",
|
||||
dependencies = "required-after:forge@[14.21.0.2363,);"
|
||||
+ "after:JEI@[4.7.0,);"
|
||||
dependencies = "required-after:forge@[14.21.1.2395,);"
|
||||
+ "after:jei@[4.7.0,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
@@ -151,14 +147,4 @@ public class Forestry {
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
PluginManager.processIMCMessages(event.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingBlockMappings(RegistryEvent.MissingMappings<Block> event) {
|
||||
MigrationHelper.onMissingBlockMappings(event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onMissingItemMappings(RegistryEvent.MissingMappings<Item> event) {
|
||||
MigrationHelper.onMissingItemMappings(event);
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,6 @@ public enum WoodBlockKind {
|
||||
break;
|
||||
}
|
||||
textures.putAll(customTextures);
|
||||
return model.retexture(new ImmutableMap.Builder<String, String>().putAll(textures).build());
|
||||
return model.retexture(ImmutableMap.copyOf(textures));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* Called after Forestry has registered all his species alleles of a individual.
|
||||
*/
|
||||
|
||||
@@ -437,59 +437,59 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
// / APIARIST'S ARMOR
|
||||
|
||||
ItemStack wovenSilk = coreItems.craftingMaterial.getWovenSilk();
|
||||
RecipeUtil.addRecipe(items.apiaristHat,
|
||||
RecipeUtil.addRecipe("apiarist_hat", items.apiaristHat,
|
||||
"###", "# #",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristChest,
|
||||
RecipeUtil.addRecipe("apiarist_chest", items.apiaristChest,
|
||||
"# #", "###", "###",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristLegs,
|
||||
RecipeUtil.addRecipe("apiarist_legs", items.apiaristLegs,
|
||||
"###", "# #", "# #",
|
||||
'#', wovenSilk);
|
||||
RecipeUtil.addRecipe(items.apiaristBoots,
|
||||
RecipeUtil.addRecipe("apiarist_boots", items.apiaristBoots,
|
||||
"# #", "# #",
|
||||
'#', wovenSilk);
|
||||
|
||||
// / HABITAT LOCATOR
|
||||
RecipeUtil.addRecipe(items.habitatLocator,
|
||||
RecipeUtil.addRecipe("habitat_locator", items.habitatLocator,
|
||||
" X ",
|
||||
"X#X",
|
||||
" X ",
|
||||
'#', OreDictUtil.DUST_REDSTONE, 'X', OreDictUtil.INGOT_BRONZE);
|
||||
|
||||
// Bees
|
||||
RecipeUtil.addRecipe(items.scoop,
|
||||
RecipeUtil.addRecipe("scoop", items.scoop,
|
||||
"#X#", "###", " # ",
|
||||
'#', OreDictUtil.STICK_WOOD,
|
||||
'X', Blocks.WOOL);
|
||||
RecipeUtil.addRecipe(items.smoker,
|
||||
RecipeUtil.addRecipe("smoker", items.smoker,
|
||||
"LS#",
|
||||
"LF#",
|
||||
"###",
|
||||
'#', "ingotTin", 'S', OreDictUtil.STICK_WOOD, 'F', Items.FLINT_AND_STEEL, 'L', OreDictUtil.LEATHER);
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.SLIME_BALL),
|
||||
RecipeUtil.addRecipe("propolis_to_slime", new ItemStack(Items.SLIME_BALL),
|
||||
"#X#", "#X#", "#X#",
|
||||
'#', items.propolis,
|
||||
'X', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1));
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.SPECKLED_MELON),
|
||||
RecipeUtil.addRecipe("honey_melon", new ItemStack(Items.SPECKLED_MELON),
|
||||
"#X#", "#Y#", "#X#",
|
||||
'#', items.honeyDrop,
|
||||
'X', items.honeydew,
|
||||
'Y', Items.MELON);
|
||||
RecipeUtil.addRecipe(items.frameUntreated,
|
||||
RecipeUtil.addRecipe("frame_untreated", items.frameUntreated,
|
||||
"###", "#S#", "###",
|
||||
'#', OreDictUtil.STICK_WOOD,
|
||||
'S', Items.STRING);
|
||||
RecipeUtil.addRecipe(items.frameImpregnated,
|
||||
RecipeUtil.addRecipe("frame_impregnated", items.frameImpregnated,
|
||||
"###", "#S#", "###",
|
||||
'#', coreItems.stickImpregnated,
|
||||
'S', Items.STRING);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
RecipeUtil.addRecipe("bee_house_minecart", items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', new ItemStack(blocks.beeHouse),
|
||||
'C', Items.MINECART);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(),
|
||||
RecipeUtil.addRecipe("apiary_minecart", items.minecartBeehouse.getApiaryMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', new ItemStack(blocks.apiary),
|
||||
@@ -497,7 +497,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
for(int i = 0;i < blocks.beeCombs.length;i++){
|
||||
BlockHoneyComb block = blocks.beeCombs[i];
|
||||
for(int m = 0;m < EnumHoneyComb.VALUES.length - i * 16;m++){
|
||||
RecipeUtil.addRecipe(new ItemStack(block, 1, m),
|
||||
RecipeUtil.addRecipe("comb." + m, new ItemStack(block, 1, m),
|
||||
"###",
|
||||
"###",
|
||||
"###", '#', items.beeComb.get(EnumHoneyComb.get(i * 16 + m), 1));
|
||||
@@ -507,17 +507,17 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
// FOOD STUFF
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FOOD)) {
|
||||
ItemRegistryFood foodItems = PluginFood.getItems();
|
||||
RecipeUtil.addRecipe(new ItemStack(foodItems.honeyedSlice, 4),
|
||||
RecipeUtil.addRecipe("honeyed_slice", new ItemStack(foodItems.honeyedSlice, 4),
|
||||
"###", "#X#", "###",
|
||||
'#', items.honeyDrop,
|
||||
'X', Items.BREAD);
|
||||
|
||||
RecipeUtil.addRecipe(foodItems.honeyPot,
|
||||
RecipeUtil.addRecipe("honey_pot", foodItems.honeyPot,
|
||||
"# #", " X ", "# #",
|
||||
'#', items.honeyDrop,
|
||||
'X', fluidItems.waxCapsuleEmpty);
|
||||
|
||||
RecipeUtil.addRecipe(foodItems.ambrosia,
|
||||
RecipeUtil.addRecipe("ambrosia", foodItems.ambrosia,
|
||||
"#Y#", "XXX", "###",
|
||||
'#', items.honeydew,
|
||||
'X', items.royalJelly,
|
||||
@@ -529,33 +529,33 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
int outputCapsuleAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule");
|
||||
if (outputCapsuleAmount > 0) {
|
||||
ItemStack capsule = fluidItems.waxCapsuleEmpty.getItemStack(outputCapsuleAmount);
|
||||
RecipeUtil.addRecipe(capsule, "###", '#', coreItems.beeswax);
|
||||
RecipeUtil.addRecipe("wax_capsule", capsule, "###", '#', coreItems.beeswax);
|
||||
}
|
||||
|
||||
int outputRefractoryAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.refractory");
|
||||
if (outputRefractoryAmount > 0) {
|
||||
ItemStack capsule = fluidItems.refractoryEmpty.getItemStack(outputRefractoryAmount);
|
||||
RecipeUtil.addRecipe(capsule, "###", '#', coreItems.refractoryWax);
|
||||
RecipeUtil.addRecipe("refractory_capsule", capsule, "###", '#', coreItems.refractoryWax);
|
||||
}
|
||||
|
||||
// / BITUMINOUS PEAT
|
||||
RecipeUtil.addRecipe(coreItems.bituminousPeat.getItemStack(),
|
||||
RecipeUtil.addRecipe("bituminous_peat", coreItems.bituminousPeat.getItemStack(),
|
||||
" # ", "XYX", " # ",
|
||||
'#', OreDictUtil.DUST_ASH,
|
||||
'X', coreItems.peat,
|
||||
'Y', items.propolis);
|
||||
|
||||
// / TORCHES
|
||||
RecipeUtil.addRecipe(new ItemStack(Blocks.TORCH, 3),
|
||||
RecipeUtil.addRecipe("beeswax_worth", new ItemStack(Blocks.TORCH, 3),
|
||||
" # ", " # ", " Y ",
|
||||
'#', coreItems.beeswax,
|
||||
'Y', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addRecipe(coreItems.craftingMaterial.getPulsatingMesh(),
|
||||
RecipeUtil.addRecipe("pulsating_mesh", coreItems.craftingMaterial.getPulsatingMesh(),
|
||||
"# #", " # ", "# #",
|
||||
'#', items.propolis.get(EnumPropolis.PULSATING, 1));
|
||||
|
||||
// / WAX CAST
|
||||
RecipeUtil.addRecipe(items.waxCast,
|
||||
RecipeUtil.addRecipe("wax_cast", items.waxCast,
|
||||
"###",
|
||||
"# #",
|
||||
"###",
|
||||
@@ -563,14 +563,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
// / ALVEARY
|
||||
ItemStack alvearyPlainBlock = blocks.getAlvearyBlock(BlockAlvearyType.PLAIN);
|
||||
RecipeUtil.addRecipe(alvearyPlainBlock,
|
||||
RecipeUtil.addRecipe("alveary_plain", alvearyPlainBlock,
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'X', coreItems.impregnatedCasing,
|
||||
'#', coreItems.craftingMaterial.getScentedPaneling());
|
||||
// SWARMER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
|
||||
RecipeUtil.addRecipe("alveary_swarmer", blocks.getAlvearyBlock(BlockAlvearyType.SWARMER),
|
||||
"#G#",
|
||||
" X ",
|
||||
"#G#",
|
||||
@@ -578,7 +578,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'G', OreDictUtil.INGOT_GOLD);
|
||||
// FAN
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.FAN),
|
||||
RecipeUtil.addRecipe("alveary_fan", blocks.getAlvearyBlock(BlockAlvearyType.FAN),
|
||||
"I I",
|
||||
" X ",
|
||||
"I#I",
|
||||
@@ -586,7 +586,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'I', OreDictUtil.INGOT_IRON);
|
||||
// HEATER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
|
||||
RecipeUtil.addRecipe("alveary_heater", blocks.getAlvearyBlock(BlockAlvearyType.HEATER),
|
||||
"#I#",
|
||||
" X ",
|
||||
"YYY",
|
||||
@@ -594,7 +594,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', alvearyPlainBlock,
|
||||
'I', OreDictUtil.INGOT_IRON, 'Y', OreDictUtil.STONE);
|
||||
// HYGROREGULATOR
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
|
||||
RecipeUtil.addRecipe("alveary_hygro", blocks.getAlvearyBlock(BlockAlvearyType.HYGRO),
|
||||
"GIG",
|
||||
"GXG",
|
||||
"GIG",
|
||||
@@ -602,14 +602,14 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'I', OreDictUtil.INGOT_IRON,
|
||||
'G', OreDictUtil.BLOCK_GLASS);
|
||||
// STABILISER
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
|
||||
RecipeUtil.addRecipe("alveary_stabiliser", blocks.getAlvearyBlock(BlockAlvearyType.STABILISER),
|
||||
"G G",
|
||||
"GXG",
|
||||
"G G",
|
||||
'X', alvearyPlainBlock,
|
||||
'G', OreDictUtil.GEM_QUARTZ);
|
||||
// SIEVE
|
||||
RecipeUtil.addRecipe(blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
|
||||
RecipeUtil.addRecipe("alveary_sieve", blocks.getAlvearyBlock(BlockAlvearyType.SIEVE),
|
||||
"III",
|
||||
" X ",
|
||||
"WWW",
|
||||
@@ -657,8 +657,8 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
"#X#",
|
||||
'#', coreItems.beeswax,
|
||||
'X', coreItems.craftingMaterial.getSilkWisp());
|
||||
RecipeUtil.addShapelessRecipe(blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe(blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe("candle_unlit_reset", blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1));
|
||||
RecipeUtil.addShapelessRecipe("candle_lit_reset", blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1));
|
||||
|
||||
// / CENTRIFUGE
|
||||
// Honey combs
|
||||
@@ -758,7 +758,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.fermenterManager.addRecipe(items.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.getFluid(1), Fluids.FOR_HONEY.getFluid(1));
|
||||
}
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiary,
|
||||
RecipeUtil.addRecipe("apiary", blocks.apiary,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -766,7 +766,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'#', OreDictUtil.PLANK_WOOD,
|
||||
'C', coreItems.impregnatedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.beeChest,
|
||||
RecipeUtil.addRecipe("bee_chest", blocks.beeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -774,7 +774,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', OreDictUtil.BEE_COMB,
|
||||
'Y', OreDictUtil.CHEST_WOOD);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.beeHouse,
|
||||
RecipeUtil.addRecipe("bee_house", blocks.beeHouse,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -898,9 +898,11 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
|
||||
public void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
if (Config.getBeehivesAmount() > 0.0) {
|
||||
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
int chunkX = pos.getX() >> 4;
|
||||
int chunkZ = pos.getZ() >> 4;
|
||||
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1024,7 +1024,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent(BeeManager.beeRoot, IAlleleBeeSpecies.class));
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent<>(BeeManager.beeRoot, IAlleleBeeSpecies.class));
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
@@ -103,7 +103,9 @@ public class ItemBeeGE extends ItemGE implements IColoredItem {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
addCreativeItems(subItems, true);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
addCreativeItems(subItems, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCreativeItems(NonNullList<ItemStack> subItems, boolean hideSecrets) {
|
||||
|
||||
@@ -62,10 +62,12 @@ public class ItemHoneyComb extends ItemForestry implements IColoredItem {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(i);
|
||||
if (!honeyComb.isSecret() || Config.isDebug) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(i);
|
||||
if (!honeyComb.isSecret() || Config.isDebug) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,8 +97,10 @@ public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegi
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < definition.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < definition.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.BlockNewLeaf;
|
||||
import net.minecraft.block.BlockOldLeaf;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -42,7 +41,8 @@ import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.CapabilityManager;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -51,7 +51,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
@@ -72,7 +71,6 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.blocks.BlockArbLog;
|
||||
import forestry.arboriculture.blocks.BlockArbSlab;
|
||||
import forestry.arboriculture.blocks.BlockDefaultLeaves;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
@@ -87,7 +85,6 @@ import forestry.arboriculture.genetics.TreeRoot;
|
||||
import forestry.arboriculture.genetics.TreekeepingMode;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleFruits;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleLeafEffects;
|
||||
import forestry.arboriculture.items.ItemGermlingGE;
|
||||
import forestry.arboriculture.items.ItemGrafter;
|
||||
import forestry.arboriculture.items.ItemRegistryArboriculture;
|
||||
import forestry.arboriculture.models.TextureLeaves;
|
||||
@@ -327,29 +324,29 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
if (woodType instanceof EnumForestryWoodType) {
|
||||
planks.setCount(4);
|
||||
logs.setCount(1);
|
||||
RecipeUtil.addShapelessRecipe(planks.copy(), logs.copy());
|
||||
RecipeUtil.addShapelessRecipe("planks_" + woodType.getName(), planks.copy(), logs.copy());
|
||||
|
||||
slabs.setCount(6);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(slabs.copy(), "###", '#', planks.copy());
|
||||
RecipeUtil.addRecipe("slabs_" + woodType.getName(), slabs.copy(), "###", '#', planks.copy());
|
||||
|
||||
fences.setCount(3);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(fences.copy(),
|
||||
RecipeUtil.addRecipe("fences_" + woodType.getName(), fences.copy(),
|
||||
"#X#",
|
||||
"#X#",
|
||||
'#', planks.copy(), 'X', "stickWood");
|
||||
|
||||
fenceGates.setCount(1);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(fenceGates.copy(),
|
||||
RecipeUtil.addRecipe("fence_gates_" + woodType.getName(), fenceGates.copy(),
|
||||
"X#X",
|
||||
"X#X",
|
||||
'#', planks.copy(), 'X', "stickWood");
|
||||
|
||||
stairs.setCount(4);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(stairs.copy(),
|
||||
RecipeUtil.addRecipe("stairs_" + woodType.getName(), stairs.copy(),
|
||||
"# ",
|
||||
"## ",
|
||||
"###",
|
||||
@@ -357,7 +354,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
doors.setCount(3);
|
||||
planks.setCount(1);
|
||||
RecipeUtil.addRecipe(doors.copy(),
|
||||
RecipeUtil.addRecipe("doors_" + woodType.getName(), doors.copy(),
|
||||
"## ",
|
||||
"## ",
|
||||
"## ",
|
||||
@@ -366,31 +363,31 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
fireproofPlanks.setCount(4);
|
||||
fireproofLogs.setCount(1);
|
||||
RecipeUtil.addShapelessRecipe(fireproofPlanks.copy(), fireproofLogs.copy());
|
||||
RecipeUtil.addShapelessRecipe("fireproof_planks_" + woodType.getName(), fireproofPlanks.copy(), fireproofLogs.copy());
|
||||
|
||||
fireproofSlabs.setCount(6);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(fireproofSlabs.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_slabs_" + woodType.getName(), fireproofSlabs.copy(),
|
||||
"###",
|
||||
'#', fireproofPlanks.copy());
|
||||
|
||||
fireproofFences.setCount(3);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(fireproofFences.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_fences_" + woodType.getName(), fireproofFences.copy(),
|
||||
"#X#",
|
||||
"#X#",
|
||||
'#', fireproofPlanks.copy(), 'X', "stickWood");
|
||||
|
||||
fireproofFenceGates.setCount(1);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(fireproofFenceGates.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_fence_gates_" + woodType.getName(), fireproofFenceGates.copy(),
|
||||
"X#X",
|
||||
"X#X",
|
||||
'#', fireproofPlanks.copy(), 'X', "stickWood");
|
||||
|
||||
fireproofStairs.setCount(4);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(fireproofStairs.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_stairs_" + woodType.getName(), fireproofStairs.copy(),
|
||||
"# ",
|
||||
"## ",
|
||||
"###",
|
||||
@@ -398,7 +395,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
|
||||
doors.setCount(3);
|
||||
fireproofPlanks.setCount(1);
|
||||
RecipeUtil.addRecipe(doors.copy(),
|
||||
RecipeUtil.addRecipe("fireproof_doors_" + woodType.getName(), doors.copy(),
|
||||
"## ",
|
||||
"## ",
|
||||
"## ",
|
||||
@@ -445,14 +442,14 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
// Grafter
|
||||
RecipeUtil.addRecipe(items.grafter.getItemStack(),
|
||||
RecipeUtil.addRecipe("grafter", items.grafter.getItemStack(),
|
||||
" B",
|
||||
" # ",
|
||||
"# ",
|
||||
'B', "ingotBronze",
|
||||
'#', "stickWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.treeChest,
|
||||
RecipeUtil.addRecipe("tree_chest", blocks.treeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -461,10 +458,10 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
'Y', "chestWood");
|
||||
|
||||
//Wood Pile
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(blocks.woodPile), OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD);
|
||||
RecipeUtil.addShapelessRecipe("wood_pile", new ItemStack(blocks.woodPile), OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD, OreDictUtil.LOG_WOOD);
|
||||
|
||||
//Dirt Pile Block
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(blocks.loam, 4), Items.CLAY_BALL, coreItems.fertilizerBio, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, coreItems.fertilizerBio, Items.CLAY_BALL);
|
||||
RecipeUtil.addShapelessRecipe("loam", new ItemStack(blocks.loam, 4), Items.CLAY_BALL, coreItems.compost, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, OreDictUtil.SAND, Items.CLAY_BALL, coreItems.compost, Items.CLAY_BALL);
|
||||
}
|
||||
|
||||
private static void registerAlleles() {
|
||||
@@ -544,11 +541,6 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new FuelHandler(getItems().sapling);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketRegistry getPacketRegistry() {
|
||||
return new PacketRegistryArboriculture();
|
||||
@@ -575,49 +567,11 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
hiddenItems.add(new ItemStack(getBlocks().saplingGE));
|
||||
}
|
||||
|
||||
private static class FuelHandler implements IFuelHandler {
|
||||
private final ItemGermlingGE sapling;
|
||||
|
||||
public FuelHandler(ItemGermlingGE sapling) {
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
Item item = fuel.getItem();
|
||||
if (sapling == item) {
|
||||
return 100;
|
||||
}
|
||||
|
||||
if(Item.getItemFromBlock(blocks.charcoal) == item){
|
||||
return 16000;
|
||||
}
|
||||
if(Item.getItemFromBlock(blocks.woodPile) == item){
|
||||
return 1200;
|
||||
}
|
||||
|
||||
Block block = Block.getBlockFromItem(item);
|
||||
|
||||
if (block instanceof IWoodTyped) {
|
||||
IWoodTyped woodTypedBlock = (IWoodTyped) block;
|
||||
if (woodTypedBlock.isFireproof()) {
|
||||
return 0;
|
||||
} else if (block instanceof BlockArbSlab) {
|
||||
return 150;
|
||||
} else {
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(TextureStitchEvent.Pre event) {
|
||||
TextureLeaves.registerAllSprites();
|
||||
WoodTextureManager.parseFile(Minecraft.getMinecraft().getResourceManager());
|
||||
WoodTextureManager.parseFile();
|
||||
for (IAlleleFruit alleleFruit : AlleleFruits.getFruitAlleles()) {
|
||||
alleleFruit.getProvider().registerSprites();
|
||||
}
|
||||
|
||||
@@ -3,21 +3,22 @@ package forestry.arboriculture;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
import forestry.api.arboriculture.IWoodItemMeshDefinition;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.arboriculture.models.WoodModelLoader;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class WoodHelper {
|
||||
|
||||
@@ -77,16 +78,18 @@ public class WoodHelper {
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
if (!WoodModelLoader.INSTANCE.isEnabled) {
|
||||
return new ModelResourceLocation(getDefaultModelLocation(stack), "inventory");
|
||||
}
|
||||
int meta = stack.getMetadata();
|
||||
IWoodType woodType = wood.getWoodType(meta);
|
||||
WoodBlockKind blockKind = wood.getBlockKind();
|
||||
if (woodType instanceof EnumVanillaWoodType) {
|
||||
return new ModelResourceLocation("minecraft:" + woodType + "_" + blockKind, "inventory");
|
||||
} else {
|
||||
return ModelManager.getInstance().getModelLocation(blockKind + "/" + woodType);
|
||||
String modID = Constants.MOD_ID;
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if(block != null){
|
||||
modID = block.getRegistryName().getResourceDomain();
|
||||
}
|
||||
return new ModelResourceLocation(modID + ":" + blockKind + "/" + woodType, "inventory");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -271,10 +271,22 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
}
|
||||
|
||||
charcoal = new BlockCharcoal();
|
||||
registerBlock(charcoal, new ItemBlockForestry(charcoal), "charcoal");
|
||||
ItemBlockForestry itemBlockCharcoal = new ItemBlockForestry(charcoal) {
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
return 16000;
|
||||
}
|
||||
};
|
||||
registerBlock(charcoal, itemBlockCharcoal, "charcoal");
|
||||
|
||||
woodPile = new BlockWoodPile();
|
||||
registerBlock(woodPile, new ItemBlockForestry(woodPile), "wood_pile");
|
||||
ItemBlockForestry itemBlockWoodPile = new ItemBlockForestry(woodPile) {
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
return 1200;
|
||||
}
|
||||
};
|
||||
registerBlock(woodPile, itemBlockWoodPile, "wood_pile");
|
||||
|
||||
loam = new BlockLoam();
|
||||
registerBlock(loam, new ItemBlockForestry(loam), "loam");
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import forestry.api.arboriculture.EnumForestryWoodType;
|
||||
import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
import forestry.api.arboriculture.IWoodStateMapper;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.models.WoodModelLoader;
|
||||
import forestry.core.config.Constants;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFence;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
@@ -20,9 +14,16 @@ import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.EnumVanillaWoodType;
|
||||
import forestry.api.arboriculture.IWoodStateMapper;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WoodTypeStateMapper extends StateMapperBase implements IWoodStateMapper {
|
||||
private final IWoodTyped woodTyped;
|
||||
@@ -70,14 +71,10 @@ public class WoodTypeStateMapper extends StateMapperBase implements IWoodStateMa
|
||||
Block block = state.getBlock();
|
||||
int meta = block.getMetaFromState(state);
|
||||
IWoodType woodType = woodTyped.getWoodType(meta);
|
||||
if (woodType instanceof EnumForestryWoodType) {
|
||||
if (WoodModelLoader.INSTANCE.isEnabled) {
|
||||
return getForestryModelResourceLocation(woodType, properties);
|
||||
} else {
|
||||
return getDefaultModelResourceLocation(state);
|
||||
}
|
||||
} else {
|
||||
if (woodType instanceof EnumVanillaWoodType) {
|
||||
return getVanillaModelResourceLocation(block, woodType, properties);
|
||||
} else {
|
||||
return getModelResourceLocation(woodType, properties, block.getRegistryName().getResourceDomain());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,10 +97,10 @@ public class WoodTypeStateMapper extends StateMapperBase implements IWoodStateMa
|
||||
return new ModelResourceLocation(Constants.MOD_ID + ':' + resourceLocation, propertyString);
|
||||
}
|
||||
|
||||
private ModelResourceLocation getForestryModelResourceLocation(IWoodType woodType, Map<IProperty<?>, Comparable<?>> properties) {
|
||||
private ModelResourceLocation getModelResourceLocation(IWoodType woodType, Map<IProperty<?>, Comparable<?>> properties, String modID) {
|
||||
String resourceLocation = "arboriculture/" + blockPath + '/' + woodType;
|
||||
String propertyString = this.getPropertyString(properties);
|
||||
return new ModelResourceLocation(Constants.MOD_ID + ':' + resourceLocation, propertyString);
|
||||
return new ModelResourceLocation(modID + ':' + resourceLocation, propertyString);
|
||||
}
|
||||
|
||||
private ModelResourceLocation getVanillaModelResourceLocation(Block block, IWoodType woodType, Map<IProperty<?>, Comparable<?>> properties) {
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.arboriculture.items;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.arboriculture.IWoodTyped;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.BlockArbSlab;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -29,5 +30,14 @@ public class ItemBlockWood<B extends Block & IWoodTyped> extends ItemBlockForest
|
||||
IWoodType woodType = wood.getWoodType(meta);
|
||||
return WoodHelper.getDisplayName(wood, woodType);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
B block = getBlock();
|
||||
if (block.isFireproof()) {
|
||||
return 0;
|
||||
} else {
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,13 @@ public class ItemBlockWoodDoor extends ItemBlockWood<BlockArbDoor> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
if (getBlock().isFireproof()) {
|
||||
return 0;
|
||||
} else {
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package forestry.arboriculture.items;
|
||||
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.arboriculture.WoodHelper;
|
||||
import forestry.arboriculture.blocks.BlockArbSlab;
|
||||
import forestry.arboriculture.blocks.BlockForestrySlab;
|
||||
import net.minecraft.item.ItemSlab;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,4 +19,14 @@ public class ItemBlockWoodSlab extends ItemSlab {
|
||||
IWoodType woodType = wood.getWoodType(meta);
|
||||
return WoodHelper.getDisplayName(wood, woodType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
BlockForestrySlab forestrySlab = (BlockForestrySlab) this.block;
|
||||
if (forestrySlab.isFireproof()) {
|
||||
return 0;
|
||||
} else {
|
||||
return 150;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,9 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable, ICol
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
addCreativeItems(subItems, true);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
addCreativeItems(subItems, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCreativeItems(NonNullList<ItemStack> subItems, boolean hideSecrets) {
|
||||
@@ -216,4 +218,9 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable, ICol
|
||||
}
|
||||
return tree.getGenome().getSappiness() * 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
@@ -13,25 +13,27 @@ package forestry.arboriculture.models;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.ModelUtil;
|
||||
import net.minecraft.client.renderer.block.model.ModelBlockDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelBlockDefinition.MissingVariantException;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.model.VariantList;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.ModelUtil;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public enum WoodModelLoader implements ICustomModelLoader {
|
||||
INSTANCE;
|
||||
|
||||
public static final List<String> validFiles = new ArrayList<>();
|
||||
public boolean isEnabled = false;
|
||||
|
||||
static {
|
||||
validFiles.add("door");
|
||||
@@ -51,7 +53,7 @@ public enum WoodModelLoader implements ICustomModelLoader {
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation) {
|
||||
if (!isEnabled || !(modelLocation instanceof ModelResourceLocation)
|
||||
if (!(modelLocation instanceof ModelResourceLocation)
|
||||
|| !modelLocation.getResourceDomain().equals(Constants.MOD_ID)
|
||||
|| !modelLocation.getResourcePath().contains("arboriculture")) {
|
||||
return false;
|
||||
|
||||
@@ -10,6 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -19,37 +28,28 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.internal.Streams;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.arboriculture.models.WoodTexture;
|
||||
import forestry.arboriculture.models.WoodTexture.SimpleTexture;
|
||||
import forestry.arboriculture.models.WoodTexture.TextureMap;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
import forestry.api.arboriculture.WoodBlockKind;
|
||||
import forestry.arboriculture.models.WoodTexture.SimpleTexture;
|
||||
import forestry.arboriculture.models.WoodTexture.TextureMap;
|
||||
import forestry.core.utils.Log;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WoodTextureManager {
|
||||
protected static final Map<String, WoodTexture> WOOD_TEXTURES = new HashMap<>();
|
||||
public static final String KIND_KEY = "kind";
|
||||
public static final ResourceLocation LOCATION = new ResourceLocation("forestry:textures/woodTextures.json");
|
||||
public static final String LOCATION = "/assets/forestry/textures/wood_textures.json";
|
||||
|
||||
public static void parseFile(IResourceManager resourceManager) {
|
||||
try {
|
||||
InputStream stream = resourceManager.getResource(LOCATION).getInputStream();
|
||||
JsonReader reader = null;
|
||||
try {
|
||||
reader = new JsonReader(new BufferedReader(new InputStreamReader(stream)));
|
||||
public static void parseFile() {
|
||||
try (InputStream stream = WoodTextureManager.class.getResourceAsStream(LOCATION)) {
|
||||
if (stream == null){
|
||||
return;
|
||||
}
|
||||
try (JsonReader reader = new JsonReader(new BufferedReader(new InputStreamReader(stream)))){
|
||||
JsonElement json = Streams.parse(reader);
|
||||
if (json.isJsonObject()) {
|
||||
JsonObject jsonObject = json.getAsJsonObject();
|
||||
@@ -62,14 +62,10 @@ public class WoodTextureManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
if (!(e instanceof FileNotFoundException)) {
|
||||
e.printStackTrace();
|
||||
Log.error("Error finding wood textures.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,9 +74,9 @@ public class WoodTextureManager {
|
||||
WOOD_TEXTURES.put(key, createSimpleTexture(object));
|
||||
}
|
||||
|
||||
private static void addTextureMap(String key, JsonArray jaonArray){
|
||||
private static void addTextureMap(String key, JsonArray jsonArray){
|
||||
ImmutableMap.Builder<String, SimpleTexture> textures = new ImmutableMap.Builder<>();
|
||||
for (JsonElement elementEntry : jaonArray) {
|
||||
for (JsonElement elementEntry : jsonArray) {
|
||||
if (elementEntry.isJsonObject()) {
|
||||
JsonObject obj = elementEntry.getAsJsonObject();
|
||||
String kind = getKind(obj);
|
||||
@@ -122,11 +118,13 @@ public class WoodTextureManager {
|
||||
return new SimpleTexture(locations.build());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static WoodTexture getKindTexture(WoodBlockKind blockKind){
|
||||
String kindName = blockKind.getName();
|
||||
return WOOD_TEXTURES.get(kindName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static WoodTexture getTexture(IWoodType woodType){
|
||||
String woodName = woodType.getName();
|
||||
woodName = woodName.toLowerCase(Locale.ENGLISH);
|
||||
|
||||
@@ -10,12 +10,33 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.proxy;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.model.multipart.Multipart;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.ColorizerFoliage;
|
||||
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.IWoodItemMeshDefinition;
|
||||
import forestry.api.arboriculture.IWoodStateMapper;
|
||||
import forestry.api.arboriculture.IWoodType;
|
||||
@@ -35,22 +56,6 @@ import forestry.core.models.BlockModelEntry;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.models.SimpleRetexturedModel;
|
||||
import forestry.core.models.WoodModelEntry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.model.multipart.Multipart;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.ColorizerFoliage;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
@@ -110,7 +115,6 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
|
||||
@SubscribeEvent
|
||||
public <T extends Block & IWoodTyped> void onModelBake(ModelBakeEvent event) {
|
||||
WoodModelLoader.INSTANCE.isEnabled = true;
|
||||
IRegistry<ModelResourceLocation, IBakedModel> registry = event.getModelRegistry();
|
||||
|
||||
for (WoodModelEntry<T> entry : woodModelEntrys) {
|
||||
@@ -145,28 +149,27 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
ImmutableMap<String, String> textures, IWoodType woodType, WoodBlockKind woodKind, ItemStack itemStack,
|
||||
IWoodItemMeshDefinition woodDefinition) {
|
||||
if (woodKind != WoodBlockKind.DOOR) {
|
||||
IModel basicItemModel = ModelLoaderRegistry
|
||||
.getModelOrMissing(woodDefinition.getDefaultModelLocation(itemStack));
|
||||
ResourceLocation defaultModelLocation = woodDefinition.getDefaultModelLocation(itemStack);
|
||||
IModel basicItemModel = ModelLoaderRegistry.getModelOrMissing(defaultModelLocation);
|
||||
ModelResourceLocation basicItemLocation = woodDefinition.getModelLocation(itemStack);
|
||||
|
||||
registry.putObject(basicItemLocation,
|
||||
new SimpleRetexturedModel(woodKind.retextureModel(basicItemModel, woodType, textures)));
|
||||
IModel retextureModel = woodKind.retextureModel(basicItemModel, woodType, textures);
|
||||
registry.putObject(basicItemLocation, new SimpleRetexturedModel(retextureModel));
|
||||
}
|
||||
}
|
||||
|
||||
private void retexturBlockModel(IRegistry<ModelResourceLocation, IBakedModel> registry,
|
||||
ImmutableMap<String, String> textures, IWoodType woodType, WoodBlockKind woodKind, IBlockState blockState,
|
||||
IWoodStateMapper woodMapper) {
|
||||
IModel basicModel = ModelLoaderRegistry
|
||||
.getModelOrMissing(woodMapper.getDefaultModelResourceLocation(blockState));
|
||||
ModelResourceLocation defaultModelResourceLocation = woodMapper.getDefaultModelResourceLocation(blockState);
|
||||
IModel basicModel = ModelLoaderRegistry.getModelOrMissing(defaultModelResourceLocation);
|
||||
if (basicModel instanceof MultipartModel) {
|
||||
MultipartModel multipartModel = (MultipartModel) basicModel;
|
||||
Multipart multipart = multipartModel.getMultipart();
|
||||
multipart.setStateContainer(blockState.getBlock().getBlockState());
|
||||
}
|
||||
ModelResourceLocation basicLocation = woodMapper.getModelLocation(blockState);
|
||||
registry.putObject(basicLocation,
|
||||
new SimpleRetexturedModel(woodKind.retextureModel(basicModel, woodType, textures)));
|
||||
IModel retextureModel = woodKind.retextureModel(basicModel, woodType, textures);
|
||||
registry.putObject(basicLocation, new SimpleRetexturedModel(retextureModel));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,32 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.oredict.OreDictionary;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -52,7 +71,6 @@ import forestry.core.network.PacketRegistryCore;
|
||||
import forestry.core.owner.GameProfileDataSerializer;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.core.render.TextureManagerForestry;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
@@ -60,23 +78,6 @@ import forestry.core.utils.OreDictUtil;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.CORE, name = "Core", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.core.description")
|
||||
public class PluginCore extends BlankForestryPlugin {
|
||||
@@ -162,8 +163,6 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
alleleHelper.init();
|
||||
|
||||
Proxies.render.initRendering();
|
||||
|
||||
RecipeSorter.register("forestry:shaped", ShapedRecipeCustom.class, RecipeSorter.Category.SHAPED, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,16 +259,16 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
if (Config.isCraftingBronzeEnabled()) {
|
||||
ItemStack ingotBronze = items.ingotBronze.copy();
|
||||
ingotBronze.setCount(4);
|
||||
RecipeUtil.addShapelessRecipe(ingotBronze, OreDictUtil.INGOT_TIN, OreDictUtil.INGOT_COPPER, OreDictUtil.INGOT_COPPER, OreDictUtil.INGOT_COPPER);
|
||||
RecipeUtil.addShapelessRecipe("bronze_ingot", ingotBronze, OreDictUtil.INGOT_TIN, OreDictUtil.INGOT_COPPER, OreDictUtil.INGOT_COPPER, OreDictUtil.INGOT_COPPER);
|
||||
}
|
||||
|
||||
/* STURDY MACHINE */
|
||||
RecipeUtil.addRecipe(items.sturdyCasing, "###", "# #", "###", '#', OreDictUtil.INGOT_BRONZE);
|
||||
RecipeUtil.addRecipe("sturdy_casing", items.sturdyCasing, "###", "# #", "###", '#', OreDictUtil.INGOT_BRONZE);
|
||||
|
||||
// / EMPTY CANS
|
||||
int canAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.can");
|
||||
ItemStack canOutput = fluidItems.canEmpty.getItemStack(canAmount);
|
||||
RecipeUtil.addRecipe(canOutput, " # ", "# #", '#', OreDictUtil.INGOT_TIN);
|
||||
RecipeUtil.addRecipe("tin_can", canOutput, " # ", "# #", '#', OreDictUtil.INGOT_TIN);
|
||||
|
||||
// / GEARS
|
||||
List<ItemStack> stoneGear = OreDictionary.getOres(OreDictUtil.GEAR_STONE);
|
||||
@@ -279,27 +278,27 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
} else {
|
||||
gearCenter = OreDictUtil.INGOT_COPPER;
|
||||
}
|
||||
RecipeUtil.addRecipe(items.gearBronze, " # ", "#X#", " # ", '#', OreDictUtil.INGOT_BRONZE, 'X', gearCenter);
|
||||
RecipeUtil.addRecipe(items.gearCopper, " # ", "#X#", " # ", '#', OreDictUtil.INGOT_COPPER, 'X', gearCenter);
|
||||
RecipeUtil.addRecipe(items.gearTin, " # ", "#X#", " # ", '#', OreDictUtil.INGOT_TIN, 'X', gearCenter);
|
||||
RecipeUtil.addRecipe("gear_bronze", items.gearBronze, " # ", "#X#", " # ", '#', OreDictUtil.INGOT_BRONZE, 'X', gearCenter);
|
||||
RecipeUtil.addRecipe("gear_copper", items.gearCopper, " # ", "#X#", " # ", '#', OreDictUtil.INGOT_COPPER, 'X', gearCenter);
|
||||
RecipeUtil.addRecipe("gear_tin", items.gearTin, " # ", "#X#", " # ", '#', OreDictUtil.INGOT_TIN, 'X', gearCenter);
|
||||
|
||||
// / SURVIVALIST TOOLS
|
||||
RecipeUtil.addRecipe(items.bronzePickaxe, " X ", " X ", "###", '#', OreDictUtil.INGOT_BRONZE, 'X', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addRecipe(items.bronzeShovel, " X ", " X ", " # ", '#', OreDictUtil.INGOT_BRONZE, 'X', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addShapelessRecipe(items.kitPickaxe, items.bronzePickaxe, items.carton);
|
||||
RecipeUtil.addShapelessRecipe(items.kitShovel, items.bronzeShovel, items.carton);
|
||||
RecipeUtil.addRecipe("bronze_pickaxe", items.bronzePickaxe, " X ", " X ", "###", '#', OreDictUtil.INGOT_BRONZE, 'X', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addRecipe("bronze_shovel", items.bronzeShovel, " X ", " X ", " # ", '#', OreDictUtil.INGOT_BRONZE, 'X', OreDictUtil.STICK_WOOD);
|
||||
RecipeUtil.addShapelessRecipe("pickaxe_kit", items.kitPickaxe, items.bronzePickaxe, items.carton);
|
||||
RecipeUtil.addShapelessRecipe("shovel_kit", items.kitShovel, items.bronzeShovel, items.carton);
|
||||
|
||||
/* NATURALIST'S ARMOR */
|
||||
RecipeUtil.addRecipe(items.spectacles, " X ", "Y Y", 'X', OreDictUtil.INGOT_BRONZE, 'Y', OreDictUtil.PANE_GLASS);
|
||||
RecipeUtil.addRecipe("spectacles", items.spectacles, " X ", "Y Y", 'X', OreDictUtil.INGOT_BRONZE, 'Y', OreDictUtil.PANE_GLASS);
|
||||
|
||||
// / WRENCH
|
||||
RecipeUtil.addRecipe(items.wrench, "# #", " # ", " # ", '#', OreDictUtil.INGOT_BRONZE);
|
||||
RecipeUtil.addRecipe("wrench", items.wrench, "# #", " # ", " # ", '#', OreDictUtil.INGOT_BRONZE);
|
||||
|
||||
// / CAMOUFLAGE SPRAY CAN
|
||||
RecipeUtil.addRecipe(items.camouflageSprayCan, "TTT", "TCT", "TCT", 'T', OreDictUtil.INGOT_TIN, 'C', items.craftingMaterial.getCamouflagedPaneling());
|
||||
RecipeUtil.addRecipe("camoflage_spray_can", items.camouflageSprayCan, "TTT", "TCT", "TCT", 'T', OreDictUtil.INGOT_TIN, 'C', items.craftingMaterial.getCamouflagedPaneling());
|
||||
|
||||
// / WEB
|
||||
RecipeUtil.addRecipe(new ItemStack(Blocks.WEB, 4), "# #", " # ", "# #", '#', items.craftingMaterial.getSilkWisp());
|
||||
RecipeUtil.addRecipe("silk_wisp_to_web", new ItemStack(Blocks.WEB, 4), "# #", " # ", "# #", '#', items.craftingMaterial.getSilkWisp());
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
// / CARPENTER
|
||||
@@ -321,7 +320,7 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
'Y', OreDictUtil.DYE_YELLOW);
|
||||
} else {
|
||||
// Portable ANALYZER
|
||||
RecipeUtil.addRecipe(items.portableAlyzer.getItemStack(),
|
||||
RecipeUtil.addRecipe("portable_alyzer", items.portableAlyzer.getItemStack(),
|
||||
"X#X",
|
||||
"X#X",
|
||||
"RDR",
|
||||
@@ -330,19 +329,18 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
'R', OreDictUtil.DUST_REDSTONE,
|
||||
'D', OreDictUtil.GEM_DIAMOND);
|
||||
// Camouflaged Paneling
|
||||
RecipeUtil.addRecipe(items.craftingMaterial.getCamouflagedPaneling(8),
|
||||
RecipeUtil.addRecipe("camoflaged_paneling", items.craftingMaterial.getCamouflagedPaneling(8),
|
||||
"WWW",
|
||||
"YBR",
|
||||
"WWW",
|
||||
'W', OreDictUtil.PLANK_WOOD,
|
||||
'D', OreDictUtil.DUST_REDSTONE,
|
||||
'Y', OreDictUtil.DYE_YELLOW,
|
||||
'B', OreDictUtil.DYE_BLUE,
|
||||
'R', OreDictUtil.DYE_RED);
|
||||
}
|
||||
|
||||
// ANALYZER
|
||||
RecipeUtil.addRecipe(blocks.analyzer,
|
||||
RecipeUtil.addRecipe("alyzer", blocks.analyzer,
|
||||
"XTX",
|
||||
" Y ",
|
||||
"X X",
|
||||
@@ -353,46 +351,46 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
// Manure and Fertilizer
|
||||
int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
|
||||
if (compostWheatAmount > 0) {
|
||||
ItemStack compost = items.fertilizerBio.getItemStack(compostWheatAmount);
|
||||
RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', OreDictUtil.CROP_WHEAT);
|
||||
ItemStack compost = items.compost.getItemStack(compostWheatAmount);
|
||||
RecipeUtil.addRecipe("wheat_to_compost", compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', OreDictUtil.CROP_WHEAT);
|
||||
}
|
||||
|
||||
int compostAshAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.ash");
|
||||
if (compostAshAmount > 0) {
|
||||
ItemStack compost = items.fertilizerBio.getItemStack(compostAshAmount);
|
||||
RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', OreDictUtil.DUST_ASH);
|
||||
ItemStack compost = items.compost.getItemStack(compostAshAmount);
|
||||
RecipeUtil.addRecipe("ash_to_compost", compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', OreDictUtil.DUST_ASH);
|
||||
}
|
||||
|
||||
int fertilizerApatiteAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.fertilizer.apatite");
|
||||
if (fertilizerApatiteAmount > 0) {
|
||||
ItemStack fertilizer = items.fertilizerCompound.getItemStack(fertilizerApatiteAmount);
|
||||
RecipeUtil.addRecipe(fertilizer, " # ", " X ", " # ", '#', OreDictUtil.SAND, 'X', OreDictUtil.GEM_APATITE);
|
||||
RecipeUtil.addRecipe("sand_to_fertilizer", fertilizer, " # ", " X ", " # ", '#', OreDictUtil.SAND, 'X', OreDictUtil.GEM_APATITE);
|
||||
}
|
||||
|
||||
int fertilizerAshAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.fertilizer.ash");
|
||||
if (fertilizerAshAmount > 0) {
|
||||
ItemStack fertilizer = items.fertilizerCompound.getItemStack(fertilizerAshAmount);
|
||||
RecipeUtil.addRecipe(fertilizer, "###", "#X#", "###", '#', OreDictUtil.DUST_ASH, 'X', OreDictUtil.GEM_APATITE);
|
||||
RecipeUtil.addRecipe("ash_to_fertilizer", fertilizer, "###", "#X#", "###", '#', OreDictUtil.DUST_ASH, 'X', OreDictUtil.GEM_APATITE);
|
||||
}
|
||||
|
||||
// Humus
|
||||
int humusCompostAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.humus.compost");
|
||||
if (humusCompostAmount > 0) {
|
||||
ItemStack humus = new ItemStack(blocks.humus, humusCompostAmount);
|
||||
RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerBio);
|
||||
RecipeUtil.addRecipe("compost_humus", humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.compost);
|
||||
}
|
||||
|
||||
int humusFertilizerAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.humus.fertilizer");
|
||||
if (humusFertilizerAmount > 0) {
|
||||
ItemStack humus = new ItemStack(blocks.humus, humusFertilizerAmount);
|
||||
RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerCompound);
|
||||
RecipeUtil.addRecipe("fertilizer_humus", humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerCompound);
|
||||
}
|
||||
|
||||
// Bog earth
|
||||
int bogEarthOutputBucket = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.bucket");
|
||||
if (bogEarthOutputBucket > 0) {
|
||||
ItemStack bogEarth = blocks.bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, bogEarthOutputBucket);
|
||||
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', Items.WATER_BUCKET, 'Y', OreDictUtil.SAND);
|
||||
RecipeUtil.addRecipe("bucket_bog_earth", bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', Items.WATER_BUCKET, 'Y', OreDictUtil.SAND);
|
||||
}
|
||||
|
||||
int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can");
|
||||
@@ -401,46 +399,46 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
ItemStack canWater = fluidItems.getContainer(EnumContainerType.CAN, FluidRegistry.WATER);
|
||||
ItemStack waxCapsuleWater = fluidItems.getContainer(EnumContainerType.CAPSULE, FluidRegistry.WATER);
|
||||
ItemStack refractoryWater = fluidItems.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);
|
||||
RecipeUtil.addRecipe("can_bog_earth", bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', canWater, 'Y', OreDictUtil.SAND);
|
||||
RecipeUtil.addRecipe("capsule_bog_earth", bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waxCapsuleWater, 'Y', OreDictUtil.SAND);
|
||||
RecipeUtil.addRecipe("refractory_capsule_bog_earth", bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', refractoryWater, 'Y', OreDictUtil.SAND);
|
||||
}
|
||||
|
||||
// Crafting Material
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.STRING), "#", "#", "#", '#', items.craftingMaterial.getSilkWisp());
|
||||
RecipeUtil.addRecipe("silk_to_string", new ItemStack(Items.STRING), "#", "#", "#", '#', items.craftingMaterial.getSilkWisp());
|
||||
|
||||
// / Pipette
|
||||
RecipeUtil.addRecipe(items.pipette, " #", " X ", "X ", 'X', OreDictUtil.PANE_GLASS, '#', new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE));
|
||||
RecipeUtil.addRecipe("pipette", items.pipette, " #", " X ", "X ", 'X', OreDictUtil.PANE_GLASS, '#', new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE));
|
||||
|
||||
// Storage Blocks
|
||||
{
|
||||
RecipeUtil.addRecipe(blocks.resourceStorageApatite, "###", "###", "###", '#', OreDictUtil.GEM_APATITE);
|
||||
RecipeUtil.addRecipe("apatite_block", blocks.resourceStorageApatite, "###", "###", "###", '#', OreDictUtil.GEM_APATITE);
|
||||
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(items.apatite, 9), OreDictUtil.BLOCK_APATITE);
|
||||
RecipeUtil.addShapelessRecipe("block_to_apatite", new ItemStack(items.apatite, 9), OreDictUtil.BLOCK_APATITE);
|
||||
}
|
||||
|
||||
{
|
||||
RecipeUtil.addRecipe(blocks.resourceStorageCopper, "###", "###", "###", '#', OreDictUtil.INGOT_COPPER);
|
||||
RecipeUtil.addRecipe("copper_block", blocks.resourceStorageCopper, "###", "###", "###", '#', OreDictUtil.INGOT_COPPER);
|
||||
|
||||
ItemStack ingotCopper = items.ingotCopper.copy();
|
||||
ingotCopper.setCount(9);
|
||||
RecipeUtil.addShapelessRecipe(ingotCopper, OreDictUtil.BLOCK_COPPER);
|
||||
RecipeUtil.addShapelessRecipe("block_to_copper", ingotCopper, OreDictUtil.BLOCK_COPPER);
|
||||
}
|
||||
|
||||
{
|
||||
RecipeUtil.addRecipe(blocks.resourceStorageTin, "###", "###", "###", '#', OreDictUtil.INGOT_TIN);
|
||||
RecipeUtil.addRecipe("tin_block", blocks.resourceStorageTin, "###", "###", "###", '#', OreDictUtil.INGOT_TIN);
|
||||
|
||||
ItemStack ingotTin = items.ingotTin.copy();
|
||||
ingotTin.setCount(9);
|
||||
RecipeUtil.addShapelessRecipe(ingotTin, OreDictUtil.BLOCK_TIN);
|
||||
RecipeUtil.addShapelessRecipe("block_to_tin", ingotTin, OreDictUtil.BLOCK_TIN);
|
||||
}
|
||||
|
||||
{
|
||||
RecipeUtil.addRecipe(blocks.resourceStorageBronze, "###", "###", "###", '#', OreDictUtil.INGOT_BRONZE);
|
||||
RecipeUtil.addRecipe("bronze_block", blocks.resourceStorageBronze, "###", "###", "###", '#', OreDictUtil.INGOT_BRONZE);
|
||||
|
||||
ItemStack ingotBronze = items.ingotBronze.copy();
|
||||
ingotBronze.setCount(9);
|
||||
RecipeUtil.addShapelessRecipe(ingotBronze, OreDictUtil.BLOCK_BRONZE);
|
||||
RecipeUtil.addShapelessRecipe("block_to_bronze", ingotBronze, OreDictUtil.BLOCK_BRONZE);
|
||||
}
|
||||
|
||||
// alternate recipes
|
||||
@@ -466,37 +464,12 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
return new ICommand[]{rootCommand};
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new FuelHandler(getItems());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getHiddenItems(List<ItemStack> hiddenItems) {
|
||||
// research note items are not useful without actually having completed research
|
||||
hiddenItems.add(new ItemStack(getItems().researchNote));
|
||||
}
|
||||
|
||||
private static class FuelHandler implements IFuelHandler {
|
||||
private final ItemRegistryCore items;
|
||||
|
||||
public FuelHandler(ItemRegistryCore items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel) {
|
||||
if (fuel != null && fuel.getItem() == items.peat) {
|
||||
return 2000;
|
||||
}
|
||||
if (fuel != null && fuel.getItem() == items.bituminousPeat) {
|
||||
return 4200;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onBakeModels(ModelBakeEvent event) {
|
||||
|
||||
@@ -42,10 +42,12 @@ public class ItemCircuitBoard extends ItemForestry implements IColoredItem {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.BASIC, null, new ICircuit[]{}));
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.ENHANCED, null, new ICircuit[]{}));
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.REFINED, null, new ICircuit[]{}));
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.INTRICATE, null, new ICircuit[]{}));
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.BASIC, null, new ICircuit[]{}));
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.ENHANCED, null, new ICircuit[]{}));
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.REFINED, null, new ICircuit[]{}));
|
||||
subItems.add(createCircuitboard(EnumCircuitBoardType.INTRICATE, null, new ICircuit[]{}));
|
||||
}
|
||||
}
|
||||
|
||||
/* MODELS*/
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.core.fluids;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -107,7 +106,7 @@ public final class FluidHelper {
|
||||
|
||||
boolean moveToOutput = fluidInContainer.amount >= containerCapacity;
|
||||
if (moveToOutput) {
|
||||
if (!output.isEmpty() && (output.getCount() >= output.getMaxStackSize() || !InventoryUtil.isItemEqual(filled, output))) {
|
||||
if (!output.isEmpty() && (output.getCount() >= output.getMaxStackSize() || !ItemStackUtil.areItemStacksEqualIgnoreCount(filled, output))) {
|
||||
return FillStatus.NO_SPACE;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package forestry.core.genetics;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
@@ -26,6 +25,7 @@ import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.utils.Log;
|
||||
|
||||
public abstract class Genome implements IGenome {
|
||||
private static final String SLOT_TAG = "Slot";
|
||||
@@ -138,12 +138,23 @@ public abstract class Genome implements IGenome {
|
||||
|
||||
private static IChromosome getChromosome(ItemStack itemStack, IChromosomeType chromosomeType, ISpeciesRoot speciesRoot) {
|
||||
NBTTagCompound nbtTagCompound = itemStack.getTagCompound();
|
||||
Preconditions.checkArgument(nbtTagCompound != null, "itemStack must have nbt");
|
||||
if (nbtTagCompound == null) {
|
||||
nbtTagCompound = new NBTTagCompound();
|
||||
itemStack.setTagCompound(nbtTagCompound);
|
||||
}
|
||||
|
||||
NBTTagCompound genome = nbtTagCompound.getCompoundTag("Genome");
|
||||
Preconditions.checkArgument(!genome.hasNoTags(), "itemStack nbt must have a genome tag");
|
||||
NBTTagCompound genomeNbt = nbtTagCompound.getCompoundTag("Genome");
|
||||
if (genomeNbt.hasNoTags()) {
|
||||
Log.error("Got a genetic item with no genome, setting it to a default value.");
|
||||
genomeNbt = new NBTTagCompound();
|
||||
|
||||
IAllele[] defaultTemplate = speciesRoot.getDefaultTemplate();
|
||||
IGenome genome = speciesRoot.templateAsGenome(defaultTemplate);
|
||||
genome.writeToNBT(genomeNbt);
|
||||
nbtTagCompound.setTag("Genome", genomeNbt);
|
||||
}
|
||||
|
||||
IChromosome[] chromosomes = getChromosomes(genome, speciesRoot);
|
||||
IChromosome[] chromosomes = getChromosomes(genomeNbt, speciesRoot);
|
||||
|
||||
return chromosomes[chromosomeType.ordinal()];
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
import forestry.factory.tiles.ICrafterWorktable;
|
||||
|
||||
public class SlotCrafter extends Slot {
|
||||
@@ -27,7 +27,7 @@ public class SlotCrafter extends Slot {
|
||||
/**
|
||||
* The craft matrix inventory linked to this result slot.
|
||||
*/
|
||||
private final IInventory craftMatrix;
|
||||
private final InventoryCraftingForestry craftMatrix;
|
||||
private final ICrafterWorktable crafter;
|
||||
|
||||
/**
|
||||
@@ -38,9 +38,9 @@ public class SlotCrafter extends Slot {
|
||||
* The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset.
|
||||
*/
|
||||
private int amountCrafted;
|
||||
|
||||
public SlotCrafter(EntityPlayer player, IInventory craftMatrix, ICrafterWorktable crafter, int slot, int xPos, int yPos) {
|
||||
super(craftMatrix, slot, xPos, yPos);
|
||||
|
||||
public SlotCrafter(EntityPlayer player, InventoryCraftingForestry craftMatrix, IInventory craftingDisplay, ICrafterWorktable crafter, int slot, int xPos, int yPos) {
|
||||
super(craftingDisplay, slot, xPos, yPos);
|
||||
this.craftMatrix = craftMatrix;
|
||||
this.crafter = crafter;
|
||||
this.player = player;
|
||||
@@ -75,12 +75,9 @@ public class SlotCrafter extends Slot {
|
||||
}
|
||||
|
||||
this.amountCrafted = 0;
|
||||
InventoryCraftResult inventorycraftresult = (InventoryCraftResult) this.inventory;
|
||||
IRecipe irecipe = inventorycraftresult.getRecipeUsed();
|
||||
|
||||
IRecipe irecipe = crafter.getRecipeUsed();
|
||||
if (irecipe != null && !irecipe.isHidden()) {
|
||||
this.player.unlockRecipes(Lists.newArrayList(irecipe));
|
||||
inventorycraftresult.setRecipeUsed(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +97,7 @@ public class SlotCrafter extends Slot {
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return crafter.getResult();
|
||||
return crafter.getResult(craftMatrix, player.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,8 +59,10 @@ public class ItemCraftingMaterial extends ItemForestry {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < definition.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < definition.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +66,13 @@ public class ItemElectronTube extends ItemOverlay {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < overlays.length; i++) {
|
||||
if (Config.isDebug || !overlays[i].isSecret()) {
|
||||
ItemStack itemStack = new ItemStack(this, 1, i);
|
||||
if (Config.isDebug || !getCircuits(itemStack).isEmpty()) {
|
||||
subItems.add(itemStack);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < overlays.length; i++) {
|
||||
if (Config.isDebug || !overlays[i].isSecret()) {
|
||||
ItemStack itemStack = new ItemStack(this, 1, i);
|
||||
if (Config.isDebug || !getCircuits(itemStack).isEmpty()) {
|
||||
subItems.add(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,16 +68,18 @@ public class ItemFluidContainerForestry extends ItemForestry {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
// empty
|
||||
subItems.add(new ItemStack(this));
|
||||
|
||||
// filled
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
IFluidHandlerItem fluidHandler = new FluidHandlerItemForestry(itemStack, type);
|
||||
if (fluidHandler.fill(new FluidStack(fluid, Fluid.BUCKET_VOLUME), true) == Fluid.BUCKET_VOLUME) {
|
||||
ItemStack filled = fluidHandler.getContainer();
|
||||
subItems.add(filled);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
// empty
|
||||
subItems.add(new ItemStack(this));
|
||||
|
||||
// filled
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
IFluidHandlerItem fluidHandler = new FluidHandlerItemForestry(itemStack, type);
|
||||
if (fluidHandler.fill(new FluidStack(fluid, Fluid.BUCKET_VOLUME), true) == Fluid.BUCKET_VOLUME) {
|
||||
ItemStack filled = fluidHandler.getContainer();
|
||||
subItems.add(filled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +89,10 @@ public class ItemFruit extends ItemForestryFood {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < EnumFruit.values().length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < EnumFruit.values().length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,11 @@ public class ItemOverlay extends ItemForestry implements IColoredItem {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < overlays.length; i++) {
|
||||
if (Config.isDebug || !overlays[i].isSecret()) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
for (int i = 0; i < overlays.length; i++) {
|
||||
if (Config.isDebug || !overlays[i].isSecret()) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class ItemRegistryCore extends ItemRegistry {
|
||||
/* Fertilizer */
|
||||
public final ItemForestry fertilizerBio;
|
||||
public final ItemForestry compost;
|
||||
public final ItemFertilizer fertilizerCompound;
|
||||
|
||||
/* Gems */
|
||||
@@ -91,7 +91,7 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
public final ItemCamouflageSprayCan camouflageSprayCan;
|
||||
|
||||
public ItemRegistryCore() {
|
||||
fertilizerBio = registerItem(new ItemForestry(), "fertilizer_bio");
|
||||
compost = registerItem(new ItemForestry(), "fertilizer_bio");
|
||||
fertilizerCompound = registerItem(new ItemFertilizer(), "fertilizer_compound");
|
||||
|
||||
apatite = registerItem(new ItemForestry(), "apatite");
|
||||
@@ -116,13 +116,25 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
|
||||
spectacles = registerItem(new ItemArmorNaturalist(), "naturalist_helmet");
|
||||
|
||||
peat = registerItem(new ItemForestry(), "peat");
|
||||
peat = new ItemForestry() {
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
return 2000;
|
||||
}
|
||||
};
|
||||
registerItem(peat, "peat");
|
||||
OreDictionary.registerOre(OreDictUtil.BRICK_PEAT, peat);
|
||||
|
||||
ash = registerItem(new ItemForestry(), "ash");
|
||||
OreDictionary.registerOre(OreDictUtil.DUST_ASH, ash);
|
||||
|
||||
bituminousPeat = registerItem(new ItemForestry(), "bituminous_peat");
|
||||
bituminousPeat = new ItemForestry() {
|
||||
@Override
|
||||
public int getItemBurnTime(ItemStack itemStack) {
|
||||
return 4200;
|
||||
}
|
||||
};
|
||||
registerItem(bituminousPeat, "bituminous_peat");
|
||||
|
||||
gearBronze = createItemForOreName(OreDictUtil.GEAR_BRONZE, "gear_bronze");
|
||||
gearCopper = createItemForOreName(OreDictUtil.GEAR_COPPER, "gear_copper");
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.core.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -37,9 +38,7 @@ import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
|
||||
public abstract class RecipeUtil {
|
||||
|
||||
// hack to make unique recipe names.
|
||||
// TODO use json recipes
|
||||
private static int recipeIndex;
|
||||
|
||||
public static void addFermenterRecipes(ItemStack resource, int fermentationValue, Fluids output) {
|
||||
if (RecipeManagers.fermenterManager == null) {
|
||||
@@ -58,140 +57,85 @@ public abstract class RecipeUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static InventoryCraftingForestry getCraftRecipe(NonNullList<ItemStack> recipeItems, NonNullList<ItemStack> availableItems, World world, ItemStack recipeOutput) {
|
||||
// Need at least one matched set
|
||||
if (ItemStackUtil.containsSets(recipeItems, availableItems, true, true) == 0) {
|
||||
public static InventoryCraftingForestry getCraftRecipe(InventoryCrafting originalCrafting, NonNullList<ItemStack> availableItems, World world, IRecipe recipe) {
|
||||
if (!recipe.matches(originalCrafting, world)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check that it doesn't make a different recipe.
|
||||
// For example:
|
||||
// Wood Logs are all ore dictionary equivalent with each other,
|
||||
// but an Oak Log shouldn't be able to make Ebony Wood Planks
|
||||
// because it makes Oak Wood Planks using the same recipe.
|
||||
// Strategy:
|
||||
// Create a fake crafting inventory using items we have in availableItems
|
||||
// in place of the ones in the saved crafting inventory.
|
||||
// Check that the recipe it makes is the same as the currentRecipe.
|
||||
|
||||
ItemStack expectedOutput = recipe.getCraftingResult(originalCrafting);
|
||||
if (expectedOutput.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
InventoryCraftingForestry crafting = new InventoryCraftingForestry();
|
||||
NonNullList<ItemStack> stockCopy = ItemStackUtil.condenseStacks(availableItems);
|
||||
|
||||
for (int slot = 0; slot < recipeItems.size(); slot++) {
|
||||
ItemStack recipeStack = recipeItems.get(slot);
|
||||
if (recipeStack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Use crafting equivalent (not oredict) items first
|
||||
for (ItemStack stockStack : stockCopy) {
|
||||
if (stockStack.getCount() > 0 && ItemStackUtil.isCraftingEquivalent(recipeStack, stockStack, false, false)) {
|
||||
ItemStack stack = ItemStackUtil.createCopyWithCount(stockStack, 1);
|
||||
stockStack.shrink(1);
|
||||
crafting.setInventorySlotContents(slot, stack);
|
||||
break;
|
||||
for (int slot = 0; slot < originalCrafting.getSizeInventory(); slot++) {
|
||||
ItemStack stackInSlot = originalCrafting.getStackInSlot(slot);
|
||||
if (!stackInSlot.isEmpty()) {
|
||||
ItemStack equivalent = getCraftingEquivalent(stockCopy, originalCrafting, slot, world, recipe, expectedOutput);
|
||||
if (equivalent.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
crafting.setInventorySlotContents(slot, equivalent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe.matches(crafting, world)) {
|
||||
ItemStack output = recipe.getCraftingResult(crafting);
|
||||
if (ItemStack.areItemStacksEqual(output, expectedOutput)) {
|
||||
return crafting;
|
||||
}
|
||||
}
|
||||
|
||||
// Use oredict items if crafting equivalent items aren't available
|
||||
if (crafting.getStackInSlot(slot).isEmpty()) {
|
||||
for (ItemStack stockStack : stockCopy) {
|
||||
if (stockStack.getCount() > 0 && ItemStackUtil.isCraftingEquivalent(recipeStack, stockStack, true, true)) {
|
||||
ItemStack stack = ItemStackUtil.createCopyWithCount(stockStack, 1);
|
||||
stockStack.shrink(1);
|
||||
crafting.setInventorySlotContents(slot, stack);
|
||||
break;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ItemStack getCraftingEquivalent(NonNullList<ItemStack> stockCopy, InventoryCrafting crafting, int slot, World world, IRecipe recipe, ItemStack expectedOutput) {
|
||||
ItemStack originalStack = crafting.getStackInSlot(slot);
|
||||
for (ItemStack stockStack : stockCopy) {
|
||||
if (!stockStack.isEmpty()) {
|
||||
ItemStack singleStockStack = ItemStackUtil.createCopyWithCount(stockStack, 1);
|
||||
crafting.setInventorySlotContents(slot, singleStockStack);
|
||||
if (recipe.matches(crafting, world)) {
|
||||
ItemStack output = recipe.getCraftingResult(crafting);
|
||||
if (ItemStack.areItemStacksEqual(output, expectedOutput)) {
|
||||
crafting.setInventorySlotContents(slot, originalStack);
|
||||
return stockStack.splitStack(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ItemStack> outputs = findMatchingRecipes(crafting, world);
|
||||
if (!ItemStackUtil.containsItemStack(outputs, recipeOutput)) {
|
||||
return null;
|
||||
}
|
||||
return crafting;
|
||||
}
|
||||
|
||||
public static NonNullList<ItemStack> findMatchingRecipes(InventoryCrafting inventory, World world) {
|
||||
NonNullList<ItemStack> matchingRecipes = NonNullList.create();
|
||||
ItemStack repairRecipe = findRepairRecipe(inventory);
|
||||
if (!repairRecipe.isEmpty()) {
|
||||
matchingRecipes.add(repairRecipe);
|
||||
return matchingRecipes;
|
||||
}
|
||||
|
||||
for (Object recipe : ForgeRegistries.RECIPES.getValues()) {
|
||||
IRecipe irecipe = (IRecipe) recipe;
|
||||
|
||||
if (irecipe.matches(inventory, world)) {
|
||||
ItemStack result = irecipe.getCraftingResult(inventory);
|
||||
if (!ItemStackUtil.containsItemStack(matchingRecipes, result)) {
|
||||
matchingRecipes.add(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return matchingRecipes;
|
||||
}
|
||||
|
||||
private static ItemStack findRepairRecipe(InventoryCrafting inventory) {
|
||||
int craftIngredientCount = 0;
|
||||
ItemStack itemstack0 = ItemStack.EMPTY;
|
||||
ItemStack itemstack1 = ItemStack.EMPTY;
|
||||
|
||||
for (int j = 0; j < inventory.getSizeInventory(); j++) {
|
||||
ItemStack itemstack = inventory.getStackInSlot(j);
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
if (craftIngredientCount == 0) {
|
||||
itemstack0 = itemstack;
|
||||
}
|
||||
|
||||
if (craftIngredientCount == 1) {
|
||||
itemstack1 = itemstack;
|
||||
}
|
||||
|
||||
++craftIngredientCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (craftIngredientCount == 2 && itemstack0.getItem() == itemstack1.getItem() && itemstack0.getCount() == 1 && itemstack1.getCount() == 1 && itemstack0.getItem().isRepairable()) {
|
||||
int damage0 = itemstack0.getMaxDamage() - itemstack0.getItemDamage();
|
||||
int damage1 = itemstack0.getMaxDamage() - itemstack1.getItemDamage();
|
||||
int repairAmount = damage0 + damage1 + itemstack0.getMaxDamage() * 5 / 100;
|
||||
int repairedDamage = itemstack0.getMaxDamage() - repairAmount;
|
||||
|
||||
if (repairedDamage < 0) {
|
||||
repairedDamage = 0;
|
||||
}
|
||||
|
||||
return new ItemStack(itemstack0.getItem(), 1, repairedDamage);
|
||||
}
|
||||
|
||||
crafting.setInventorySlotContents(slot, originalStack);
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public static void addRecipe(Block block, Object... obj) {
|
||||
addRecipe(new ItemStack(block), obj);
|
||||
public static List<IRecipe> findMatchingRecipes(InventoryCrafting inventory, World world) {
|
||||
return ForgeRegistries.RECIPES.getValues().stream().filter(recipe -> recipe.matches(inventory, world)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static void addRecipe(Item item, Object... obj) {
|
||||
addRecipe(new ItemStack(item), obj);
|
||||
public static void addRecipe(String recipeName, Block block, Object... obj) {
|
||||
addRecipe(recipeName, new ItemStack(block), obj);
|
||||
}
|
||||
|
||||
public static void addRecipe(ItemStack itemstack, Object... obj) {
|
||||
public static void addRecipe(String recipeName, Item item, Object... obj) {
|
||||
addRecipe(recipeName, new ItemStack(item), obj);
|
||||
}
|
||||
|
||||
public static void addRecipe(String recipeName, ItemStack itemstack, Object... obj) {
|
||||
ShapedRecipeCustom recipe = new ShapedRecipeCustom(itemstack, obj);
|
||||
recipe.setRegistryName(Constants.MOD_ID, "Recipe" + recipeIndex++);
|
||||
recipe.setRegistryName(Constants.MOD_ID, recipeName);
|
||||
ForgeRegistries.RECIPES.register(recipe);
|
||||
}
|
||||
|
||||
public static void addShapelessRecipe(Item item, Object... obj) {
|
||||
addShapelessRecipe(new ItemStack(item), obj);
|
||||
public static void addShapelessRecipe(String recipeName, Item item, Object... obj) {
|
||||
addShapelessRecipe(recipeName, new ItemStack(item), obj);
|
||||
}
|
||||
|
||||
public static void addShapelessRecipe(ItemStack itemstack, Object... obj) {
|
||||
public static void addShapelessRecipe(String recipeName, ItemStack itemstack, Object... obj) {
|
||||
ShapelessOreRecipe recipe = new ShapelessOreRecipe(null, itemstack, obj);
|
||||
recipe.setRegistryName(Constants.MOD_ID, "Recipe" + recipeIndex++);
|
||||
recipe.setRegistryName(Constants.MOD_ID, recipeName);
|
||||
ForgeRegistries.RECIPES.register(recipe);
|
||||
}
|
||||
|
||||
@@ -203,6 +147,7 @@ public abstract class RecipeUtil {
|
||||
GameRegistry.addSmelting(res, prod, xp);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String[][] matches(IDescriptiveRecipe recipe, IInventory inventoryCrafting) {
|
||||
NonNullList<NonNullList<ItemStack>> recipeIngredients = recipe.getRawIngredients();
|
||||
NonNullList<String> oreDicts = recipe.getOreDicts();
|
||||
@@ -211,6 +156,7 @@ public abstract class RecipeUtil {
|
||||
return matches(recipeIngredients, oreDicts, width, height, inventoryCrafting);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String[][] matches(NonNullList<NonNullList<ItemStack>> recipeIngredients, NonNullList<String> oreDicts, int width, int height, IInventory inventoryCrafting) {
|
||||
ItemStack[][] resources = getResources(inventoryCrafting);
|
||||
return matches(recipeIngredients, oreDicts, width, height, resources);
|
||||
|
||||
@@ -29,8 +29,6 @@ import forestry.core.utils.Log;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureMapForestry extends TextureMap {
|
||||
private boolean skipFirst = true;
|
||||
|
||||
public TextureMapForestry(String basePathIn) {
|
||||
super(basePathIn, null, true);
|
||||
}
|
||||
@@ -49,44 +47,41 @@ public class TextureMapForestry extends TextureMap {
|
||||
this.mapUploadedSprites.clear();
|
||||
this.listAnimatedSprites.clear();
|
||||
|
||||
ProgressManager.ProgressBar bar = ProgressManager.push("Texture stitching", skipFirst ? 0 : this.mapRegisteredSprites.size());
|
||||
ProgressManager.ProgressBar bar = ProgressManager.push("Texture stitching", this.mapRegisteredSprites.size());
|
||||
|
||||
for (Map.Entry<String, TextureAtlasSprite> entry : this.mapRegisteredSprites.entrySet()) {
|
||||
TextureAtlasSprite textureatlassprite = entry.getValue();
|
||||
ResourceLocation resourcelocation = this.getResourceLocation(textureatlassprite);
|
||||
bar.step(resourcelocation.getResourcePath());
|
||||
IResource iresource = null;
|
||||
|
||||
if (!skipFirst) {
|
||||
for (Map.Entry<String, TextureAtlasSprite> entry : this.mapRegisteredSprites.entrySet()) {
|
||||
TextureAtlasSprite textureatlassprite = entry.getValue();
|
||||
ResourceLocation resourcelocation = this.getResourceLocation(textureatlassprite);
|
||||
bar.step(resourcelocation.getResourcePath());
|
||||
IResource iresource = null;
|
||||
if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) {
|
||||
if (textureatlassprite.load(resourceManager, resourcelocation, l -> mapRegisteredSprites.get(l.toString()))) {
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
try {
|
||||
PngSizeInfo pngsizeinfo = PngSizeInfo.makeFromResource(resourceManager.getResource(resourcelocation));
|
||||
iresource = resourceManager.getResource(resourcelocation);
|
||||
boolean flag = iresource.getMetadata("animation") != null;
|
||||
textureatlassprite.loadSprite(pngsizeinfo, flag);
|
||||
} catch (RuntimeException runtimeexception) {
|
||||
FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage());
|
||||
continue;
|
||||
} catch (IOException ioexception) {
|
||||
FMLClientHandler.instance().trackMissingTexture(resourcelocation);
|
||||
continue;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(iresource);
|
||||
}
|
||||
|
||||
if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation)) {
|
||||
if (textureatlassprite.load(resourceManager, resourcelocation, l -> mapRegisteredSprites.get(l.toString()))) {
|
||||
continue;
|
||||
}
|
||||
} else
|
||||
try {
|
||||
PngSizeInfo pngsizeinfo = PngSizeInfo.makeFromResource(resourceManager.getResource(resourcelocation));
|
||||
iresource = resourceManager.getResource(resourcelocation);
|
||||
boolean flag = iresource.getMetadata("animation") != null;
|
||||
textureatlassprite.loadSprite(pngsizeinfo, flag);
|
||||
} catch (RuntimeException runtimeexception) {
|
||||
FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage());
|
||||
continue;
|
||||
} catch (IOException ioexception) {
|
||||
FMLClientHandler.instance().trackMissingTexture(resourcelocation);
|
||||
continue;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(iresource);
|
||||
}
|
||||
|
||||
stitcher.addSprite(textureatlassprite);
|
||||
}
|
||||
stitcher.addSprite(textureatlassprite);
|
||||
}
|
||||
|
||||
|
||||
ProgressManager.pop(bar);
|
||||
|
||||
this.missingImage.generateMipmaps(0);
|
||||
stitcher.addSprite(this.missingImage);
|
||||
skipFirst = false;
|
||||
bar = ProgressManager.push("Texture creation", 2);
|
||||
|
||||
bar.step("Stitching");
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package forestry.core.utils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.circuits.ISocketable;
|
||||
@@ -32,75 +31,8 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public abstract class InventoryUtil {
|
||||
|
||||
public static boolean isWildcard(ItemStack stack) {
|
||||
return stack.getItemDamage() == OreDictionary.WILDCARD_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* A more robust item comparison function. Supports items with damage = -1
|
||||
* matching any sub-type.
|
||||
*
|
||||
* @param a An ItemStack
|
||||
* @param b An ItemStack
|
||||
* @return True if equal
|
||||
*/
|
||||
public static boolean isItemEqual(ItemStack a, ItemStack b) {
|
||||
return isItemEqual(a, b, true, true);
|
||||
}
|
||||
|
||||
public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) {
|
||||
if (a.isEmpty() || b.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (a.getItem() != b.getItem()) {
|
||||
return false;
|
||||
}
|
||||
if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b)) {
|
||||
return false;
|
||||
}
|
||||
if (matchDamage && a.getHasSubtypes()) {
|
||||
if (isWildcard(a) || isWildcard(b)) {
|
||||
return true;
|
||||
}
|
||||
if (a.getItemDamage() != b.getItemDamage()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the item is equal to any one of several possible matches.
|
||||
*/
|
||||
public static boolean isItemEqual(ItemStack stack, ItemStack... matches) {
|
||||
for (ItemStack match : matches) {
|
||||
if (isItemEqual(stack, match)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the item is equal to any one of several possible matches.
|
||||
*
|
||||
* @param stack the ItemStack to test
|
||||
* @param matches the ItemStacks to test against
|
||||
* @return true if a match is found
|
||||
*/
|
||||
public static boolean isItemEqual(ItemStack stack, Collection<ItemStack> matches) {
|
||||
for (ItemStack match : matches) {
|
||||
if (isItemEqual(stack, match)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to move an ItemStack from one inventory to another.
|
||||
*
|
||||
@@ -218,6 +150,48 @@ public abstract class InventoryUtil {
|
||||
return ItemStackUtil.containsSets(set, stock, oreDicts, craftingTools) >= count;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean deleteExactSet(IInventory inventory, NonNullList<ItemStack> required) {
|
||||
NonNullList<ItemStack> offered = getStacks(inventory);
|
||||
NonNullList<ItemStack> condensedRequired = ItemStackUtil.condenseStacks(required);
|
||||
NonNullList<ItemStack> condensedOffered = ItemStackUtil.condenseStacks(offered);
|
||||
|
||||
for (ItemStack req : condensedRequired) {
|
||||
if (!containsExactStack(req, condensedOffered)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack itemStack : condensedRequired) {
|
||||
deleteExactStack(inventory, itemStack);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean containsExactStack(ItemStack req, NonNullList<ItemStack> condensedOffered) {
|
||||
for (ItemStack offer : condensedOffered) {
|
||||
if (offer.getCount() >= req.getCount() && ItemStackUtil.areItemStacksEqualIgnoreCount(req, offer)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void deleteExactStack(IInventory inventory, ItemStack itemStack) {
|
||||
int count = itemStack.getCount();
|
||||
for (int j = 0; j < inventory.getSizeInventory(); j++) {
|
||||
ItemStack stackInSlot = inventory.getStackInSlot(j);
|
||||
if (!stackInSlot.isEmpty()) {
|
||||
if (ItemStackUtil.areItemStacksEqualIgnoreCount(itemStack, stackInSlot)) {
|
||||
ItemStack removed = inventory.decrStackSize(j, count);
|
||||
count -= removed.getCount();
|
||||
if (count == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static NonNullList<ItemStack> removeSets(IInventory inventory, int count, NonNullList<ItemStack> set, @Nullable EntityPlayer player, boolean stowContainer, boolean oreDictionary, boolean craftingTools) {
|
||||
@@ -394,7 +368,7 @@ public abstract class InventoryUtil {
|
||||
public static boolean tryAddStacksCopy(IInventory inventory, NonNullList<ItemStack> stacks, int startSlot, int slots, boolean all) {
|
||||
|
||||
for (ItemStack stack : stacks) {
|
||||
if (stack == null) {
|
||||
if (stack == null || stack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -594,5 +594,24 @@ public abstract class ItemStackUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks like {@link ItemStack#areItemStacksEqual(ItemStack, ItemStack)}
|
||||
* but ignores stack size (count).
|
||||
*/
|
||||
public static boolean areItemStacksEqualIgnoreCount(ItemStack a, ItemStack b) {
|
||||
if (a.isEmpty() && b.isEmpty()) {
|
||||
return true;
|
||||
} else if (a.isEmpty() || b.isEmpty()) {
|
||||
return false;
|
||||
} else if (a.getItem() != b.getItem()) {
|
||||
return false;
|
||||
} else if (a.getItemDamage() != b.getItemDamage()) {
|
||||
return false;
|
||||
} else if (a.getTagCompound() == null && b.getTagCompound() != null) {
|
||||
return false;
|
||||
} else {
|
||||
return (a.getTagCompound() == null || a.getTagCompound().equals(b.getTagCompound())) && a.areCapsCompatible(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class MigrationHelper {
|
||||
private static Map<String, String> blockRemappings = new HashMap<>();
|
||||
private static Map<String, String> itemRemappings = new HashMap<>();
|
||||
@@ -51,6 +55,7 @@ public class MigrationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMissingBlockMappings(RegistryEvent.MissingMappings<Block> event) {
|
||||
for (RegistryEvent.MissingMappings.Mapping<Block> missingMapping : event.getMappings()) {
|
||||
ResourceLocation resourceLocation = missingMapping.key;
|
||||
@@ -70,6 +75,7 @@ public class MigrationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onMissingItemMappings(RegistryEvent.MissingMappings<Item> event) {
|
||||
for (RegistryEvent.MissingMappings.Mapping<Item> missingMapping : event.getMappings()) {
|
||||
ResourceLocation resourceLocation = missingMapping.key;
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.core.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.gui.slots.SlotCrafter;
|
||||
import forestry.core.gui.slots.SlotForestry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -70,7 +71,7 @@ public abstract class SlotUtil {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
boolean fromCraftingSlot = slot instanceof SlotCrafting;
|
||||
boolean fromCraftingSlot = slot instanceof SlotCrafting || slot instanceof SlotCrafter;
|
||||
|
||||
int numSlots = inventorySlots.size();
|
||||
ItemStack stackInSlot = slot.getStack();
|
||||
@@ -82,7 +83,7 @@ public abstract class SlotUtil {
|
||||
|
||||
slot.onSlotChange(stackInSlot, originalStack);
|
||||
if (stackInSlot.isEmpty()) {
|
||||
slot.putStack(stackInSlot);
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import net.minecraftforge.fml.common.IWorldGenerator;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -54,6 +55,11 @@ public class WorldGenerator implements IWorldGenerator {
|
||||
PluginManager.populateChunk(event.getGen(), event.getWorld(), event.getRand(), event.getChunkX(), event.getChunkZ(), event.isHasVillageGenerated());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void decorateBiome(DecorateBiomeEvent.Post event) {
|
||||
PluginManager.decorateBiome(event.getWorld(), event.getRand(), event.getPos());
|
||||
}
|
||||
|
||||
public void retroGen(Random random, int chunkX, int chunkZ, World world) {
|
||||
generateWorld(random, chunkX, chunkZ, world);
|
||||
PluginManager.populateChunkRetroGen(world, random, chunkX, chunkZ);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PluginEnergy extends BlankForestryPlugin {
|
||||
super.registerRecipes();
|
||||
Preconditions.checkState(blocks != null);
|
||||
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.peatEngine),
|
||||
RecipeUtil.addRecipe("peat_engine", new ItemStack(blocks.peatEngine),
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
@@ -66,7 +66,7 @@ public class PluginEnergy extends BlankForestryPlugin {
|
||||
'Y', "gearCopper",
|
||||
'V', Blocks.PISTON);
|
||||
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.biogasEngine),
|
||||
RecipeUtil.addRecipe("biogas_engine", new ItemStack(blocks.biogasEngine),
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
@@ -76,7 +76,7 @@ public class PluginEnergy extends BlankForestryPlugin {
|
||||
'V', Blocks.PISTON);
|
||||
|
||||
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.clockworkEngine),
|
||||
RecipeUtil.addRecipe("clockwork_engine", new ItemStack(blocks.clockworkEngine),
|
||||
"###",
|
||||
" X ",
|
||||
"ZVY",
|
||||
|
||||
@@ -144,7 +144,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
|
||||
int cyclesCompost = ForestryAPI.activeMode.getIntegerSetting("fermenter.cycles.compost");
|
||||
int valueCompost = ForestryAPI.activeMode.getIntegerSetting("fermenter.value.compost");
|
||||
ItemStack fertilizerBio = coreItems.fertilizerBio.getItemStack();
|
||||
ItemStack fertilizerBio = coreItems.compost.getItemStack();
|
||||
ItemStack mulch = coreItems.mulch.getItemStack();
|
||||
FuelManager.fermenterFuel.put(fertilizerBio, new FermenterFuel(fertilizerBio, valueCompost, cyclesCompost));
|
||||
FuelManager.fermenterFuel.put(mulch, new FermenterFuel(mulch, valueCompost, cyclesCompost));
|
||||
@@ -542,7 +542,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.BLAZE, 1), Circuits.machineSpeedUpgrade2);
|
||||
ChipsetManager.solderManager.addRecipe(layout, coreItems.tubes.get(EnumElectronTube.GOLD, 1), Circuits.machineEfficiencyUpgrade1);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.bottler,
|
||||
RecipeUtil.addRecipe("bottler", blocks.bottler,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -550,7 +550,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', fluidItems.canEmpty,
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.carpenter,
|
||||
RecipeUtil.addRecipe("carpenter", blocks.carpenter,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -558,7 +558,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotBronze",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.centrifuge,
|
||||
RecipeUtil.addRecipe("centrifuge", blocks.centrifuge,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -566,7 +566,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotCopper",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.fermenter,
|
||||
RecipeUtil.addRecipe("fermenter", blocks.fermenter,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -574,7 +574,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "gearBronze",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.moistener,
|
||||
RecipeUtil.addRecipe("moistener", blocks.moistener,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -582,7 +582,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "gearCopper",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.squeezer,
|
||||
RecipeUtil.addRecipe("squeezer", blocks.squeezer,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -590,7 +590,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotTin",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.still,
|
||||
RecipeUtil.addRecipe("still", blocks.still,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -598,7 +598,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "dustRedstone",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.rainmaker,
|
||||
RecipeUtil.addRecipe("rainmaker", blocks.rainmaker,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -606,7 +606,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "gearTin",
|
||||
'Y', coreItems.hardenedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.fabricator,
|
||||
RecipeUtil.addRecipe("fabricator", blocks.fabricator,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"XZX",
|
||||
@@ -615,7 +615,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'Y', coreItems.sturdyCasing,
|
||||
'Z', "chestWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.raintank,
|
||||
RecipeUtil.addRecipe("raintank", blocks.raintank,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -623,7 +623,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotIron",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.worktable,
|
||||
RecipeUtil.addRecipe("worktable", blocks.worktable,
|
||||
"B",
|
||||
"W",
|
||||
"C",
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ContainerWorktable extends ContainerTile<TileWorktable> implements
|
||||
}
|
||||
|
||||
// CraftResult display
|
||||
addSlotToContainer(new SlotCrafter(player, craftingDisplay, tile, InventoryGhostCrafting.SLOT_CRAFTING_RESULT, 77, 38));
|
||||
addSlotToContainer(new SlotCrafter(player, craftMatrix, craftingDisplay, tile, InventoryGhostCrafting.SLOT_CRAFTING_RESULT, 77, 38));
|
||||
|
||||
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
|
||||
onCraftMatrixChanged(tile.getCraftingDisplay(), i);
|
||||
|
||||
@@ -12,14 +12,31 @@ package forestry.factory.inventory;
|
||||
|
||||
import forestry.core.gui.ContainerDummy;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
|
||||
public class InventoryCraftingForestry extends InventoryCrafting {
|
||||
private final Container eventHandlerIn;
|
||||
|
||||
public InventoryCraftingForestry(ContainerWorktable containerWorktable) {
|
||||
super(containerWorktable, 3, 3);
|
||||
this(containerWorktable, 3, 3);
|
||||
}
|
||||
|
||||
public InventoryCraftingForestry() {
|
||||
super(ContainerDummy.instance, 3, 3);
|
||||
this(ContainerDummy.instance, 3, 3);
|
||||
}
|
||||
|
||||
private InventoryCraftingForestry(Container eventHandlerIn, int width, int height) {
|
||||
super(eventHandlerIn, width, height);
|
||||
this.eventHandlerIn = eventHandlerIn;
|
||||
}
|
||||
|
||||
public InventoryCraftingForestry copy() {
|
||||
InventoryCraftingForestry copy = new InventoryCraftingForestry(this.eventHandlerIn, getWidth(), getHeight());
|
||||
for (int slot = 0; slot < getSizeInventory(); slot++) {
|
||||
copy.setInventorySlotContents(slot, getStackInSlot(slot).copy());
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
@@ -10,24 +10,36 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.NBTUtilForestry;
|
||||
import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class MemorizedRecipe implements INbtWritable, INbtReadable, IStreamable {
|
||||
private final InventoryCraftingForestry craftMatrix = new InventoryCraftingForestry();
|
||||
private NonNullList<ItemStack> recipeOutputs = NonNullList.create();
|
||||
private List<IRecipe> recipes = new ArrayList<>();
|
||||
private int selectedRecipe;
|
||||
private long lastUsed;
|
||||
private boolean locked;
|
||||
@@ -39,29 +51,19 @@ public final class MemorizedRecipe implements INbtWritable, INbtReadable, IStrea
|
||||
public MemorizedRecipe(NBTTagCompound nbt) {
|
||||
readFromNBT(nbt);
|
||||
}
|
||||
|
||||
public MemorizedRecipe(InventoryCraftingForestry craftMatrix, NonNullList<ItemStack> recipeOutputs) {
|
||||
|
||||
public MemorizedRecipe(InventoryCraftingForestry craftMatrix, List<IRecipe> recipes) {
|
||||
InventoryUtil.deepCopyInventoryContents(craftMatrix, this.craftMatrix);
|
||||
this.recipeOutputs = recipeOutputs;
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
public InventoryCraftingForestry getCraftMatrix() {
|
||||
return craftMatrix;
|
||||
}
|
||||
|
||||
public void calculateRecipeOutput(World world) {
|
||||
recipeOutputs = RecipeUtil.findMatchingRecipes(craftMatrix, world);
|
||||
if (selectedRecipe >= recipeOutputs.size()) {
|
||||
selectedRecipe = 0;
|
||||
}
|
||||
if (hasRecipeConflict()) {
|
||||
removeRecipeConflicts();
|
||||
}
|
||||
}
|
||||
|
||||
public void incrementRecipe() {
|
||||
selectedRecipe++;
|
||||
if (selectedRecipe >= recipeOutputs.size()) {
|
||||
if (selectedRecipe >= recipes.size()) {
|
||||
selectedRecipe = 0;
|
||||
}
|
||||
}
|
||||
@@ -69,31 +71,54 @@ public final class MemorizedRecipe implements INbtWritable, INbtReadable, IStrea
|
||||
public void decrementRecipe() {
|
||||
selectedRecipe--;
|
||||
if (selectedRecipe < 0) {
|
||||
selectedRecipe = recipeOutputs.size() - 1;
|
||||
selectedRecipe = recipes.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasRecipeConflict() {
|
||||
return recipeOutputs.size() > 1;
|
||||
return recipes.size() > 1;
|
||||
}
|
||||
|
||||
public void removeRecipeConflicts() {
|
||||
ItemStack recipeOutput = getRecipeOutput();
|
||||
recipeOutputs.clear();
|
||||
recipeOutputs.add(recipeOutput);
|
||||
IRecipe recipe = getSelectedRecipe();
|
||||
recipes.clear();
|
||||
recipes.add(recipe);
|
||||
selectedRecipe = 0;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput() {
|
||||
if (recipeOutputs.isEmpty()) {
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
public ItemStack getOutputIcon() {
|
||||
IRecipe selectedRecipe = getSelectedRecipe();
|
||||
if (selectedRecipe != null) {
|
||||
ItemStack recipeOutput = selectedRecipe.getCraftingResult(craftMatrix);
|
||||
if (!recipeOutput.isEmpty()) {
|
||||
return recipeOutput;
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting, World world) {
|
||||
IRecipe selectedRecipe = getSelectedRecipe();
|
||||
if (selectedRecipe != null && selectedRecipe.matches(inventoryCrafting, world)) {
|
||||
ItemStack recipeOutput = selectedRecipe.getCraftingResult(inventoryCrafting);
|
||||
if (!recipeOutput.isEmpty()) {
|
||||
return recipeOutput;
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IRecipe getSelectedRecipe() {
|
||||
if (recipes.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return recipeOutputs.get(selectedRecipe);
|
||||
return recipes.get(selectedRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasRecipeOutput(ItemStack output) {
|
||||
return ItemStackUtil.containsItemStack(recipeOutputs, output);
|
||||
|
||||
public boolean hasRecipe(@Nullable IRecipe recipe) {
|
||||
return this.recipes.contains(recipe);
|
||||
}
|
||||
|
||||
public void updateLastUse(long lastUsed) {
|
||||
@@ -122,6 +147,21 @@ public final class MemorizedRecipe implements INbtWritable, INbtReadable, IStrea
|
||||
if (nbttagcompound.hasKey("SelectedRecipe")) {
|
||||
selectedRecipe = nbttagcompound.getInteger("SelectedRecipe");
|
||||
}
|
||||
|
||||
recipes.clear();
|
||||
NBTTagList recipesNbt = nbttagcompound.getTagList("Recipes", NBTUtilForestry.EnumNBTType.STRING.ordinal());
|
||||
for (int i = 0; i < recipesNbt.tagCount(); i++) {
|
||||
String recipeKey = recipesNbt.getStringTagAt(i);
|
||||
ResourceLocation key = new ResourceLocation(recipeKey);
|
||||
IRecipe recipe = ForgeRegistries.RECIPES.getValue(key);
|
||||
if (recipe != null) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedRecipe > recipes.size()) {
|
||||
selectedRecipe = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,6 +170,16 @@ public final class MemorizedRecipe implements INbtWritable, INbtReadable, IStrea
|
||||
nbttagcompound.setLong("LastUsed", lastUsed);
|
||||
nbttagcompound.setBoolean("Locked", locked);
|
||||
nbttagcompound.setInteger("SelectedRecipe", selectedRecipe);
|
||||
|
||||
NBTTagList recipesNbt = new NBTTagList();
|
||||
for (IRecipe recipe : recipes) {
|
||||
ResourceLocation recipeKey = ForgeRegistries.RECIPES.getKey(recipe);
|
||||
if (recipeKey != null) {
|
||||
recipesNbt.appendTag(new NBTTagString(recipeKey.toString()));
|
||||
}
|
||||
}
|
||||
nbttagcompound.setTag("Recipes", recipesNbt);
|
||||
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -138,15 +188,31 @@ public final class MemorizedRecipe implements INbtWritable, INbtReadable, IStrea
|
||||
public void writeData(PacketBufferForestry data) {
|
||||
data.writeInventory(craftMatrix);
|
||||
data.writeBoolean(locked);
|
||||
data.writeItemStacks(recipeOutputs);
|
||||
data.writeVarInt(selectedRecipe);
|
||||
|
||||
data.writeVarInt(recipes.size());
|
||||
for (IRecipe recipe: recipes) {
|
||||
ResourceLocation recipeId = ForgeRegistries.RECIPES.getKey(recipe);
|
||||
if (recipeId != null) {
|
||||
data.writeString(recipeId.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(PacketBufferForestry data) throws IOException {
|
||||
data.readInventory(craftMatrix);
|
||||
locked = data.readBoolean();
|
||||
recipeOutputs = data.readItemStacks();
|
||||
selectedRecipe = data.readVarInt();
|
||||
|
||||
recipes.clear();
|
||||
int recipeCount = data.readVarInt();
|
||||
for (int i = 0; i < recipeCount; i++) {
|
||||
String recipeId = data.readString();
|
||||
IRecipe recipe = ForgeRegistries.RECIPES.getValue(new ResourceLocation(recipeId));
|
||||
if (recipe != null) {
|
||||
recipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,20 +12,17 @@ package forestry.factory.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketBufferForestry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -33,12 +30,6 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
|
||||
private static final int capacity = 9;
|
||||
|
||||
private static final List<Class<? extends Item>> memoryBlacklist = new ArrayList<>();
|
||||
|
||||
static {
|
||||
memoryBlacklist.add(ItemMap.class); // almost every ItemMap is unique
|
||||
}
|
||||
|
||||
private final LinkedList<MemorizedRecipe> memorizedRecipes;
|
||||
private long lastUpdate;
|
||||
|
||||
@@ -56,31 +47,8 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
for (int j = 0; j < nbttaglist.tagCount(); ++j) {
|
||||
NBTTagCompound recipeNbt = nbttaglist.getCompoundTagAt(j);
|
||||
MemorizedRecipe recipe = new MemorizedRecipe(recipeNbt);
|
||||
memorizedRecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isValid(@Nullable MemorizedRecipe recipe) {
|
||||
if (recipe == null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack recipeOutput = recipe.getRecipeOutput();
|
||||
if (recipeOutput.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Item item = recipeOutput.getItem();
|
||||
return !memoryBlacklist.contains(item.getClass());
|
||||
}
|
||||
|
||||
public void validate(World world) {
|
||||
Iterator<MemorizedRecipe> iterator = memorizedRecipes.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
MemorizedRecipe recipe = iterator.next();
|
||||
if (recipe != null) {
|
||||
recipe.calculateRecipeOutput(world);
|
||||
if (!isValid(recipe)) {
|
||||
iterator.remove();
|
||||
}
|
||||
if (recipe.getSelectedRecipe() != null) {
|
||||
memorizedRecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +58,7 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
}
|
||||
|
||||
public void memorizeRecipe(long worldTime, MemorizedRecipe recipe) {
|
||||
if (!isValid(recipe)) {
|
||||
if (recipe.getSelectedRecipe() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +70,7 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
}
|
||||
|
||||
// update existing matching recipes
|
||||
MemorizedRecipe memory = getExistingMemorizedRecipe(recipe.getRecipeOutput());
|
||||
MemorizedRecipe memory = getExistingMemorizedRecipe(recipe.getSelectedRecipe());
|
||||
if (memory != null) {
|
||||
updateExistingRecipe(memory, recipe);
|
||||
return;
|
||||
@@ -156,7 +124,7 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
if (recipe == null) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return recipe.getRecipeOutput();
|
||||
return recipe.getOutputIcon();
|
||||
}
|
||||
|
||||
public boolean isLocked(int recipeIndex) {
|
||||
@@ -172,10 +140,12 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private MemorizedRecipe getExistingMemorizedRecipe(ItemStack craftingRecipeOutput) {
|
||||
for (MemorizedRecipe memorizedRecipe : memorizedRecipes) {
|
||||
if (memorizedRecipe.hasRecipeOutput(craftingRecipeOutput)) {
|
||||
return memorizedRecipe;
|
||||
private MemorizedRecipe getExistingMemorizedRecipe(@Nullable IRecipe recipe) {
|
||||
if (recipe != null) {
|
||||
for (MemorizedRecipe memorizedRecipe : memorizedRecipes) {
|
||||
if (memorizedRecipe.hasRecipe(recipe)) {
|
||||
return memorizedRecipe;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +156,7 @@ public class RecipeMemory implements INbtWritable, IStreamable {
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
for (MemorizedRecipe recipe : memorizedRecipes) {
|
||||
if (recipe != null) {
|
||||
if (recipe != null && recipe.getSelectedRecipe() != null) {
|
||||
NBTTagCompound recipeNbt = new NBTTagCompound();
|
||||
recipe.writeToNBT(recipeNbt);
|
||||
nbttaglist.appendTag(recipeNbt);
|
||||
|
||||
@@ -4,6 +4,7 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
import forestry.factory.recipes.MemorizedRecipe;
|
||||
@@ -13,6 +14,7 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -27,27 +29,27 @@ class WorktableRecipeTransferHandler implements IRecipeTransferHandler<Container
|
||||
@Nullable
|
||||
@Override
|
||||
public IRecipeTransferError transferRecipe(ContainerWorktable container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||
Map<Integer, ? extends IGuiIngredient<ItemStack>> guiIngredients = recipeLayout.getItemStacks().getGuiIngredients();
|
||||
|
||||
InventoryCraftingForestry inventory = new InventoryCraftingForestry(container);
|
||||
|
||||
NonNullList<ItemStack> recipeOutputs = NonNullList.create();
|
||||
for (Map.Entry<Integer, ? extends IGuiIngredient<ItemStack>> entry : guiIngredients.entrySet()) {
|
||||
int recipeSlot = entry.getKey();
|
||||
List<ItemStack> allIngredients = entry.getValue().getAllIngredients();
|
||||
if (!allIngredients.isEmpty()) {
|
||||
if (recipeSlot == 0) {
|
||||
recipeOutputs.addAll(allIngredients);
|
||||
} else {
|
||||
ItemStack firstIngredient = allIngredients.get(0);
|
||||
inventory.setInventorySlotContents(recipeSlot - 1, firstIngredient);
|
||||
if (doTransfer) {
|
||||
Map<Integer, ? extends IGuiIngredient<ItemStack>> guiIngredients = recipeLayout.getItemStacks().getGuiIngredients();
|
||||
|
||||
InventoryCraftingForestry inventory = new InventoryCraftingForestry(container);
|
||||
|
||||
for (Map.Entry<Integer, ? extends IGuiIngredient<ItemStack>> entry : guiIngredients.entrySet()) {
|
||||
int recipeSlot = entry.getKey();
|
||||
List<ItemStack> allIngredients = entry.getValue().getAllIngredients();
|
||||
if (!allIngredients.isEmpty()) {
|
||||
if (recipeSlot != 0) { // skip the output slot
|
||||
ItemStack firstIngredient = allIngredients.get(0);
|
||||
inventory.setInventorySlotContents(recipeSlot - 1, firstIngredient);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!recipeOutputs.isEmpty() && doTransfer) {
|
||||
MemorizedRecipe recipe = new MemorizedRecipe(inventory, recipeOutputs);
|
||||
container.sendWorktableRecipeRequest(recipe);
|
||||
|
||||
List<IRecipe> matchingRecipes = RecipeUtil.findMatchingRecipes(inventory, player.world);
|
||||
if (!matchingRecipes.isEmpty()) {
|
||||
MemorizedRecipe recipe = new MemorizedRecipe(inventory, matchingRecipes);
|
||||
container.sendWorktableRecipeRequest(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
package forestry.factory.tiles;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
|
||||
public interface ICrafterWorktable {
|
||||
ItemStack getResult();
|
||||
ItemStack getResult(InventoryCrafting inventoryCrafting, World world);
|
||||
|
||||
boolean canTakeStack(int slotIndex);
|
||||
|
||||
boolean onCraftingStart(EntityPlayer player);
|
||||
|
||||
void onCraftingComplete(EntityPlayer player);
|
||||
|
||||
@Nullable
|
||||
IRecipe getRecipeUsed();
|
||||
}
|
||||
@@ -14,18 +14,22 @@ import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryBasic;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -94,12 +98,6 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
recipeMemory.readData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
recipeMemory.validate(world);
|
||||
}
|
||||
|
||||
/* Recipe Conflicts */
|
||||
public boolean hasRecipeConflict() {
|
||||
return currentRecipe != null && currentRecipe.hasRecipeConflict();
|
||||
@@ -116,7 +114,15 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
currentRecipe.decrementRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getResult(InventoryCrafting inventoryCrafting, World world) {
|
||||
if (currentRecipe != null) {
|
||||
return currentRecipe.getCraftingResult(inventoryCrafting, world);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
/* ICrafterWorktable */
|
||||
@Override
|
||||
public boolean canTakeStack(int craftingSlotIndex) {
|
||||
@@ -137,15 +143,19 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
if (currentRecipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NonNullList<ItemStack> recipeItems = InventoryUtil.getStacks(currentRecipe.getCraftMatrix());
|
||||
NonNullList<ItemStack> inventoryStacks = InventoryUtil.getStacks(this);
|
||||
InventoryCraftingForestry crafting = RecipeUtil.getCraftRecipe(recipeItems, inventoryStacks, world, currentRecipe.getRecipeOutput());
|
||||
if (crafting == null) {
|
||||
|
||||
IRecipe selectedRecipe = currentRecipe.getSelectedRecipe();
|
||||
if (selectedRecipe == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
recipeItems = InventoryUtil.getStacks(crafting);
|
||||
NonNullList<ItemStack> inventoryStacks = InventoryUtil.getStacks(this);
|
||||
InventoryCraftingForestry crafting = RecipeUtil.getCraftRecipe(currentRecipe.getCraftMatrix(), inventoryStacks, world, selectedRecipe);
|
||||
if (crafting == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NonNullList<ItemStack> recipeItems = InventoryUtil.getStacks(crafting);
|
||||
|
||||
IInventory inventory;
|
||||
if (simulate) {
|
||||
@@ -155,13 +165,11 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
inventory = this;
|
||||
}
|
||||
|
||||
// craft recipe should exactly match ingredients here, so no oreDict or tool matching
|
||||
NonNullList<ItemStack> removed = InventoryUtil.removeSets(inventory, 1, recipeItems, null, false, false, false);
|
||||
if (removed == null) {
|
||||
if (!InventoryUtil.deleteExactSet(inventory, recipeItems)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!simulate) {
|
||||
if (!simulate && !world.isRemote) {
|
||||
// update crafting display to match the ingredients that were actually used
|
||||
setCraftingDisplay(crafting);
|
||||
}
|
||||
@@ -172,35 +180,35 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
@Override
|
||||
public void onCraftingComplete(EntityPlayer player) {
|
||||
Preconditions.checkState(currentRecipe != null);
|
||||
|
||||
IRecipe selectedRecipe = currentRecipe.getSelectedRecipe();
|
||||
Preconditions.checkState(selectedRecipe != null);
|
||||
|
||||
ForgeHooks.setCraftingPlayer(player);
|
||||
NonNullList<ItemStack> remainingItems = CraftingManager.getRemainingItems(currentRecipe.getCraftMatrix(), player.world);
|
||||
InventoryCraftingForestry craftMatrix = currentRecipe.getCraftMatrix();
|
||||
NonNullList<ItemStack> remainingItems = selectedRecipe.getRemainingItems(craftMatrix.copy());
|
||||
ForgeHooks.setCraftingPlayer(null);
|
||||
|
||||
for (ItemStack remainingItem : remainingItems) {
|
||||
if (remainingItem != null) {
|
||||
if (remainingItem != null && !remainingItem.isEmpty()) {
|
||||
if (!InventoryUtil.tryAddStack(this, remainingItem, true)) {
|
||||
player.dropItem(remainingItem, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!world.isRemote) {
|
||||
recipeMemory.memorizeRecipe(world.getTotalWorldTime(), currentRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ItemStack getResult() {
|
||||
public IRecipe getRecipeUsed() {
|
||||
if (currentRecipe == null) {
|
||||
return ItemStack.EMPTY;
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack result = currentRecipe.getRecipeOutput();
|
||||
if (!result.isEmpty()) {
|
||||
result = result.copy();
|
||||
}
|
||||
return result;
|
||||
|
||||
return currentRecipe.getSelectedRecipe();
|
||||
}
|
||||
|
||||
/* Crafting Container methods */
|
||||
@@ -230,11 +238,11 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(InventoryCraftingForestry crafting) {
|
||||
NonNullList<ItemStack> recipeOutputs = RecipeUtil.findMatchingRecipes(crafting, world);
|
||||
MemorizedRecipe recipe = recipeOutputs.isEmpty() ? null : new MemorizedRecipe(crafting, recipeOutputs);
|
||||
List<IRecipe> recipes = RecipeUtil.findMatchingRecipes(crafting, world);
|
||||
MemorizedRecipe recipe = recipes.isEmpty() ? null : new MemorizedRecipe(crafting, recipes);
|
||||
|
||||
if (currentRecipe != null && recipe != null) {
|
||||
if (recipe.hasRecipeOutput(currentRecipe.getRecipeOutput())) {
|
||||
if (recipe.hasRecipe(currentRecipe.getSelectedRecipe())) {
|
||||
NonNullList<ItemStack> stacks = InventoryUtil.getStacks(crafting);
|
||||
NonNullList<ItemStack> currentStacks = InventoryUtil.getStacks(currentRecipe.getCraftMatrix());
|
||||
if (ItemStackUtil.equalSets(stacks, currentStacks)) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package forestry.farming;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -8,11 +11,13 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
@@ -24,9 +29,6 @@ import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.farming.logic.FarmLogicSimple;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public final class FarmRegistry implements IFarmRegistry {
|
||||
|
||||
@@ -90,7 +92,11 @@ public final class FarmRegistry implements IFarmRegistry {
|
||||
try {
|
||||
String fertilizer = fertilizerList[i];
|
||||
String[] fertilizers = fertilizer.split(";");
|
||||
ItemStack fertilizerItem = ItemStackUtil.parseItemStackString(fertilizers[0], OreDictionary.WILDCARD_VALUE);
|
||||
String itemName = fertilizers[0];
|
||||
if(itemName.equals("forestry:fertilizerCompound")){
|
||||
itemName = "forestry:fertilizer_compound";
|
||||
}
|
||||
ItemStack fertilizerItem = ItemStackUtil.parseItemStackString(itemName, OreDictionary.WILDCARD_VALUE);
|
||||
int fertilizerValue = Integer.parseInt(fertilizers[1]);
|
||||
registerFertilizer(fertilizerItem, fertilizerValue);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -213,7 +213,7 @@ public class PluginFarming extends BlankForestryPlugin {
|
||||
valve.setTagCompound(compound);
|
||||
control.setTagCompound(compound);
|
||||
|
||||
RecipeUtil.addRecipe(basic,
|
||||
RecipeUtil.addRecipe("farm_basic_" + block.getUid(), basic,
|
||||
"I#I",
|
||||
"WCW",
|
||||
'#', block.getBase(),
|
||||
@@ -221,27 +221,27 @@ public class PluginFarming extends BlankForestryPlugin {
|
||||
'C', coreItems.tubes.get(EnumElectronTube.TIN, 1),
|
||||
'I', "ingotCopper");
|
||||
|
||||
RecipeUtil.addRecipe(gearbox,
|
||||
RecipeUtil.addRecipe("farm_gearbox_" + block.getUid(), gearbox,
|
||||
" # ",
|
||||
"TTT",
|
||||
'#', basic,
|
||||
'T', "gearTin");
|
||||
|
||||
RecipeUtil.addRecipe(hatch,
|
||||
RecipeUtil.addRecipe("farm_hatch_" + block.getUid(), hatch,
|
||||
" # ",
|
||||
"TDT",
|
||||
'#', basic,
|
||||
'T', "gearTin",
|
||||
'D', OreDictUtil.TRAPDOOR_WOOD);
|
||||
|
||||
RecipeUtil.addRecipe(valve,
|
||||
RecipeUtil.addRecipe("farm_valve_" + block.getUid(), valve,
|
||||
" # ",
|
||||
"XTX",
|
||||
'#', basic,
|
||||
'T', "gearTin",
|
||||
'X', "blockGlass");
|
||||
|
||||
RecipeUtil.addRecipe(control,
|
||||
RecipeUtil.addRecipe("farm_control_" + block.getUid(), control,
|
||||
" # ",
|
||||
"XTX",
|
||||
'#', basic,
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package forestry.farming.compat;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.farming.PluginFarming;
|
||||
import forestry.farming.blocks.BlockRegistryFarming;
|
||||
import forestry.farming.models.EnumFarmBlockTexture;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.JEIPlugin;
|
||||
|
||||
@JEIPlugin
|
||||
public class FarmingJeiPlugin implements IModPlugin {
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
if (!ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FARMING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockRegistryFarming blocks = PluginFarming.getBlocks();
|
||||
Item farmBlock = Item.getItemFromBlock(blocks.farm);
|
||||
subtypeRegistry.registerSubtypeInterpreter(farmBlock, itemStack -> {
|
||||
NBTTagCompound nbt = itemStack.getTagCompound();
|
||||
EnumFarmBlockTexture texture = EnumFarmBlockTexture.getFromCompound(nbt);
|
||||
return itemStack.getItemDamage() + "." + texture.getUid();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package forestry.farming.compat;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import forestry.core.utils.FieldsAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -12,6 +12,8 @@ package forestry.farming.models;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -109,6 +111,10 @@ public enum EnumFarmBlockTexture {
|
||||
public String getName() {
|
||||
return base.getItem().getItemStackDisplayName(base);
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public ItemStack getBase() {
|
||||
return base;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
BlockRegistryGreenhouse blocks = getBlocks();
|
||||
|
||||
Block greenhousePlainBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN);
|
||||
RecipeUtil.addRecipe(new ItemStack(greenhousePlainBlock, 2),
|
||||
RecipeUtil.addRecipe("greenhouse_plain", new ItemStack(greenhousePlainBlock, 2),
|
||||
"#X#",
|
||||
"SIS",
|
||||
'I', OreDictUtil.INGOT_IRON,
|
||||
@@ -112,7 +112,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'#', coreItems.craftingMaterial.getCamouflagedPaneling());
|
||||
|
||||
Block greenhouseGlassBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS);
|
||||
RecipeUtil.addRecipe(new ItemStack(greenhouseGlassBlock, 2),
|
||||
RecipeUtil.addRecipe("greenhouse_glass", new ItemStack(greenhouseGlassBlock, 2),
|
||||
"#X#",
|
||||
"PIP",
|
||||
'I', OreDictUtil.INGOT_IRON,
|
||||
@@ -121,7 +121,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'#', coreItems.craftingMaterial.getCamouflagedPaneling());
|
||||
|
||||
Block greenhouseHatchInputBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HATCH_INPUT);
|
||||
RecipeUtil.addRecipe(greenhouseHatchInputBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_hatch_in", greenhouseHatchInputBlock,
|
||||
"TXT",
|
||||
"#H#",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
@@ -130,7 +130,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.BRONZE, 1));
|
||||
|
||||
Block greenhouseHatchOutputBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HATCH_OUTPUT);
|
||||
RecipeUtil.addRecipe(greenhouseHatchOutputBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_hatch_out", greenhouseHatchOutputBlock,
|
||||
"#H#",
|
||||
"TXT",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
@@ -139,7 +139,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.BRONZE, 1));
|
||||
|
||||
Block greenhouseControlBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.CONTROL);
|
||||
RecipeUtil.addRecipe(greenhouseControlBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_control", greenhouseControlBlock,
|
||||
" X ",
|
||||
"#T#",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
@@ -147,14 +147,14 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.GOLD, 1));
|
||||
|
||||
Block greenhouseGearBoxBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GEARBOX);
|
||||
RecipeUtil.addRecipe(greenhouseGearBoxBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_gearbox", greenhouseGearBoxBlock,
|
||||
" X ",
|
||||
"###",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', OreDictUtil.GEAR_TIN);
|
||||
|
||||
Block greenhouseValveBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.VALVE);
|
||||
RecipeUtil.addRecipe(greenhouseValveBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_valve", greenhouseValveBlock,
|
||||
" X ",
|
||||
"#G#",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
@@ -162,7 +162,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'G', OreDictUtil.GEAR_TIN);
|
||||
|
||||
Block greenhouseHeaterBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HEATER);
|
||||
RecipeUtil.addRecipe(greenhouseHeaterBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_heater", greenhouseHeaterBlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
"T#T",
|
||||
@@ -171,7 +171,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.GOLD, 1));
|
||||
|
||||
Block greenhouseFanlock = blocks.getGreenhouseBlock(BlockGreenhouseType.FAN);
|
||||
RecipeUtil.addRecipe(greenhouseFanlock,
|
||||
RecipeUtil.addRecipe("greenhouse_fan", greenhouseFanlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
"T#T",
|
||||
@@ -180,7 +180,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.TIN, 1));
|
||||
|
||||
Block greenhouseDryerBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.DEHUMIDIFIER);
|
||||
RecipeUtil.addRecipe(greenhouseDryerBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_dryer", greenhouseDryerBlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
"T#T",
|
||||
@@ -189,7 +189,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.BLAZE, 1));
|
||||
|
||||
Block greenhouseSprinklerBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HUMIDIFIER);
|
||||
RecipeUtil.addRecipe(greenhouseSprinklerBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_sprinkler", greenhouseSprinklerBlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
"T#T",
|
||||
@@ -198,7 +198,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'T', coreItems.tubes.get(EnumElectronTube.LAPIS, 1));
|
||||
|
||||
Block greenhouseDoorBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.DOOR);
|
||||
RecipeUtil.addRecipe(greenhouseDoorBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_door", greenhouseDoorBlock,
|
||||
true,
|
||||
"GG ",
|
||||
"GG ",
|
||||
@@ -206,7 +206,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'G', blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS));
|
||||
|
||||
Block greenhouseWindowBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.WINDOW);
|
||||
RecipeUtil.addRecipe(greenhouseWindowBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_window", greenhouseWindowBlock,
|
||||
true,
|
||||
"GGS",
|
||||
"GGG",
|
||||
@@ -215,7 +215,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'S', OreDictUtil.STICK_WOOD);
|
||||
|
||||
Block greenhouseWindowRoofBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.WINDOW_UP);
|
||||
RecipeUtil.addRecipe(greenhouseWindowRoofBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_window_roof", greenhouseWindowRoofBlock,
|
||||
true,
|
||||
"SGS",
|
||||
"GGG",
|
||||
@@ -224,7 +224,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'S', OreDictUtil.STICK_WOOD);
|
||||
|
||||
Block greenhouseClimateControlBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.CLIMATE_CONTROL);
|
||||
RecipeUtil.addRecipe(greenhouseClimateControlBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_climate_control", greenhouseClimateControlBlock,
|
||||
true,
|
||||
"IRG",
|
||||
"EBT",
|
||||
@@ -238,7 +238,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
Block greenhouseButterflyHatchBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.NURSERY);
|
||||
RecipeUtil.addRecipe(greenhouseButterflyHatchBlock,
|
||||
RecipeUtil.addRecipe("greenhouse_butterfly_hatch", greenhouseButterflyHatchBlock,
|
||||
true,
|
||||
"IRG",
|
||||
"SBS",
|
||||
|
||||
@@ -131,7 +131,12 @@ public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
ButterflyBranchDefinition.createAlleles();
|
||||
ButterflyAlleles.registerEffectAlleles();
|
||||
|
||||
|
||||
ButterflyDefinition.preInit();
|
||||
MothDefinition.preInit();
|
||||
MinecraftForge.EVENT_BUS.post(new AlleleSpeciesRegisterEvent<>(ButterflyManager.butterflyRoot, IAlleleButterflySpecies.class));
|
||||
|
||||
|
||||
GameRegistry.registerTileEntity(TileCocoon.class, "forestry.Cocoon");
|
||||
proxy.preInitializeRendering();
|
||||
}
|
||||
@@ -298,7 +303,7 @@ public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
|
||||
ForgeRegistries.RECIPES.register(new MatingRecipe());
|
||||
|
||||
RecipeUtil.addRecipe(blocks.butterflyChest, " # ", "XYX", "XXX", '#', "blockGlass", 'X',
|
||||
RecipeUtil.addRecipe("butterfly_chest", blocks.butterflyChest, " # ", "XYX", "XXX", '#', "blockGlass", 'X',
|
||||
new ItemStack(items.butterflyGE, 1, OreDictionary.WILDCARD_VALUE), 'Y', "chestWood");
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
@@ -31,6 +32,8 @@ import forestry.core.genetics.alleles.EnumAllele;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public enum ButterflyDefinition implements IButterflyDefinition {
|
||||
CabbageWhite(ButterflyBranchDefinition.Pieris, "cabbageWhite", "rapae", new Color(0xccffee), true, 1.0f) {
|
||||
@Override
|
||||
@@ -320,6 +323,10 @@ public enum ButterflyDefinition implements IButterflyDefinition {
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
this.species = speciesBuilder.build();
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
// just used to initialize the enums
|
||||
}
|
||||
|
||||
public static void initButterflies() {
|
||||
for (ButterflyDefinition butterfly : values()) {
|
||||
|
||||
@@ -80,6 +80,10 @@ public enum MothDefinition implements IButterflyDefinition {
|
||||
setSpeciesProperties(speciesBuilder);
|
||||
species = speciesBuilder.build();
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
// just used to initialize the enums
|
||||
}
|
||||
|
||||
public static void initMoths() {
|
||||
for (MothDefinition butterfly : values()) {
|
||||
|
||||
@@ -44,6 +44,7 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.lepidopterology.IAlleleButterflyCocoon;
|
||||
import forestry.api.lepidopterology.IAlleleButterflySpecies;
|
||||
@@ -87,7 +88,9 @@ public class ItemButterflyGE extends ItemGE implements ISpriteRegister, IColored
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
addCreativeItems(subItems, true);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
addCreativeItems(subItems, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void addCreativeItems(NonNullList<ItemStack> subItems, boolean hideSecrets) {
|
||||
@@ -282,7 +285,7 @@ public class ItemButterflyGE extends ItemGE implements ISpriteRegister, IColored
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles(EnumButterflyChromosome.SPECIES)) {
|
||||
if (allele instanceof IAlleleButterflySpecies) {
|
||||
((IAlleleButterflySpecies) allele).registerSprites();
|
||||
}
|
||||
|
||||
@@ -71,24 +71,23 @@ public class ModelButterfly extends ModelBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float swing, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, swing, f3, f4, f5);
|
||||
public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
|
||||
//body.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(swing * 0.1F) * 0.15F;
|
||||
//body.rotateAngleY = 0.0F;
|
||||
wingRight.rotateAngleZ = MathHelper.cos(swing * 1.3F) * (float) Math.PI * 0.25F;
|
||||
wingRight.rotateAngleZ = MathHelper.cos(ageInTicks * 1.3F) * (float) Math.PI * 0.25F;
|
||||
wingLeft.rotateAngleZ = -wingRight.rotateAngleZ;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
GlStateManager.translate(0.0F, 20.0f / scale * f5, 0.0F);
|
||||
wingRight.render(f5);
|
||||
eyeRight.render(f5);
|
||||
eyeLeft.render(f5);
|
||||
wingLeft.render(f5);
|
||||
body.render(f5);
|
||||
GlStateManager.scale(this.scale, this.scale, this.scale);
|
||||
GlStateManager.translate(0.0F, 20.0f / this.scale * scale, 0.0F);
|
||||
wingRight.render(scale);
|
||||
eyeRight.render(scale);
|
||||
eyeLeft.render(scale);
|
||||
wingLeft.render(scale);
|
||||
body.render(scale);
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
}
|
||||
|
||||
private static void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.IAlleleButterflySpecies;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.models.BlankModel;
|
||||
import forestry.core.models.DefaultTextureGetter;
|
||||
import forestry.core.models.TRSRBakedModel;
|
||||
@@ -60,12 +61,11 @@ public class ModelButterflyItem extends BlankModel {
|
||||
}
|
||||
|
||||
private IBakedModel bakeModel(IButterfly butterfly) {
|
||||
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
|
||||
textures.put("butterfly", butterfly.getGenome().getPrimary().getItemTexture());
|
||||
ImmutableMap<String, String> textures = ImmutableMap.of("butterfly", butterfly.getGenome().getPrimary().getItemTexture());
|
||||
|
||||
if (modelButterfly == null) {
|
||||
try {
|
||||
modelButterfly = ModelLoaderRegistry.getModel(new ResourceLocation("forestry:item/butterfly_ge"));
|
||||
modelButterfly = ModelLoaderRegistry.getModel(new ResourceLocation(Constants.MOD_ID, "item/butterfly_ge"));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class ModelButterflyItem extends BlankModel {
|
||||
throw new IllegalArgumentException("Could not bake butterfly model");
|
||||
}
|
||||
}
|
||||
IModel retexturedModel = modelButterfly.retexture(textures.build());
|
||||
IModel retexturedModel = modelButterfly.retexture(textures);
|
||||
IBakedModel bakedModel = retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE);
|
||||
return new TRSRBakedModel(bakedModel, -0.03125F, 0.25F - butterfly.getSize() * 0.37F, -0.03125F, butterfly.getSize() * 1.5F);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
letterGlue = new ItemStack(Items.SLIME_BALL);
|
||||
}
|
||||
|
||||
RecipeUtil.addShapelessRecipe(items.letters.getItemStack(), Items.PAPER, letterGlue);
|
||||
RecipeUtil.addShapelessRecipe("letter", items.letters.getItemStack(), Items.PAPER, letterGlue);
|
||||
|
||||
if (Config.craftingStampsEnabled) {
|
||||
for (EnumStampDefinition stampDefinition : EnumStampDefinition.VALUES) {
|
||||
@@ -136,7 +136,7 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
|
||||
ItemStack stamps = items.stamps.get(stampDefinition, 9);
|
||||
|
||||
RecipeUtil.addRecipe(stamps,
|
||||
RecipeUtil.addRecipe("stamps", stamps,
|
||||
"XXX",
|
||||
"###",
|
||||
"ZZZ",
|
||||
@@ -152,14 +152,14 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
// Recycling
|
||||
RecipeUtil.addRecipe(new ItemStack(Items.PAPER), "###", '#', OreDictUtil.EMPTIED_LETTER_ORE_DICT);
|
||||
RecipeUtil.addRecipe("letter_recycling", new ItemStack(Items.PAPER), "###", '#', OreDictUtil.EMPTIED_LETTER_ORE_DICT);
|
||||
|
||||
// Carpenter
|
||||
RecipeManagers.carpenterManager.addRecipe(10, new FluidStack(FluidRegistry.WATER, 250), ItemStack.EMPTY, items.letters.getItemStack(), "###", "###", '#', coreItems.woodPulp);
|
||||
|
||||
RecipeUtil.addShapelessRecipe(items.catalogue.getItemStack(), items.stamps.getWildcard(), new ItemStack(Items.BOOK));
|
||||
RecipeUtil.addShapelessRecipe("catalogue", items.catalogue.getItemStack(), items.stamps.getWildcard(), new ItemStack(Items.BOOK));
|
||||
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.mailbox),
|
||||
RecipeUtil.addRecipe("mailbox", new ItemStack(blocks.mailbox),
|
||||
" # ",
|
||||
"#Y#",
|
||||
"XXX",
|
||||
@@ -167,7 +167,7 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
'X', "chestWood",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.tradeStation),
|
||||
RecipeUtil.addRecipe("trade_station", new ItemStack(blocks.tradeStation),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"XWX",
|
||||
|
||||
@@ -86,7 +86,9 @@ public class ItemLetter extends ItemWithGui {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
LetterProperties.getSubItems(this, tab, subItems);
|
||||
if (this.isInCreativeTab(tab)) {
|
||||
LetterProperties.getSubItems(this, tab, subItems);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ItemStack> getEmptiedLetters() {
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
@@ -111,6 +112,10 @@ public abstract class BlankForestryPlugin implements IForestryPlugin {
|
||||
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getHiddenItems(List<ItemStack> hiddenItems) {
|
||||
}
|
||||
@@ -145,12 +150,6 @@ public abstract class BlankForestryPlugin implements IForestryPlugin {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
ForestryPlugin forestryPlugin = getClass().getAnnotation(ForestryPlugin.class);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
@@ -58,6 +59,8 @@ public interface IForestryPlugin {
|
||||
|
||||
void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ);
|
||||
|
||||
void decorateBiome(World world, Random rand, BlockPos pos);
|
||||
|
||||
void getHiddenItems(List<ItemStack> hiddenItems);
|
||||
|
||||
@Nullable
|
||||
@@ -74,7 +77,4 @@ public interface IForestryPlugin {
|
||||
|
||||
@Nullable
|
||||
ICommand[] getConsoleCommands();
|
||||
|
||||
@Nullable
|
||||
IFuelHandler getFuelHandler();
|
||||
}
|
||||
@@ -28,16 +28,15 @@ import net.minecraft.command.CommandHandler;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.discovery.ASMDataTable;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import forestry.Forestry;
|
||||
@@ -108,11 +107,6 @@ public class PluginManager {
|
||||
if (resupplyHandler != null) {
|
||||
resupplyHandlers.add(resupplyHandler);
|
||||
}
|
||||
|
||||
IFuelHandler fuelHandler = plugin.getFuelHandler();
|
||||
if (fuelHandler != null) {
|
||||
GameRegistry.registerFuelHandler(fuelHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private static IForestryPlugin getPluginCore(List<IForestryPlugin> forestryPlugins) {
|
||||
@@ -293,6 +287,12 @@ public class PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void decorateBiome(World world, Random rand, BlockPos pos) {
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
plugin.decorateBiome(world, rand, pos);
|
||||
}
|
||||
}
|
||||
|
||||
public static void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
|
||||
for (IForestryPlugin plugin : loadedPlugins) {
|
||||
plugin.populateChunkRetroGen(world, rand, chunkX, chunkZ);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class PluginActuallyAdditions extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
//add canola oil fermenting in still
|
||||
Fluid oil = getFluid("oil");
|
||||
Fluid oil = getFluid("refinedcanolaoil");
|
||||
if (oil != null) {
|
||||
RecipeManagers.stillManager.addRecipe(200, new FluidStack(canolaOil, 5), new FluidStack(oil, 5));
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class PluginBuildCraftTransport extends BlankForestryPlugin {
|
||||
Item beeswax = PluginCore.getItems().beeswax;
|
||||
Item pipeWaterproof = ForgeRegistries.ITEMS.getValue(new ResourceLocation(BCT, "waterproof"));
|
||||
if (pipeWaterproof != null) {
|
||||
RecipeUtil.addShapelessRecipe(new ItemStack(pipeWaterproof), beeswax);
|
||||
RecipeUtil.addShapelessRecipe("pipe_waterproof", new ItemStack(pipeWaterproof), beeswax);
|
||||
} else {
|
||||
Log.warning("No BuildCraft pipe waterproof found.");
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
|
||||
ItemStack grainSeed = getItemStack(grainName + "seedItem");
|
||||
Block grainBlock = getBlock("pam" + grainName + "Crop");
|
||||
if (grain != null && wheatamount > 0) {
|
||||
RecipeUtil.addRecipe(coreItems.fertilizerBio.getItemStack(wheatamount), " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', grain);
|
||||
RecipeUtil.addRecipe("pam_compost_" + grainName, coreItems.compost.getItemStack(wheatamount), " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', grain);
|
||||
FuelManager.moistenerResource.put(grain, new MoistenerFuel(grain, coreItems.mouldyWheat.getItemStack(), 0, 300));
|
||||
}
|
||||
if (grainSeed != null) {
|
||||
@@ -387,7 +387,7 @@ public class PluginHarvestCraft extends BlankForestryPlugin {
|
||||
|
||||
ItemStack hcBeeswaxItem = getItemStack("beeswaxItem");
|
||||
if (hcBeeswaxItem != null) {
|
||||
RecipeUtil.addRecipe(PluginFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
RecipeUtil.addRecipe("pam_wax_capsule", PluginFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can");
|
||||
if (bogEarthOutputCan > 0) {
|
||||
ItemStack bogEarthCan = PluginCore.getBlocks().bogEarth.get(BlockBogEarth.SoilType.BOG_EARTH, bogEarthOutputCan);
|
||||
RecipeUtil.addRecipe(bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waterCell, 'Y', "sand");
|
||||
RecipeUtil.addRecipe("ic2_bog_earth_can", bogEarthCan, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waterCell, 'Y', "sand");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
|
||||
BlockRegistryEnergy energyBlocks = PluginEnergy.blocks;
|
||||
if (energyBlocks != null) {
|
||||
RecipeUtil.addRecipe(blocks.generator,
|
||||
RecipeUtil.addRecipe("ic2_generator", blocks.generator,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -302,7 +302,7 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
'X', "ingotGold",
|
||||
'Y', coreItems.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.electricalEngine,
|
||||
RecipeUtil.addRecipe("ic2_eletrical_engine", blocks.electricalEngine,
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
|
||||
@@ -277,8 +277,8 @@ public class PluginNatura extends BlankForestryPlugin {
|
||||
RecipeUtil.addFermenterRecipes(itemBarley, ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
|
||||
int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
|
||||
if (compostWheatAmount > 0) {
|
||||
ItemStack compostWheat = PluginCore.getItems().fertilizerBio.getItemStack(compostWheatAmount);
|
||||
RecipeUtil.addRecipe(compostWheat, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', itemBarley);
|
||||
ItemStack compostWheat = PluginCore.getItems().compost.getItemStack(compostWheatAmount);
|
||||
RecipeUtil.addRecipe("natura_compost_wheat", compostWheat, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', itemBarley);
|
||||
}
|
||||
FuelManager.moistenerResource.put(itemBarley, new MoistenerFuel(itemBarley, PluginCore.getItems().mouldyWheat.getItemStack(), 0, 300));
|
||||
}
|
||||
|
||||
@@ -12,12 +12,11 @@ package forestry.storage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
@@ -28,13 +27,14 @@ import forestry.storage.items.ItemBackpack;
|
||||
import forestry.storage.items.ItemBackpackNaturalist;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public class BackpackInterface implements IBackpackInterface {
|
||||
|
||||
private final Map<String, IBackpackDefinition> definitions = new HashMap<>();
|
||||
private final Multimap<String, String> backpackAcceptedItems = HashMultimap.create();
|
||||
private final Map<String, List<String>> backpackAcceptedItems = new HashMap<>();
|
||||
|
||||
public Multimap<String, String> getBackpackAcceptedItems() {
|
||||
public Map<String, List<String>> getBackpackAcceptedItems() {
|
||||
return backpackAcceptedItems;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,10 @@ public class BackpackInterface implements IBackpackInterface {
|
||||
Preconditions.checkArgument(!itemStack.isEmpty(), "itemStack must not be empty");
|
||||
|
||||
String stringForItemStack = ItemStackUtil.getStringForItemStack(itemStack);
|
||||
backpackAcceptedItems.put(backpackUid, stringForItemStack);
|
||||
if (stringForItemStack != null) {
|
||||
List<String> acceptedItems = backpackAcceptedItems.computeIfAbsent(backpackUid, k -> NonNullList.create());
|
||||
acceptedItems.add(stringForItemStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,9 +15,12 @@ import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -58,6 +61,8 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
@@ -84,10 +89,10 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
@Nullable
|
||||
private static ItemRegistryStorage items;
|
||||
|
||||
private final Multimap<String, String> backpackAcceptedOreDictRegexpDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackRejectedOreDictRegexpDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackAcceptedItemDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackRejectedItemDefaults = HashMultimap.create();
|
||||
private final Map<String, List<String>> backpackAcceptedOreDictRegexpDefaults = new HashMap<>();
|
||||
private final Map<String, List<String>> backpackRejectedOreDictRegexpDefaults = new HashMap<>();
|
||||
private final Map<String, List<String>> backpackAcceptedItemDefaults = new HashMap<>();
|
||||
private final Map<String, List<String>> backpackRejectedItemDefaults = new HashMap<>();
|
||||
|
||||
private final List<String> forestryBackpackUids = Arrays.asList(
|
||||
BackpackManager.MINER_UID,
|
||||
@@ -182,7 +187,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
private void setDefaultsForConfig() {
|
||||
ItemRegistryCore coreItems = PluginCore.getItems();
|
||||
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.MINER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.put(BackpackManager.MINER_UID, Arrays.asList(
|
||||
"obsidian",
|
||||
"ore[A-Z].*",
|
||||
"dust[A-Z].*",
|
||||
@@ -194,7 +199,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"denseore[A-Z].*"
|
||||
));
|
||||
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.DIGGER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.put(BackpackManager.DIGGER_UID, Arrays.asList(
|
||||
"cobblestone",
|
||||
"dirt",
|
||||
"gravel",
|
||||
@@ -204,7 +209,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"sand"
|
||||
));
|
||||
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.HUNTER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.put(BackpackManager.HUNTER_UID, Arrays.asList(
|
||||
"bone",
|
||||
"egg",
|
||||
"enderpearl",
|
||||
@@ -216,7 +221,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"string"
|
||||
));
|
||||
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.FORESTER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.put(BackpackManager.FORESTER_UID, Arrays.asList(
|
||||
"logWood",
|
||||
"stickWood",
|
||||
"woodStick",
|
||||
@@ -230,7 +235,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"tree[A-Z].*"
|
||||
));
|
||||
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.BUILDER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.put(BackpackManager.BUILDER_UID, Arrays.asList(
|
||||
"block[A-Z].*",
|
||||
"paneGlass[A-Z].*",
|
||||
"slabWood[A-Z].*",
|
||||
@@ -253,7 +258,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"doorWood"
|
||||
));
|
||||
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.MINER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.put(BackpackManager.MINER_UID, getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.COAL_ORE),
|
||||
new ItemStack(Items.COAL),
|
||||
coreItems.bronzePickaxe.getItemStack(),
|
||||
@@ -261,7 +266,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
coreItems.brokenBronzePickaxe.getItemStack()
|
||||
)));
|
||||
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.DIGGER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.put(BackpackManager.DIGGER_UID, getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.DIRT, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Items.FLINT),
|
||||
new ItemStack(Blocks.SANDSTONE, 1, 0),
|
||||
@@ -273,7 +278,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
coreItems.brokenBronzeShovel.getItemStack()
|
||||
)));
|
||||
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.FORESTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.put(BackpackManager.FORESTER_UID, getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.RED_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.RED_FLOWER, 1, OreDictionary.WILDCARD_VALUE),
|
||||
@@ -293,7 +298,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
new ItemStack(Items.APPLE)
|
||||
)));
|
||||
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.HUNTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.put(BackpackManager.HUNTER_UID, getItemStrings(Arrays.asList(
|
||||
new ItemStack(Items.BLAZE_POWDER),
|
||||
new ItemStack(Items.BLAZE_ROD),
|
||||
new ItemStack(Items.ROTTEN_FLESH),
|
||||
@@ -334,7 +339,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
new ItemStack(Items.IRON_HORSE_ARMOR)
|
||||
)));
|
||||
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.put(BackpackManager.BUILDER_UID, getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.REDSTONE_TORCH),
|
||||
new ItemStack(Blocks.REDSTONE_LAMP),
|
||||
new ItemStack(Blocks.SEA_LANTERN),
|
||||
@@ -388,7 +393,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
BlockRegistryApiculture beeBlocks = PluginApiculture.getBlocks();
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.put(BackpackManager.BUILDER_UID, getItemStrings(Arrays.asList(
|
||||
new ItemStack(beeBlocks.candle, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(beeBlocks.stump, 1, OreDictionary.WILDCARD_VALUE)
|
||||
)));
|
||||
@@ -415,11 +420,13 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
OreDictionary.registerOre(OreDictUtil.FENCE_GATE_WOOD, Blocks.ACACIA_FENCE_GATE);
|
||||
}
|
||||
|
||||
private static Set<String> getItemStrings(List<ItemStack> itemStacks) {
|
||||
Set<String> itemStrings = new HashSet<>(itemStacks.size());
|
||||
private static List<String> getItemStrings(List<ItemStack> itemStacks) {
|
||||
List<String> itemStrings = new ArrayList<>(itemStacks.size());
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
String itemString = ItemStackUtil.getStringForItemStack(itemStack);
|
||||
itemStrings.add(itemString);
|
||||
if (itemString != null) {
|
||||
itemStrings.add(itemString);
|
||||
}
|
||||
}
|
||||
return itemStrings;
|
||||
}
|
||||
@@ -437,9 +444,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
// accepted items
|
||||
{
|
||||
List<String> defaultAcceptedItemNames = new ArrayList<>(backpackAcceptedItemDefaults.get(backpackUid));
|
||||
Collections.sort(defaultAcceptedItemNames);
|
||||
String[] defaultValidItems = defaultAcceptedItemNames.toArray(new String[defaultAcceptedItemNames.size()]);
|
||||
String[] defaultValidItems = new String[0];
|
||||
List<String> defaultAcceptedItemNames = backpackAcceptedItemDefaults.get(backpackUid);
|
||||
if (defaultAcceptedItemNames != null) {
|
||||
Collections.sort(defaultAcceptedItemNames);
|
||||
defaultValidItems = defaultAcceptedItemNames.toArray(new String[defaultAcceptedItemNames.size()]);
|
||||
}
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "item.stacks.accepted", defaultValidItems);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid));
|
||||
@@ -453,9 +463,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
// rejected items
|
||||
{
|
||||
List<String> defaultRejectedItemNames = new ArrayList<>(backpackRejectedItemDefaults.get(backpackUid));
|
||||
Collections.sort(defaultRejectedItemNames);
|
||||
String[] defaultRejectedItems = defaultRejectedItemNames.toArray(new String[defaultRejectedItemNames.size()]);
|
||||
String[] defaultRejectedItems = new String[0];
|
||||
List<String> defaultRejectedItemNames = backpackRejectedItemDefaults.get(backpackUid);
|
||||
if (defaultRejectedItemNames != null) {
|
||||
Collections.sort(defaultRejectedItemNames);
|
||||
defaultRejectedItems = defaultRejectedItemNames.toArray(new String[defaultRejectedItemNames.size()]);
|
||||
}
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "item.stacks.rejected", defaultRejectedItems);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid));
|
||||
@@ -469,9 +482,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
// accepted oreDict
|
||||
{
|
||||
List<String> defaultOreRegexpList = new ArrayList<>(backpackAcceptedOreDictRegexpDefaults.get(backpackUid));
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
String[] defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
String[] defaultOreRegexpNames =new String[0];
|
||||
List<String> defaultOreRegexpList = backpackAcceptedOreDictRegexpDefaults.get(backpackUid);
|
||||
if (defaultOreRegexpList != null) {
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
}
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "ore.dict.accepted", defaultOreRegexpNames);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid));
|
||||
@@ -491,9 +507,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
// rejected oreDict
|
||||
{
|
||||
List<String> defaultOreRegexpList = new ArrayList<>(backpackRejectedOreDictRegexpDefaults.get(backpackUid));
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
String[] defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
String[] defaultOreRegexpNames = new String[0];
|
||||
List<String> defaultOreRegexpList = backpackRejectedOreDictRegexpDefaults.get(backpackUid);
|
||||
if (defaultOreRegexpList != null) {
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
}
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "ore.dict.rejected", defaultOreRegexpNames);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid));
|
||||
@@ -587,21 +606,21 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
ItemRegistryStorage items = getItems();
|
||||
if (items.apiaristBackpack != null && ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
BlockRegistryApiculture beeBlocks = PluginApiculture.getBlocks();
|
||||
addBackpackRecipe(items.apiaristBackpack, "stickWood", beeBlocks.beeChest);
|
||||
addBackpackRecipe("bee", items.apiaristBackpack, "stickWood", beeBlocks.beeChest);
|
||||
}
|
||||
|
||||
if (items.lepidopteristBackpack != null && ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
BlockRegistryLepidopterology butterflyBlocks = PluginLepidopterology.getBlocks();
|
||||
ItemStack chest = new ItemStack(butterflyBlocks.butterflyChest);
|
||||
addBackpackRecipe(items.lepidopteristBackpack, "stickWood", chest);
|
||||
addBackpackRecipe("butterfly", items.lepidopteristBackpack, "stickWood", chest);
|
||||
}
|
||||
|
||||
addBackpackRecipe(items.minerBackpack, "ingotIron");
|
||||
addBackpackRecipe(items.diggerBackpack, "stone");
|
||||
addBackpackRecipe(items.foresterBackpack, "logWood");
|
||||
addBackpackRecipe(items.hunterBackpack, Items.FEATHER);
|
||||
addBackpackRecipe(items.adventurerBackpack, Items.BONE);
|
||||
addBackpackRecipe(items.builderBackpack, Items.CLAY_BALL);
|
||||
addBackpackRecipe("mining", items.minerBackpack, "ingotIron");
|
||||
addBackpackRecipe("digging", items.diggerBackpack, "stone");
|
||||
addBackpackRecipe("foresting", items.foresterBackpack, "logWood");
|
||||
addBackpackRecipe("hunting", items.hunterBackpack, Items.FEATHER);
|
||||
addBackpackRecipe("adventuring", items.adventurerBackpack, Items.BONE);
|
||||
addBackpackRecipe("building", items.builderBackpack, Items.CLAY_BALL);
|
||||
|
||||
// / CARPENTER
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
@@ -619,12 +638,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addBackpackRecipe(Item backpack, Object material) {
|
||||
addBackpackRecipe(backpack, material, "chestWood");
|
||||
private static void addBackpackRecipe(String recipeName, Item backpack, Object material) {
|
||||
addBackpackRecipe(recipeName, backpack, material, "chestWood");
|
||||
}
|
||||
|
||||
private static void addBackpackRecipe(Item backpack, Object material, Object chest) {
|
||||
RecipeUtil.addRecipe(backpack,
|
||||
private static void addBackpackRecipe(String recipeName, Item backpack, Object material, Object chest) {
|
||||
RecipeUtil.addRecipe("backpack_" + recipeName, backpack,
|
||||
"X#X",
|
||||
"VYV",
|
||||
"X#X",
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "block/wall_gate_closed",
|
||||
"parent": "block/wall_gate_open",
|
||||
"textures": {
|
||||
"texture": "forestry:blocks/wood/planks.acacia"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user