Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow material blocks to be burned #1974

Merged
merged 3 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public static void register() {
Wood = new Material.Builder(1617, gregtechId("wood"))
.wood()
.color(0x896727).iconSet(WOOD)
.flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, FLAMMABLE, GENERATE_GEAR, GENERATE_FRAME)
.flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, GENERATE_GEAR, GENERATE_FRAME)
.fluidPipeProperties(340, 5, false)
.build();

Expand Down Expand Up @@ -486,7 +486,7 @@ public static void register() {
TreatedWood = new Material.Builder(1648, gregtechId("treated_wood"))
.wood()
.color(0x674A28).iconSet(WOOD)
.flags(GENERATE_PLATE, FLAMMABLE, GENERATE_ROD, GENERATE_FRAME)
.flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_FRAME)
.fluidPipeProperties(340, 10, false)
.build();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package gregtech.api.unification.material.properties;

import gregtech.api.unification.material.info.MaterialFlags;
import gregtech.api.unification.ore.OrePrefix;

public class WoodProperty implements IMaterialProperty {

@Override
public void verifyProperty(MaterialProperties properties) {
properties.ensureSet(PropertyKey.DUST);
properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE);

if (properties.hasProperty(PropertyKey.FLUID_PIPE)) {
OrePrefix.pipeTinyFluid.setIgnored(properties.getMaterial());
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/gregtech/common/blocks/BlockMaterialBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.material.info.MaterialFlags;
import gregtech.api.util.GTUtility;
import gregtech.common.blocks.properties.PropertyMaterial;
import net.minecraft.block.Block;
Expand All @@ -10,6 +11,7 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
Expand Down Expand Up @@ -91,4 +93,22 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemSta
public MapColor getMapColor(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) {
return getMaterial(state).getMaterialMapColor();
}

@Override
public int getFlammability(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing face) {
Material material = getGtMaterial(world.getBlockState(pos));
if (material.hasFlag(MaterialFlags.FLAMMABLE)) {
return 20; // flammability of things like Wood Planks
}
return super.getFlammability(world, pos, face);
}

@Override
public int getFireSpreadSpeed(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing face) {
Material material = getGtMaterial(world.getBlockState(pos));
if (material.hasFlag(MaterialFlags.FLAMMABLE)) {
return 5; // encouragement of things like Wood Planks
}
return super.getFireSpreadSpeed(world, pos, face);
}
}