From e0decd0c408a420edd0dc1c78b8da20fee7eda18 Mon Sep 17 00:00:00 2001 From: cech12 Date: Wed, 4 Sep 2024 17:49:01 +0200 Subject: [PATCH] bugfix: the lower light level of the (soul) campfire was not removed when burnables were added --- .../unlitcampfire/mixin/CampfireBlockEntityMixin.java | 6 ++++-- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/de/cech12/unlitcampfire/mixin/CampfireBlockEntityMixin.java b/common/src/main/java/de/cech12/unlitcampfire/mixin/CampfireBlockEntityMixin.java index 80878fa..7123a4c 100644 --- a/common/src/main/java/de/cech12/unlitcampfire/mixin/CampfireBlockEntityMixin.java +++ b/common/src/main/java/de/cech12/unlitcampfire/mixin/CampfireBlockEntityMixin.java @@ -163,8 +163,10 @@ private static void cookTickProxy(Level level, BlockPos pos, BlockState state, C return; //fixes destroying while raining } //update "runs out" flag - if (!state.getValue(ICampfireBlockMixin.RUNS_OUT) && mixinEntity.unlitCampfire$litTime >= (mixinEntity.unlitCampfire$getMaxLitTime() - mixinEntity.unlitCampfire$getRunsOutIndicator())) { - level.setBlockAndUpdate(pos, state.setValue(ICampfireBlockMixin.RUNS_OUT, true)); + boolean runOutIndicatorReached = mixinEntity.unlitCampfire$litTime >= (mixinEntity.unlitCampfire$getMaxLitTime() - mixinEntity.unlitCampfire$getRunsOutIndicator()); + boolean isRunOutActive = state.getValue(ICampfireBlockMixin.RUNS_OUT); + if ((runOutIndicatorReached && !isRunOutActive) || (!runOutIndicatorReached && isRunOutActive)) { + level.setBlockAndUpdate(pos, state.setValue(ICampfireBlockMixin.RUNS_OUT, !isRunOutActive)); } //refresh client side once per second if burnables can be added to campfire if (mixinEntity.unlitCampfire$litTime % 20 == 1 && Services.CONFIG.canAddBurnables(mixinEntity.unlitCampfire$isSoulCampfire())) { diff --git a/gradle.properties b/gradle.properties index 5ccfd68..11d87dd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ # Project group=de.cech12.unlitcampfire -mod_version=2.5.0.2 +mod_version=2.5.1.0 mod_id=unlitcampfire mod_name=Unlit Campfire mod_author=Cech12