-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix ovens lighting stuff on fire when not lit
- Loading branch information
1 parent
86566ee
commit a56bc17
Showing
4 changed files
with
75 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/eerussianguy/firmalife/common/blockentities/OvenLike.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.eerussianguy.firmalife.common.blockentities; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import com.eerussianguy.firmalife.common.blocks.AbstractOvenBlock; | ||
import com.eerussianguy.firmalife.common.blocks.FLStateProperties; | ||
import com.eerussianguy.firmalife.config.FLConfig; | ||
import net.dries007.tfc.util.Helpers; | ||
|
||
public interface OvenLike | ||
{ | ||
static void regularBlockUpdate(Level level, BlockPos pos, BlockState state, OvenLike oven, boolean cured, int updateInterval) | ||
{ | ||
if (state.hasProperty(FLStateProperties.HAS_CHIMNEY)) | ||
{ | ||
final boolean chimney = state.getValue(FLStateProperties.HAS_CHIMNEY); | ||
final BlockPos chimneyPos = AbstractOvenBlock.locateChimney(level, pos, state); | ||
final boolean chimneyNow = chimneyPos != null; | ||
if (chimneyNow != chimney) | ||
{ | ||
level.setBlockAndUpdate(pos, state.setValue(FLStateProperties.HAS_CHIMNEY, chimneyNow)); | ||
} | ||
if (!chimneyNow && level.random.nextInt(4) == 0 && level instanceof ServerLevel server && oven.getTemperature() > 0f) | ||
{ | ||
Helpers.fireSpreaderTick(server, pos, level.random, 2); | ||
} | ||
} | ||
if (oven.getCureTicks() <= FLConfig.SERVER.ovenCureTicks.get()) oven.addCureTicks(updateInterval); | ||
if (oven.getTemperature() > (float) FLConfig.SERVER.ovenCureTemperature.get() && oven.getCureTicks() > FLConfig.SERVER.ovenCureTicks.get()) | ||
{ | ||
AbstractOvenBlock.cureAllAround(level, pos, !cured); | ||
} | ||
} | ||
|
||
float getTemperature(); | ||
|
||
int getCureTicks(); | ||
|
||
void addCureTicks(int ticks); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters