mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-13 16:54:13 +00:00
Closes Pokefenn/Chisel#36
adding handling for MissingMapping so renamed blocks don't disappear after a world upgrade
This commit is contained in:
1 parent
480b6c3629
commit
d98c38aaf9
1 file changed
+43
@@ -2,6 +2,7 @@ package info.jbcs.minecraft.chisel;
|
||||
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
@@ -28,6 +29,7 @@ import info.jbcs.minecraft.chisel.item.ItemBallOMoss;
|
||||
import info.jbcs.minecraft.chisel.item.ItemChisel;
|
||||
import info.jbcs.minecraft.chisel.item.ItemCloudInABottle;
|
||||
import info.jbcs.minecraft.chisel.item.ItemSmashingRock;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -87,6 +89,47 @@ public class Chisel
|
||||
{
|
||||
m.warn();//(Action.WARN);
|
||||
}
|
||||
|
||||
// Fix mapping of snakestoneSand, snakestoneStone, limestoneStairs, marbleStairs when loading an old (1.5.4) save
|
||||
else if (m.type == Type.BLOCK)
|
||||
{
|
||||
Block block = null;
|
||||
|
||||
if (General.cleanTags(m.name).equals("sandSnakestone"))
|
||||
block = GameRegistry.findBlock(Chisel.MOD_ID, "tile.snakestoneSand");
|
||||
else if (General.cleanTags(m.name).equals("snakestone"))
|
||||
block = GameRegistry.findBlock(Chisel.MOD_ID, "tile.snakestoneStone");
|
||||
else
|
||||
block = GameRegistry.findBlock(Chisel.MOD_ID, General.cleanTags(m.name));
|
||||
|
||||
if (block != null)
|
||||
{
|
||||
m.remap(block);
|
||||
FMLLog.getLogger().info("Remapping block " + m.name + " to " + General.getName(block));
|
||||
}
|
||||
else
|
||||
FMLLog.getLogger().warn("Block " + m.name + " could not get remapped.");
|
||||
}
|
||||
else if (m.type == Type.ITEM)
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if (General.cleanTags(m.name).equals("sandSnakestone"))
|
||||
item = GameRegistry.findItem(Chisel.MOD_ID, "tile.snakestoneSand");
|
||||
else if (General.cleanTags(m.name).equals("snakestone"))
|
||||
item = GameRegistry.findItem(Chisel.MOD_ID, "tile.snakestoneStone");
|
||||
else
|
||||
item = GameRegistry.findItem(Chisel.MOD_ID, General.cleanTags(m.name));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
m.remap(item);
|
||||
FMLLog.getLogger().info("Remapping item " + m.name + " to " + General.getName(item));
|
||||
|
||||
}
|
||||
else
|
||||
FMLLog.getLogger().warn("Item " + m.name + " could not get remapped.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user