-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trap and report tile entity save errors
- Loading branch information
Showing
9 changed files
with
247 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...src/com/jaquadro/minecraft/storagedrawers/packs/natura/block/BlockSortingDrawersPack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.jaquadro.minecraft.storagedrawers.packs.natura.block; | ||
|
||
import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.BlockSortingDrawers; | ||
import com.jaquadro.minecraft.storagedrawers.packs.natura.StorageDrawersPack; | ||
import com.jaquadro.minecraft.storagedrawers.packs.natura.core.ModCreativeTabs; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import net.minecraft.client.renderer.texture.IIconRegister; | ||
import net.minecraft.creativetab.CreativeTabs; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.*; | ||
|
||
import java.util.List; | ||
|
||
public class BlockSortingDrawersPack extends BlockSortingDrawers | ||
{ | ||
public BlockSortingDrawersPack (String blockName, int drawerCount, boolean halfDepth) { | ||
super(blockName, drawerCount, halfDepth); | ||
|
||
setCreativeTab(ModCreativeTabs.tabStorageDrawers); | ||
} | ||
|
||
@Override | ||
public void getSubBlocks (Item item, CreativeTabs creativeTabs, List list) { | ||
for (int i = 1; i < BlockDrawersPack.textureNames.length; i++) | ||
list.add(new ItemStack(item, 1, i)); | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void registerBlockIcons (IIconRegister register) { | ||
super.registerBlockIcons(register); | ||
|
||
String[] subtex = BlockDrawersPack.textureNames; | ||
|
||
iconSide = new IIcon[subtex.length]; | ||
iconSideH = new IIcon[subtex.length]; | ||
iconSideV = new IIcon[subtex.length]; | ||
iconFront1 = new IIcon[subtex.length]; | ||
iconFront2 = new IIcon[subtex.length]; | ||
iconFront4 = new IIcon[subtex.length]; | ||
iconTrim = new IIcon[subtex.length]; | ||
iconSort = new IIcon[subtex.length]; | ||
|
||
for (int i = 0; i < subtex.length; i++) { | ||
iconFront1[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_front_1"); | ||
iconFront2[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_front_2"); | ||
iconFront4[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_front_4"); | ||
iconSide[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_side"); | ||
iconSideV[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_side_v"); | ||
iconSideH[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_side_h"); | ||
iconTrim[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_trim"); | ||
iconSort[i] = register.registerIcon(StorageDrawersPack.MOD_ID + ":drawers_" + subtex[i] + "_sort"); | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
...Natura/src/com/jaquadro/minecraft/storagedrawers/packs/natura/core/RefinedRelocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.jaquadro.minecraft.storagedrawers.packs.natura.core; | ||
|
||
import com.jaquadro.minecraft.storagedrawers.StorageDrawers; | ||
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; | ||
import com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation.*; | ||
import com.jaquadro.minecraft.storagedrawers.packs.natura.block.BlockDrawersPack; | ||
import com.jaquadro.minecraft.storagedrawers.packs.natura.block.BlockSortingDrawersPack; | ||
import com.jaquadro.minecraft.storagedrawers.packs.natura.item.ItemSortingDrawersPack; | ||
import cpw.mods.fml.common.Loader; | ||
import cpw.mods.fml.common.registry.GameRegistry; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class RefinedRelocation | ||
{ | ||
public static BlockSortingDrawersPack fullDrawers1; | ||
public static BlockSortingDrawersPack fullDrawers2; | ||
public static BlockSortingDrawersPack fullDrawers4; | ||
public static BlockSortingDrawersPack halfDrawers2; | ||
public static BlockSortingDrawersPack halfDrawers4; | ||
|
||
public static void init () { | ||
ConfigManager config = StorageDrawers.config; | ||
if (!Loader.isModLoaded("RefinedRelocation") || !config.cache.enableRefinedRelocationIntegration) | ||
return; | ||
|
||
fullDrawers1 = new BlockSortingDrawersPack(ModBlocks.makeName("fullDrawers1"), 1, false); | ||
fullDrawers2 = new BlockSortingDrawersPack(ModBlocks.makeName("fullDrawers2"), 2, false); | ||
fullDrawers4 = new BlockSortingDrawersPack(ModBlocks.makeName("fullDrawers4"), 4, false); | ||
halfDrawers2 = new BlockSortingDrawersPack(ModBlocks.makeName("halfDrawers2"), 2, true); | ||
halfDrawers4 = new BlockSortingDrawersPack(ModBlocks.makeName("halfDrawers4"), 4, true); | ||
|
||
SortingBlockRegistry.register(ModBlocks.fullDrawers1, fullDrawers1); | ||
SortingBlockRegistry.register(ModBlocks.fullDrawers2, fullDrawers2); | ||
SortingBlockRegistry.register(ModBlocks.fullDrawers4, fullDrawers4); | ||
SortingBlockRegistry.register(ModBlocks.halfDrawers2, halfDrawers2); | ||
SortingBlockRegistry.register(ModBlocks.halfDrawers4, halfDrawers4); | ||
|
||
if (config.isBlockEnabled("fulldrawers1")) { | ||
GameRegistry.registerBlock(fullDrawers1, ItemSortingDrawersPack.class, "fullDrawersSort1"); | ||
GameRegistry.registerTileEntity(TileSortingDrawersStandard.class, ModBlocks.getQualifiedName(fullDrawers1)); | ||
} | ||
if (config.isBlockEnabled("fulldrawers2")) { | ||
GameRegistry.registerBlock(fullDrawers2, ItemSortingDrawersPack.class, "fullDrawersSort2"); | ||
GameRegistry.registerTileEntity(TileSortingDrawersStandard.class, ModBlocks.getQualifiedName(fullDrawers2)); | ||
} | ||
if (config.isBlockEnabled("fulldrawers4")) { | ||
GameRegistry.registerBlock(fullDrawers4, ItemSortingDrawersPack.class, "fullDrawersSort4"); | ||
GameRegistry.registerTileEntity(TileSortingDrawersStandard.class, ModBlocks.getQualifiedName(fullDrawers4)); | ||
} | ||
if (config.isBlockEnabled("halfdrawers2")) { | ||
GameRegistry.registerBlock(halfDrawers2, ItemSortingDrawersPack.class, "halfDrawersSort2"); | ||
GameRegistry.registerTileEntity(TileSortingDrawersStandard.class, ModBlocks.getQualifiedName(halfDrawers2)); | ||
} | ||
if (config.isBlockEnabled("halfdrawers4")) { | ||
GameRegistry.registerBlock(halfDrawers4, ItemSortingDrawersPack.class, "halfDrawersSort4"); | ||
GameRegistry.registerTileEntity(TileSortingDrawersStandard.class, ModBlocks.getQualifiedName(halfDrawers4)); | ||
} | ||
} | ||
|
||
public static void postInit () { | ||
ConfigManager config = StorageDrawers.config; | ||
if (!Loader.isModLoaded("RefinedRelocation") || !config.cache.enableRefinedRelocationIntegration) | ||
return; | ||
|
||
for (int i = 0; i < BlockDrawersPack.textureNames.length; i++) { | ||
if (config.isBlockEnabled("fulldrawers1")) | ||
GameRegistry.addRecipe(new ItemStack(fullDrawers1, 1, i), "x x", " y ", "x x", | ||
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.fullDrawers1, 1, i)); | ||
if (config.isBlockEnabled("fulldrawers2")) | ||
GameRegistry.addRecipe(new ItemStack(fullDrawers2, 1, i), "x x", " y ", "x x", | ||
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.fullDrawers2, 1, i)); | ||
if (config.isBlockEnabled("halfdrawers2")) | ||
GameRegistry.addRecipe(new ItemStack(halfDrawers2, 1, i), "x x", " y ", "x x", | ||
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.halfDrawers2, 1, i)); | ||
if (config.isBlockEnabled("fulldrawers4")) | ||
GameRegistry.addRecipe(new ItemStack(fullDrawers4, 1, i), "x x", " y ", "x x", | ||
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.fullDrawers4, 1, i)); | ||
if (config.isBlockEnabled("halfdrawers4")) | ||
GameRegistry.addRecipe(new ItemStack(halfDrawers4, 1, i), "x x", " y ", "x x", | ||
'x', Items.gold_nugget, 'y', new ItemStack(ModBlocks.halfDrawers4, 1, i)); | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...a/src/com/jaquadro/minecraft/storagedrawers/packs/natura/item/ItemSortingDrawersPack.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.jaquadro.minecraft.storagedrawers.packs.natura.item; | ||
|
||
import com.jaquadro.minecraft.storagedrawers.StorageDrawers; | ||
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager; | ||
import com.jaquadro.minecraft.storagedrawers.packs.natura.core.RefinedRelocation; | ||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraft.util.StatCollector; | ||
|
||
import java.util.List; | ||
|
||
public class ItemSortingDrawersPack extends ItemDrawersPack | ||
{ | ||
public ItemSortingDrawersPack (Block block) { | ||
super(block); | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) { | ||
super.addInformation(itemStack, player, list, par4); | ||
|
||
Block block = Block.getBlockFromItem(itemStack.getItem()); | ||
list.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocalFormatted("storageDrawers.waila.sorting")); | ||
} | ||
|
||
@Override | ||
protected int getCapacityForBlock (Block block) { | ||
ConfigManager config = StorageDrawers.config; | ||
int count = 0; | ||
|
||
if (block == RefinedRelocation.fullDrawers1) | ||
count = config.getBlockBaseStorage("fulldrawers1"); | ||
else if (block == RefinedRelocation.fullDrawers2) | ||
count = config.getBlockBaseStorage("fulldrawers2"); | ||
else if (block == RefinedRelocation.fullDrawers4) | ||
count = config.getBlockBaseStorage("fulldrawers4"); | ||
else if (block == RefinedRelocation.halfDrawers2) | ||
count = config.getBlockBaseStorage("halfdrawers2"); | ||
else if (block == RefinedRelocation.halfDrawers4) | ||
count = config.getBlockBaseStorage("halfdrawers4"); | ||
|
||
return count; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...jaquadro/minecraft/storagedrawers/integration/refinedrelocation/SortingBlockRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.jaquadro.minecraft.storagedrawers.integration.refinedrelocation; | ||
|
||
import net.minecraft.block.Block; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class SortingBlockRegistry | ||
{ | ||
private static Map<Block, Block> registry = new HashMap<Block, Block>(); | ||
|
||
public static void register (Block storageBlock, Block sortingBlock) { | ||
registry.put(storageBlock, sortingBlock); | ||
} | ||
|
||
public static Block resolveSortingBlock (Block storageBlock) { | ||
return registry.get(storageBlock); | ||
} | ||
} |