use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class SurfaceRockPopulator method findUndergroundMaterials.
private Set<Material> findUndergroundMaterials(Collection<IBlockState> generatedBlocks) {
HashSet<Material> result = new HashSet<>();
for (IBlockState blockState : generatedBlocks) {
Material resultMaterial;
if (blockState.getBlock() instanceof IFluidBlock || blockState.getBlock() instanceof BlockLiquid) {
Fluid fluid = FluidRegistry.lookupFluidForBlock(blockState.getBlock());
resultMaterial = fluid == null ? null : MetaFluids.getMaterialFromFluid(fluid);
} else {
ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, blockState.getBlock().damageDropped(blockState));
UnificationEntry entry = OreDictUnifier.getUnificationEntry(itemStack);
if (entry != null && entry.material != null && entry.material.hasProperty(PropertyKey.ORE))
resultMaterial = entry.material;
else
resultMaterial = null;
}
if (resultMaterial != null) {
result.add(resultMaterial);
}
}
return result;
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class CommonProxy method registerBlocks.
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) {
GTLog.logger.info("Registering Blocks...");
IForgeRegistry<Block> registry = event.getRegistry();
registry.register(MACHINE);
StoneType.init();
for (Material material : GregTechAPI.MATERIAL_REGISTRY) {
if (material.hasProperty(PropertyKey.ORE)) {
createOreBlock(material);
}
if (material.hasProperty(PropertyKey.WIRE)) {
for (BlockCable cable : CABLES) {
if (!cable.getItemPipeType(null).isCable() || !material.getProperty(PropertyKey.WIRE).isSuperconductor())
cable.addCableMaterial(material, material.getProperty(PropertyKey.WIRE));
}
}
if (material.hasProperty(PropertyKey.FLUID_PIPE)) {
for (BlockFluidPipe pipe : FLUID_PIPES) {
if (!pipe.getItemPipeType(pipe.getItem(material)).getOrePrefix().isIgnored(material)) {
pipe.addPipeMaterial(material, material.getProperty(PropertyKey.FLUID_PIPE));
}
}
}
if (material.hasProperty(PropertyKey.ITEM_PIPE)) {
for (BlockItemPipe pipe : ITEM_PIPES) {
if (!pipe.getItemPipeType(pipe.getItem(material)).getOrePrefix().isIgnored(material)) {
pipe.addPipeMaterial(material, material.getProperty(PropertyKey.ITEM_PIPE));
}
}
}
}
for (BlockFluidPipe pipe : FLUID_PIPES) {
if (!pipe.getItemPipeType(pipe.getItem(Materials.Wood)).getOrePrefix().isIgnored(Materials.Wood) || !pipe.getItemPipeType(pipe.getItem(Materials.TreatedWood)).getOrePrefix().isIgnored(Materials.TreatedWood)) {
pipe.addPipeMaterial(Materials.Wood, new FluidPipeProperties(310, 5, false));
pipe.addPipeMaterial(Materials.TreatedWood, new FluidPipeProperties(310, 8, false));
}
}
for (BlockCable cable : CABLES) registry.register(cable);
for (BlockFluidPipe pipe : FLUID_PIPES) registry.register(pipe);
for (BlockItemPipe pipe : ITEM_PIPES) registry.register(pipe);
registry.register(HERMETIC_CASING);
registry.register(FOAM);
registry.register(REINFORCED_FOAM);
registry.register(PETRIFIED_FOAM);
registry.register(REINFORCED_PETRIFIED_FOAM);
registry.register(BOILER_CASING);
registry.register(BOILER_FIREBOX_CASING);
registry.register(METAL_CASING);
registry.register(TURBINE_CASING);
registry.register(MACHINE_CASING);
registry.register(STEAM_CASING);
registry.register(MULTIBLOCK_CASING);
registry.register(TRANSPARENT_CASING);
registry.register(WIRE_COIL);
registry.register(FUSION_CASING);
registry.register(WARNING_SIGN);
registry.register(ASPHALT);
registry.register(STONE_SMOOTH);
registry.register(STONE_COBBLE);
registry.register(STONE_COBBLE_MOSSY);
registry.register(STONE_POLISHED);
registry.register(STONE_BRICKS);
registry.register(STONE_BRICKS_CRACKED);
registry.register(STONE_BRICKS_MOSSY);
registry.register(STONE_CHISELED);
registry.register(STONE_TILED);
registry.register(STONE_TILED_SMALL);
registry.register(STONE_BRICKS_SMALL);
registry.register(STONE_WINDMILL_A);
registry.register(STONE_WINDMILL_B);
registry.register(STONE_BRICKS_SQUARE);
registry.register(RUBBER_LOG);
registry.register(RUBBER_LEAVES);
registry.register(RUBBER_SAPLING);
registry.register(PLANKS);
COMPRESSED.values().stream().distinct().forEach(registry::register);
FRAMES.values().stream().distinct().forEach(registry::register);
SURFACE_ROCK.values().stream().distinct().forEach(registry::register);
ORES.forEach(registry::register);
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class CommonProxy method modifyFuelBurnTime.
@SubscribeEvent
public static void modifyFuelBurnTime(FurnaceFuelBurnTimeEvent event) {
ItemStack stack = event.getItemStack();
Block block = Block.getBlockFromItem(stack.getItem());
// handle sapling and log burn rates
if (block == RUBBER_LOG || block == PLANKS) {
event.setBurnTime(300);
} else if (block == RUBBER_SAPLING) {
event.setBurnTime(100);
}
// handle material blocks burn value
if (stack.getItem() instanceof CompressedItemBlock) {
CompressedItemBlock itemBlock = (CompressedItemBlock) stack.getItem();
Material material = itemBlock.getBlockState(stack).getValue(itemBlock.compressedBlock.variantProperty);
DustProperty property = material.getProperty(PropertyKey.DUST);
if (property != null && property.getBurnTime() > 0) {
// compute burn value for block prefix, taking amount of material in block into account
double materialUnitsInBlock = OrePrefix.block.getMaterialAmount(material) / (GTValues.M * 1.0);
event.setBurnTime((int) (materialUnitsInBlock * property.getBurnTime()));
}
}
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class BlockCompressed method onTextureStitch.
@Override
@SideOnly(Side.CLIENT)
public void onTextureStitch(TextureStitchEvent.Pre event) {
for (IBlockState state : this.getBlockState().getValidStates()) {
Material m = state.getValue(variantProperty);
event.getMap().registerSprite(MaterialIconType.block.getBlockPath(m.getMaterialIconSet()));
}
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class MetaBlocks method registerOreDict.
public static void registerOreDict() {
OreDictUnifier.registerOre(new ItemStack(RUBBER_LOG, 1, GTValues.W), OrePrefix.log, Materials.Wood);
OreDictUnifier.registerOre(new ItemStack(RUBBER_LEAVES, 1, GTValues.W), "treeLeaves");
OreDictUnifier.registerOre(new ItemStack(RUBBER_SAPLING, 1, GTValues.W), "treeSapling");
OreDictUnifier.registerOre(PLANKS.getItemVariant(BlockGregPlanks.BlockType.RUBBER_PLANK), OrePrefix.plank, Materials.Wood);
OreDictUnifier.registerOre(PLANKS.getItemVariant(BlockGregPlanks.BlockType.TREATED_PLANK), OrePrefix.plank, Materials.TreatedWood);
GameRegistry.addSmelting(RUBBER_LOG, new ItemStack(Items.COAL, 1, 1), 0.15F);
for (Entry<Material, BlockCompressed> entry : COMPRESSED.entrySet()) {
Material material = entry.getKey();
BlockCompressed block = entry.getValue();
ItemStack itemStack = block.getItem(material);
OreDictUnifier.registerOre(itemStack, OrePrefix.block, material);
}
for (Entry<Material, BlockFrame> entry : FRAMES.entrySet()) {
Material material = entry.getKey();
BlockFrame block = entry.getValue();
ItemStack itemStack = block.getItem(material);
OreDictUnifier.registerOre(itemStack, OrePrefix.frameGt, material);
}
for (BlockOre blockOre : ORES) {
Material material = blockOre.material;
for (StoneType stoneType : blockOre.STONE_TYPE.getAllowedValues()) {
if (stoneType == null)
continue;
ItemStack normalStack = blockOre.getItem(blockOre.getDefaultState().withProperty(blockOre.STONE_TYPE, stoneType));
OreDictUnifier.registerOre(normalStack, stoneType.processingPrefix, material);
}
}
for (BlockCable cable : CABLES) {
for (Material pipeMaterial : cable.getEnabledMaterials()) {
ItemStack itemStack = cable.getItem(pipeMaterial);
OreDictUnifier.registerOre(itemStack, cable.getPrefix(), pipeMaterial);
}
}
for (BlockFluidPipe pipe : FLUID_PIPES) {
for (Material pipeMaterial : pipe.getEnabledMaterials()) {
ItemStack itemStack = pipe.getItem(pipeMaterial);
OreDictUnifier.registerOre(itemStack, pipe.getPrefix(), pipeMaterial);
}
}
for (BlockItemPipe pipe : ITEM_PIPES) {
for (Material pipeMaterial : pipe.getEnabledMaterials()) {
ItemStack itemStack = pipe.getItem(pipeMaterial);
OreDictUnifier.registerOre(itemStack, pipe.getPrefix(), pipeMaterial);
}
}
}
Aggregations