use of net.minecraft.block.material.Material 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