Skip to content

Commit 238bce3

Browse files
committed
Add Chef Hat for Blaze Burner
Add cooking boost for Skillet
1 parent 36c3d26 commit 238bce3

16 files changed

Lines changed: 402 additions & 40 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ see the **Features** section below.
1414
+ Mechanical Arm insertion for Cooking Pot is for container slot only,
1515
as the ingredient slots is properly handled by Packager unpacking.
1616
- Add Heat Source support for all Boiler Heaters.
17-
- Active Boiler Heaters now speeds up Cooking Pot's cooking.
17+
- Active Boiler Heaters now speeds up Cooking Pot and Skillet cooking.
1818
- Automatically transform Cutting Board recipes (Farmer's Delight) that uses knife into Sawing recipes.
1919
- Automatically transform Cutting Board recipes (Farmer's Delight) into Deploying recipes.
2020
- Automatically transform Keg Pouring recipes (Brewin' and Chewin') into Filling and Draining recipes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (C) 2025 DragonsPlus
3+
* SPDX-License-Identifier: LGPL-3.0-or-later
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package plus.dragons.createcentralkitchen.client;
20+
21+
import net.neoforged.api.distmarker.Dist;
22+
import net.neoforged.bus.api.IEventBus;
23+
import net.neoforged.bus.api.SubscribeEvent;
24+
import net.neoforged.fml.ModContainer;
25+
import net.neoforged.fml.common.Mod;
26+
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
27+
import plus.dragons.createcentralkitchen.client.model.CCKPartialModels;
28+
import plus.dragons.createcentralkitchen.common.CCKCommon;
29+
import plus.dragons.createcentralkitchen.integration.ModIntegration;
30+
31+
@Mod(value = CCKCommon.ID, dist = Dist.CLIENT)
32+
public class CCKClient {
33+
public CCKClient(IEventBus modBus, ModContainer modContainer) {
34+
CCKPartialModels.register();
35+
modBus.register(this);
36+
}
37+
38+
@SubscribeEvent
39+
public void onClientSetup(final FMLClientSetupEvent event) {
40+
for (ModIntegration integration : ModIntegration.values()) {
41+
if (integration.enabled())
42+
event.enqueueWork(integration::onClientSetup);
43+
}
44+
}
45+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (C) 2025 DragonsPlus
3+
* SPDX-License-Identifier: LGPL-3.0-or-later
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package plus.dragons.createcentralkitchen.client.model;
20+
21+
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
22+
import plus.dragons.createcentralkitchen.common.CCKCommon;
23+
24+
public class CCKPartialModels {
25+
public static final PartialModel CHEF_HAT = block("blaze_burner/chef_hat");
26+
public static final PartialModel CHEF_HAT_SMALL = block("blaze_burner/chef_hat_small");
27+
28+
public static void register() {}
29+
30+
private static PartialModel block(String path) {
31+
return PartialModel.of(CCKCommon.asResource("block/" + path));
32+
}
33+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@FieldsAreNonnullByDefault
2+
@MethodsReturnNonnullByDefault
3+
@ParametersAreNonnullByDefault
4+
package plus.dragons.createcentralkitchen.client;
5+
6+
import javax.annotation.ParametersAreNonnullByDefault;
7+
import net.minecraft.FieldsAreNonnullByDefault;
8+
import net.minecraft.MethodsReturnNonnullByDefault;

src/main/java/plus/dragons/createcentralkitchen/common/CCKCommon.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import net.neoforged.bus.api.SubscribeEvent;
2626
import net.neoforged.fml.ModContainer;
2727
import net.neoforged.fml.common.Mod;
28-
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
2928
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
3029
import net.neoforged.fml.event.lifecycle.FMLConstructModEvent;
3130
import org.slf4j.Logger;
@@ -66,14 +65,6 @@ public void onCommonSetup(final FMLCommonSetupEvent event) {
6665
}
6766
}
6867

69-
@SubscribeEvent
70-
public void onClientSetup(final FMLClientSetupEvent event) {
71-
for (ModIntegration integration : ModIntegration.values()) {
72-
if (integration.enabled())
73-
event.enqueueWork(integration::onClientSetup);
74-
}
75-
}
76-
7768
public static ResourceLocation asResource(String path) {
7869
return ResourceLocation.fromNamespaceAndPath(ID, path);
7970
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (C) 2025 DragonsPlus
3+
* SPDX-License-Identifier: LGPL-3.0-or-later
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package plus.dragons.createcentralkitchen.integration.farmersdelight.burner;
20+
21+
public interface ChefBlazeBurnerBlockEntity {
22+
boolean isChef();
23+
}

src/main/java/plus/dragons/createcentralkitchen/mixin/farmersdelight/CookingPotBlockEntityMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@Mixin(CookingPotBlockEntity.class)
3535
public class CookingPotBlockEntityMixin {
3636
@ModifyExpressionValue(method = "processCooking", at = @At(value = "FIELD", target = "Lvectorwing/farmersdelight/common/block/entity/CookingPotBlockEntity;cookTime:I", ordinal = 0))
37-
private int addBoilerHeaterBonus(int cookTime, RecipeHolder<CookingPotRecipe> recipe, CookingPotBlockEntity cookingPot) {
37+
private int speedUpCooking(int cookTime, RecipeHolder<CookingPotRecipe> recipe, CookingPotBlockEntity cookingPot) {
3838
var level = cookingPot.getLevel();
3939
assert level != null;
4040
var pos = cookingPot.getBlockPos();

src/main/java/plus/dragons/createcentralkitchen/mixin/farmersdelight/SkilletBlockEntityMixin.java

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package plus.dragons.createcentralkitchen.mixin.farmersdelight;
2020

21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import com.simibubi.create.api.boiler.BoilerHeater;
2123
import java.util.Optional;
2224
import me.fallenbreath.conditionalmixin.api.annotation.Condition;
2325
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
@@ -26,53 +28,52 @@
2628
import net.minecraft.world.item.ItemStack;
2729
import net.minecraft.world.item.crafting.CampfireCookingRecipe;
2830
import net.minecraft.world.item.crafting.RecipeHolder;
31+
import net.minecraft.world.level.Level;
2932
import net.minecraft.world.level.block.entity.BlockEntityType;
3033
import net.minecraft.world.level.block.state.BlockState;
3134
import net.neoforged.neoforge.items.ItemStackHandler;
3235
import org.spongepowered.asm.mixin.Final;
3336
import org.spongepowered.asm.mixin.Mixin;
3437
import org.spongepowered.asm.mixin.Shadow;
38+
import org.spongepowered.asm.mixin.injection.At;
3539
import plus.dragons.createcentralkitchen.integration.ModIntegration;
3640
import plus.dragons.createcentralkitchen.integration.farmersdelight.mechanicalArm.SkilletArmInteractionPoint;
3741
import vectorwing.farmersdelight.common.block.SkilletBlock;
3842
import vectorwing.farmersdelight.common.block.entity.HeatableBlockEntity;
3943
import vectorwing.farmersdelight.common.block.entity.SkilletBlockEntity;
4044
import vectorwing.farmersdelight.common.block.entity.SyncedBlockEntity;
4145
import vectorwing.farmersdelight.common.registry.ModSounds;
46+
import vectorwing.farmersdelight.common.tag.ModTags;
4247

4348
@Restriction(require = @Condition(ModIntegration.Constants.FARMERSDELIGHT))
4449
@Mixin(SkilletBlockEntity.class)
4550
public abstract class SkilletBlockEntityMixin extends SyncedBlockEntity implements HeatableBlockEntity, SkilletArmInteractionPoint.Interaction {
46-
public SkilletBlockEntityMixin(BlockEntityType<?> tileEntityTypeIn, BlockPos pos, BlockState state) {
47-
super(tileEntityTypeIn, pos, state);
48-
}
49-
50-
@Shadow
51-
protected abstract Optional<RecipeHolder<CampfireCookingRecipe>> getMatchingRecipe(ItemStack stack);
52-
53-
@Shadow
54-
public abstract ItemStack getStoredStack();
55-
5651
@Shadow
5752
@Final
5853
private ItemStackHandler inventory;
59-
6054
@Shadow
6155
private int cookingTime;
62-
6356
@Shadow
6457
private int cookingTimeTotal;
65-
6658
@Shadow
6759
private int fireAspectLevel;
6860

61+
private SkilletBlockEntityMixin(BlockEntityType<?> tileEntityTypeIn, BlockPos pos, BlockState state) {
62+
super(tileEntityTypeIn, pos, state);
63+
}
64+
65+
@Shadow
66+
protected abstract Optional<RecipeHolder<CampfireCookingRecipe>> getMatchingRecipe(ItemStack stack);
67+
68+
@Shadow
69+
public abstract ItemStack getStoredStack();
70+
6971
@Override
7072
public ItemStack addItemToCook(ItemStack stack, boolean simulate) {
7173
Optional<RecipeHolder<CampfireCookingRecipe>> recipe = this.getMatchingRecipe(stack);
7274
if (recipe.isPresent() && this.getStoredStack().isEmpty()) {
7375
if (this.getBlockState().getValue(SkilletBlock.WATERLOGGED))
7476
return stack;
75-
7677
boolean wasEmpty = this.getStoredStack().isEmpty();
7778
ItemStack remainder = this.inventory.insertItem(0, stack.copy(), simulate);
7879
if (!simulate && !ItemStack.matches(remainder, stack)) {
@@ -86,4 +87,23 @@ public ItemStack addItemToCook(ItemStack stack, boolean simulate) {
8687
}
8788
return stack;
8889
}
90+
91+
@ModifyExpressionValue(method = "cookAndOutputItems", at = @At(value = "FIELD", target = "Lvectorwing/farmersdelight/common/block/entity/SkilletBlockEntity;cookingTime:I", ordinal = 0))
92+
private int speedUpCooking(int cookTime, ItemStack cookingStack, Level level) {
93+
var pos = this.getBlockPos();
94+
var heaterPos = pos.below();
95+
var heaterState = level.getBlockState(heaterPos);
96+
BoilerHeater heater = BoilerHeater.REGISTRY.get(heaterState);
97+
if (heater == null && !this.requiresDirectHeat() && heaterState.is(ModTags.HEAT_CONDUCTORS)) {
98+
heaterPos = pos.below(2);
99+
heaterState = level.getBlockState(pos.below(2));
100+
heater = BoilerHeater.REGISTRY.get(heaterState);
101+
}
102+
if (heater != null) {
103+
float heat = heater.getHeat(level, heaterPos, heaterState);
104+
if (heat > 0)
105+
cookTime = cookTime + (int) heat;
106+
}
107+
return cookTime;
108+
}
89109
}

src/main/java/plus/dragons/createcentralkitchen/mixin/farmersdelight/BlazeBurnerBlockEntityMixin.java renamed to src/main/java/plus/dragons/createcentralkitchen/mixin/farmersdelight/client/BlazeBurnerBlockEntityMixin.java

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
package plus.dragons.createcentralkitchen.mixin.farmersdelight;
19+
package plus.dragons.createcentralkitchen.mixin.farmersdelight.client;
2020

21-
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
22-
import com.llamalad7.mixinextras.sugar.Local;
21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
2322
import com.simibubi.create.content.processing.burner.BlazeBurnerBlockEntity;
2423
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
2524
import me.fallenbreath.conditionalmixin.api.annotation.Condition;
@@ -28,27 +27,43 @@
2827
import net.minecraft.world.level.block.entity.BlockEntityType;
2928
import net.minecraft.world.level.block.state.BlockState;
3029
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.Unique;
3131
import org.spongepowered.asm.mixin.injection.At;
32+
import org.spongepowered.asm.mixin.injection.Inject;
33+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
3234
import plus.dragons.createcentralkitchen.integration.ModIntegration;
35+
import plus.dragons.createcentralkitchen.integration.farmersdelight.burner.ChefBlazeBurnerBlockEntity;
3336
import vectorwing.farmersdelight.common.block.entity.HeatableBlockEntity;
3437
import vectorwing.farmersdelight.common.tag.ModTags;
3538

3639
@Restriction(require = @Condition(ModIntegration.Constants.FARMERSDELIGHT))
3740
@Mixin(BlazeBurnerBlockEntity.class)
38-
public abstract class BlazeBurnerBlockEntityMixin extends SmartBlockEntity {
41+
public abstract class BlazeBurnerBlockEntityMixin extends SmartBlockEntity implements ChefBlazeBurnerBlockEntity {
42+
@Unique
43+
private boolean chef;
44+
3945
private BlazeBurnerBlockEntityMixin(BlockEntityType<?> type, BlockPos pos, BlockState state) {
4046
super(type, pos, state);
4147
}
4248

43-
@ModifyReturnValue(method = "isValidBlockAbove", at = @At("TAIL"))
44-
private boolean isHeatableBlockEntityAbove(boolean original, @Local BlockState aboveState) {
45-
if (original)
46-
return true;
49+
@Override
50+
public boolean isChef() {
51+
return chef;
52+
}
53+
54+
@Inject(method = "tickAnimation", at = @At("HEAD"))
55+
private void checkBlazeChef(CallbackInfo ci) {
4756
assert level != null;
4857
if (level.getBlockEntity(worldPosition.above()) instanceof HeatableBlockEntity)
49-
return true;
50-
if (aboveState.is(ModTags.HEAT_CONDUCTORS))
51-
return level.getBlockEntity(worldPosition.above(2)) instanceof HeatableBlockEntity;
52-
return false;
58+
chef = true;
59+
else if (level.getBlockState(worldPosition.above()).is(ModTags.HEAT_CONDUCTORS) &&
60+
level.getBlockEntity(worldPosition.above(2)) instanceof HeatableBlockEntity)
61+
chef = true;
62+
else chef = false;
63+
}
64+
65+
@ModifyExpressionValue(method = "tickAnimation", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/processing/burner/BlazeBurnerBlockEntity;isValidBlockAbove()Z"))
66+
private boolean isHeatableBlockEntityAbove(boolean original) {
67+
return original || chef;
5368
}
5469
}

0 commit comments

Comments
 (0)