Update biomes o plenty pack to extended API

This commit is contained in:
Justin Aquadro committed 2015-12-10 22:28:51 -05:00
1 parent dd11a81b43
commit e098b4a449
5 files changed
+71 -116

No files matched your search

+2 -2
View File
@@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-1.0.4"
version = "1.7.10-1.1.0"
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StorageDrawers-BiomesOPlenty"
@@ -26,7 +26,7 @@ minecraft {
assetDir = "../../runtime/assets"
replace '@VERSION@', project.version
replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.5.8,)"
replace 'required-after:StorageDrawers', "required-after:StorageDrawers@[1.7.5,)"
}
sourceSets.main {
@@ -1,6 +1,7 @@
package com.jaquadro.minecraft.storagedrawers.packs.bop;
import com.jaquadro.minecraft.storagedrawers.api.pack.IPackDataResolver;
import com.jaquadro.minecraft.storagedrawers.api.IStorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.packs.bop.core.*;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
@@ -16,12 +17,9 @@ public class StorageDrawersPack
public static final String MOD_VERSION = "@VERSION@";
public static final String SOURCE_PATH = "com.jaquadro.minecraft.storagedrawers.packs.bop.";
public IPackDataResolver resolver = new DataResolver(MOD_ID, new String[] {
"sacredoak", "cherry", "dark", "fir", "ethereal", "magic", "mangrove", "palm", "redwood", "willow", null, "pine", "hellbark", "jacaranda", "mahogany"
});
public DataResolver resolver = new DataResolver(MOD_ID);
public ModBlocks blocks = new ModBlocks();
public ModRecipes recipes = new ModRecipes();
@Mod.Instance(MOD_ID)
public static StorageDrawersPack instance;
@@ -37,11 +35,13 @@ public class StorageDrawersPack
@Mod.EventHandler
public void init (FMLInitializationEvent event) {
RefinedRelocation.init();
recipes.init();
resolver.init();
}
@Mod.EventHandler
public void postInit (FMLPostInitializationEvent event) {
RefinedRelocation.postInit();
IStorageDrawersApi api = StorageDrawersApi.instance();
if (api != null)
api.registerStandardPackRecipes(resolver);
}
}
@@ -1,17 +1,69 @@
package com.jaquadro.minecraft.storagedrawers.packs.bop.core;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockType;
import com.jaquadro.minecraft.storagedrawers.api.pack.StandardDataResolver;
import com.jaquadro.minecraft.storagedrawers.api.pack.ExtendedDataResolver;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
public class DataResolver extends StandardDataResolver
public class DataResolver extends ExtendedDataResolver
{
public DataResolver (String modID, String[] unlocalizedNames) {
super(modID, unlocalizedNames);
private static String[] textureNames = new String[] {
"sacredoak", "cherry", "dark", "fir", "ethereal", "magic", "mangrove", "palm", "redwood", "willow", null, "pine", "hellbark", "jacaranda", "mahogany"
};
public DataResolver (String modID) {
super(modID, textureNames);
}
@Override
public CreativeTabs getCreativeTabs (BlockType type) {
return ModCreativeTabs.getTabStorageDrawers();
}
@Override
public Block getBlock (BlockConfiguration blockConfig) {
switch (blockConfig.getBlockType()) {
case Drawers:
if (blockConfig.getDrawerCount() == 1)
return ModBlocks.fullDrawers1;
if (blockConfig.getDrawerCount() == 2 && !blockConfig.isHalfDepth())
return ModBlocks.fullDrawers2;
if (blockConfig.getDrawerCount() == 4 && !blockConfig.isHalfDepth())
return ModBlocks.fullDrawers4;
if (blockConfig.getDrawerCount() == 2 && blockConfig.isHalfDepth())
return ModBlocks.halfDrawers2;
if (blockConfig.getDrawerCount() == 4 && blockConfig.isHalfDepth())
return ModBlocks.halfDrawers4;
break;
case DrawersSorting:
if (blockConfig.getDrawerCount() == 1)
return RefinedRelocation.fullDrawers1;
if (blockConfig.getDrawerCount() == 2 && !blockConfig.isHalfDepth())
return RefinedRelocation.fullDrawers2;
if (blockConfig.getDrawerCount() == 4 && !blockConfig.isHalfDepth())
return RefinedRelocation.fullDrawers4;
if (blockConfig.getDrawerCount() == 2 && blockConfig.isHalfDepth())
return RefinedRelocation.halfDrawers2;
if (blockConfig.getDrawerCount() == 4 && blockConfig.isHalfDepth())
return RefinedRelocation.halfDrawers4;
break;
case Trim:
return ModBlocks.trim;
case TrimSorting:
return RefinedRelocation.trim;
}
return null;
}
@Override
public void init () {
for (int i = 0, p = 0, m = 0; i < 8; i++, p++, m++)
setPlankSlab(i, GameRegistry.findBlock("BiomesOPlenty", "planks"), p, GameRegistry.findBlock("BiomesOPlenty", "woodenSingleSlab1"), m);
for (int i = 8, p = 8, m = 0; i < 10; i++, p++, m++)
setPlankSlab(i, GameRegistry.findBlock("BiomesOPlenty", "planks"), p, GameRegistry.findBlock("BiomesOPlenty", "woodenSingleSlab2"), m);
for (int i = 11, p = 11, m = 3; i < textureNames.length; i++, p++, m++)
setPlankSlab(i, GameRegistry.findBlock("BiomesOPlenty", "planks"), p, GameRegistry.findBlock("BiomesOPlenty", "woodenSingleSlab2"), m);
}
}
@@ -1,67 +0,0 @@
package com.jaquadro.minecraft.storagedrawers.packs.bop.core;
import com.jaquadro.minecraft.storagedrawers.api.IStorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.StorageDrawersApi;
import com.jaquadro.minecraft.storagedrawers.api.config.IBlockConfig;
import com.jaquadro.minecraft.storagedrawers.api.pack.BlockConfiguration;
import com.jaquadro.minecraft.storagedrawers.api.pack.IPackDataResolver;
import com.jaquadro.minecraft.storagedrawers.packs.bop.StorageDrawersPack;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class ModRecipes
{
public void init () {
IStorageDrawersApi api = StorageDrawersApi.instance();
if (api == null)
return;
IBlockConfig blockConfig = api.userConfig().blockConfig();
String nameFull1 = blockConfig.getBlockConfigName(BlockConfiguration.BasicFull1);
String nameFull2 = blockConfig.getBlockConfigName(BlockConfiguration.BasicFull2);
String nameFull4 = blockConfig.getBlockConfigName(BlockConfiguration.BasicFull4);
String nameHalf2 = blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf2);
String nameHalf4 = blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf4);
String nameTrim = blockConfig.getBlockConfigName(BlockConfiguration.Trim);
Block planks = GameRegistry.findBlock("BiomesOPlenty", "planks");
Block slab1 = GameRegistry.findBlock("BiomesOPlenty", "woodenSingleSlab1");
Block slab2 = GameRegistry.findBlock("BiomesOPlenty", "woodenSingleSlab2");
IPackDataResolver resolver = StorageDrawersPack.instance.resolver;
for (int i = 0; i < 16; i++) {
if (!resolver.isValidMetaValue(i))
continue;
if (planks != null) {
if (blockConfig.isBlockEnabled(nameFull1))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers1, blockConfig.getBlockRecipeOutput(nameFull1), i), "xxx", " y ", "xxx",
'x', new ItemStack(planks, 1, i), 'y', "chestWood"));
if (blockConfig.isBlockEnabled(nameFull2))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers2, blockConfig.getBlockRecipeOutput(nameFull2), i), "xyx", "xxx", "xyx",
'x', new ItemStack(planks, 1, i), 'y', "chestWood"));
if (blockConfig.isBlockEnabled(nameFull4))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fullDrawers4, blockConfig.getBlockRecipeOutput(nameFull4), i), "yxy", "xxx", "yxy",
'x', new ItemStack(planks, 1, i), 'y', "chestWood"));
if (blockConfig.isBlockEnabled(nameTrim)) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.trim, blockConfig.getBlockRecipeOutput(nameTrim), i), "xyx", "yyy", "xyx",
'x', "stickWood", 'y', new ItemStack(planks, 1, i)));
}
}
Block recipeSlab = (i < 8) ? slab1 : slab2;
if (recipeSlab != null) {
if (blockConfig.isBlockEnabled(nameHalf2))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers2, blockConfig.getBlockRecipeOutput(nameHalf2), i), "xyx", "xxx", "xyx",
'x', new ItemStack(recipeSlab, 1, i % 8), 'y', "chestWood"));
if (blockConfig.isBlockEnabled(nameHalf4))
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.halfDrawers4, blockConfig.getBlockRecipeOutput(nameHalf4), i), "yxy", "xxx", "yxy",
'x', new ItemStack(recipeSlab, 1, i % 8), 'y', "chestWood"));
}
}
}
}
@@ -9,10 +9,7 @@ import com.jaquadro.minecraft.storagedrawers.api.pack.IPackBlockFactory;
import com.jaquadro.minecraft.storagedrawers.api.pack.IPackDataResolver;
import com.jaquadro.minecraft.storagedrawers.packs.bop.StorageDrawersPack;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class RefinedRelocation
{
@@ -21,6 +18,7 @@ public class RefinedRelocation
public static Block fullDrawers4;
public static Block halfDrawers2;
public static Block halfDrawers4;
public static Block trim;
public static void init () {
IStorageDrawersApi api = StorageDrawersApi.instance();
@@ -38,12 +36,14 @@ public class RefinedRelocation
fullDrawers4 = factory.createBlock(BlockConfiguration.SortingFull4, resolver);
halfDrawers2 = factory.createBlock(BlockConfiguration.SortingHalf2, resolver);
halfDrawers4 = factory.createBlock(BlockConfiguration.SortingHalf4, resolver);
trim = factory.createBlock(BlockConfiguration.TrimSorting, resolver);
factory.bindSortingBlock(ModBlocks.fullDrawers1, fullDrawers1);
factory.bindSortingBlock(ModBlocks.fullDrawers2, fullDrawers2);
factory.bindSortingBlock(ModBlocks.fullDrawers4, fullDrawers4);
factory.bindSortingBlock(ModBlocks.halfDrawers2, halfDrawers2);
factory.bindSortingBlock(ModBlocks.halfDrawers4, halfDrawers4);
factory.bindSortingBlock(ModBlocks.trim, trim);
IUserConfig config = api.userConfig();
IBlockConfig blockConfig = config.blockConfig();
@@ -58,6 +58,8 @@ public class RefinedRelocation
factory.registerBlock(halfDrawers2, "halfDrawersSort2");
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.SortingHalf4)))
factory.registerBlock(halfDrawers4, "halfDrawersSort4");
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.TrimSorting)))
factory.registerBlock(trim, "trimSort");
if (!config.addonConfig().showAddonItemsNEI()) {
factory.hideBlock(ModBlocks.getQualifiedName(fullDrawers1));
@@ -65,39 +67,7 @@ public class RefinedRelocation
factory.hideBlock(ModBlocks.getQualifiedName(fullDrawers4));
factory.hideBlock(ModBlocks.getQualifiedName(halfDrawers2));
factory.hideBlock(ModBlocks.getQualifiedName(halfDrawers4));
}
}
public static void postInit () {
IStorageDrawersApi api = StorageDrawersApi.instance();
if (api == null)
return;
if (!Loader.isModLoaded("RefinedRelocation") || !api.userConfig().integrationConfig().isRefinedRelocationEnabled())
return;
IPackDataResolver resolver = StorageDrawersPack.instance.resolver;
IBlockConfig blockConfig = api.userConfig().blockConfig();
for (int i = 0; i < 16; i++) {
if (!resolver.isValidMetaValue(i))
continue;
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.SortingFull1)))
GameRegistry.addRecipe(new ItemStack(fullDrawers1, 1, i), "x x", " y ", "x x",
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.fullDrawers1, 1, i));
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.SortingFull2)))
GameRegistry.addRecipe(new ItemStack(fullDrawers2, 1, i), "x x", " y ", "x x",
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.fullDrawers2, 1, i));
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.SortingFull4)))
GameRegistry.addRecipe(new ItemStack(halfDrawers2, 1, i), "x x", " y ", "x x",
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.halfDrawers2, 1, i));
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.SortingHalf2)))
GameRegistry.addRecipe(new ItemStack(fullDrawers4, 1, i), "x x", " y ", "x x",
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.fullDrawers4, 1, i));
if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.SortingHalf4)))
GameRegistry.addRecipe(new ItemStack(halfDrawers4, 1, i), "x x", " y ", "x x",
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.halfDrawers4, 1, i));
factory.hideBlock(ModBlocks.getQualifiedName(trim));
}
}
}