Skip to content

Commit

Permalink
Make leaves and wood properly burn
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed May 7, 2021
1 parent 6377cb0 commit 2b5b682
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/main/java/slimeknights/tconstruct/world/TinkerWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.ComposterBlock;
import net.minecraft.block.FireBlock;
import net.minecraft.block.SlimeBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
Expand Down Expand Up @@ -64,6 +65,7 @@

import java.util.EnumMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;

/**
Expand Down Expand Up @@ -189,6 +191,21 @@ void entityAttributes(EntityAttributeCreationEvent event) {
event.put(skySlimeEntity.get(), MonsterEntity.func_234295_eP_().create());
}

/** Sets all fire info for the given wood */
private static void setWoodFireInfo(FireBlock fireBlock, WoodBlockObject wood) {
// planks
fireBlock.setFireInfo(wood.get(), 5, 20);
fireBlock.setFireInfo(wood.getSlab(), 5, 20);
fireBlock.setFireInfo(wood.getStairs(), 5, 20);
fireBlock.setFireInfo(wood.getFence(), 5, 20);
fireBlock.setFireInfo(wood.getFenceGate(), 5, 20);
// logs
fireBlock.setFireInfo(wood.getLog(), 5, 5);
fireBlock.setFireInfo(wood.getStrippedLog(), 5, 5);
fireBlock.setFireInfo(wood.getWood(), 5, 5);
fireBlock.setFireInfo(wood.getStrippedWood(), 5, 5);
}

@SubscribeEvent
void commonSetup(final FMLCommonSetupEvent event) {
EntitySpawnPlacementRegistry.register(skySlimeEntity.get(), EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.WORLD_SURFACE, BlueSlimeEntity::canSpawnHere);
Expand All @@ -204,6 +221,26 @@ void commonSetup(final FMLCommonSetupEvent event) {
ComposterBlock.registerCompostable(0.5f, enderSlimeVine);
});

// flammability
event.enqueueWork(() -> {
FireBlock fireblock = (FireBlock)Blocks.FIRE;
// wood
setWoodFireInfo(fireblock, greenheart);
setWoodFireInfo(fireblock, skyroot);
// plants
BiConsumer<FoliageType, Block> plantFireInfo = (type, block) -> {
if (type != FoliageType.BLOOD && type != FoliageType.ICHOR) {
fireblock.setFireInfo(block, 30, 60);
}
};
slimeLeaves.forEach(plantFireInfo);
slimeTallGrass.forEach(plantFireInfo);
slimeFern.forEach(plantFireInfo);
// vines
fireblock.setFireInfo(skySlimeVine.get(), 15, 100);
fireblock.setFireInfo(enderSlimeVine.get(), 15, 100);
});

// ores
COPPER_ORE_FEATURE = Registry.register(WorldGenRegistries.CONFIGURED_FEATURE, location("copper_ore"),
Feature.ORE.withConfiguration(new OreFeatureConfig(FillerBlockType.BASE_STONE_OVERWORLD, TinkerWorld.copperOre.get().getDefaultState(), 9))
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@ public net.minecraft.block.material.Material$Builder func_200504_e()Lnet/minecra
# Slime island settings
public-f net.minecraft.world.gen.settings.DimensionStructuresSettings field_236191_b_ # field_236191_b_

# Making things flammable
public net.minecraft.block.FireBlock func_180686_a(Lnet/minecraft/block/Block;II)V # setFireInfo

0 comments on commit 2b5b682

Please sign in to comment.