Started work on injecting new furnace tile class in...
This commit is contained in:
parent
3a5fe66adb
commit
21ec04da42
2 changed files with 52 additions and 1 deletions
|
@ -4,11 +4,14 @@ import ic2.api.item.Items;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
@ -48,6 +51,7 @@ import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.ModMetadata;
|
import cpw.mods.fml.common.ModMetadata;
|
||||||
|
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
@ -277,5 +281,35 @@ public class ResonantInduction
|
||||||
{
|
{
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 1, EnumWireMaterial.COPPER.ordinal()), "universalCable"));
|
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 1, EnumWireMaterial.COPPER.ordinal()), "universalCable"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Inject new furnace tile class */
|
||||||
|
replaceTileEntity(TileEntityFurnace.class, TileEntityAdvancedFurnace.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void replaceTileEntity(Class<? extends TileEntity> findTile, Class<? extends TileEntity> replaceTile)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Map<String, Class> nameToClassMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_a", "nameToClassMap", "a");
|
||||||
|
Map<Class, String> classToNameMap = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "70326_b", "classToNameMap", "b");
|
||||||
|
|
||||||
|
String findTileID = classToNameMap.get(findTile);
|
||||||
|
|
||||||
|
if (findTileID != null)
|
||||||
|
{
|
||||||
|
nameToClassMap.put(findTileID, replaceTile);
|
||||||
|
classToNameMap.put(replaceTile, findTileID);
|
||||||
|
classToNameMap.remove(findTile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.severe("Failed to replace TileEntity: " + findTile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LOGGER.severe("Failed to replace TileEntity: " + findTile);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
src/resonantinduction/TileEntityAdvancedFurnace.java
Normal file
17
src/resonantinduction/TileEntityAdvancedFurnace.java
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package resonantinduction;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntityFurnace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Meant to replace the furnace class.
|
||||||
|
*
|
||||||
|
* @author Calclavia
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TileEntityAdvancedFurnace extends TileEntityFurnace
|
||||||
|
{
|
||||||
|
public void updateEntity()
|
||||||
|
{
|
||||||
|
super.updateEntity();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue