use of cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry in project Engine by VoltzEngine-Project.
the class CommandDebugItem method handleConsoleCommand.
@Override
public boolean handleConsoleCommand(ICommandSender sender, String[] args) {
if (args != null && args.length > 0 && !"help".equalsIgnoreCase(args[0])) {
if (args[0].equals("dump") || args[0].equals("dumpsubs")) {
sender.addChatMessage(new ChatComponentText("See console for data"));
FMLControlledNamespacedRegistry<Item> registry = (FMLControlledNamespacedRegistry<Item>) Item.itemRegistry;
Set set = registry.getKeys();
for (Object obj : set) {
String name = (String) obj;
Item item = registry.getObject(name);
System.out.println("" + name + " " + item);
if (item != null) {
if (args[0].equals("dumpsubs")) {
List list = new ArrayList();
item.getSubItems(item, item.getCreativeTab(), list);
for (Object o : list) {
System.out.println("\t" + o);
if (o instanceof ItemStack) {
ItemStack stack = (ItemStack) o;
System.out.println("\t\tName: " + stack.getUnlocalizedName());
int[] oreIDs = OreDictionary.getOreIDs(stack);
if (oreIDs != null && oreIDs.length > 0) {
for (int i : oreIDs) {
String oreName = OreDictionary.getOreName(i);
System.out.println("\t\t" + oreName);
}
}
}
}
}
}
}
return true;
}
} else {
return handleHelp(sender, args);
}
return false;
}
use of cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry in project Engine by VoltzEngine-Project.
the class HeatedBlockRegistry method init.
public static void init(Configuration config) {
config.setCategoryComment("Block_Heat_Conversions", "Conversion of one block into another when a lot of heat is added. \'Air\' as an entry means the block turned into dust");
//Vanilla block handling
//---------------------------------------------------------------------
//Heating values
addNewHeatingConversion(Blocks.ice, Blocks.water, (int) TemperatureUnit.Fahrenheit.conversion.toKelvin(32));
addNewHeatingConversion(Blocks.obsidian, Blocks.lava, 1293);
//Made up conversion
addNewHeatingConversion(Blocks.grass, Blocks.dirt, 600);
//Cooling values
addNewCoolingConversion(Blocks.water, Blocks.ice, 273);
//made up value
addNewCoolingConversion(Blocks.lava, Blocks.obsidian, 1200);
//Everything else not registered, init with default data to make life simple
if (Block.blockRegistry instanceof FMLControlledNamespacedRegistry) {
FMLControlledNamespacedRegistry reg = ((FMLControlledNamespacedRegistry) Block.blockRegistry);
for (Object obj : reg.typeSafeIterable()) {
if (obj instanceof Block) {
String name = reg.getNameForObject(obj);
Material mat = ((Block) obj).getMaterial();
Block blockToConvertTo = Blocks.air;
int temp = 0;
if (mat.getCanBurn()) {
temp = 600;
} else if (mat == Material.rock) {
temp = 1293;
blockToConvertTo = Blocks.lava;
}
if (temp > 0) {
String conversion = config.getString(name, "Heat_Conversions", reg.getNameForObject(blockToConvertTo), "");
if (reg.getObject(conversion) != null) {
Object c_obj = reg.getObject(conversion);
if (c_obj instanceof Block) {
if (!warm_up_conversion.containsKey(obj)) {
if (blockToConvertTo == Blocks.lava) {
addNewHeatingConversion((Block) obj, new PlacementData(Blocks.cobblestone, 0), temp);
} else {
addNewHeatingConversion((Block) obj, (Block) c_obj, temp);
}
}
} else {
Engine.instance.logger().error("Error c_obj is not an instance of a block");
}
} else {
Engine.instance.logger().error("Config entry for heat conversion " + name + " has an invalid conversion of " + conversion);
}
}
}
}
}
}
Aggregations