Skip to content

Commit c43b5df

Browse files
fix: tiny bit of cleanup
1 parent 093ac22 commit c43b5df

5 files changed

Lines changed: 22 additions & 74 deletions

File tree

src/client/java/com/tcm/MineTale/MineTaleClient.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
package com.tcm.MineTale;
22

33
import com.tcm.MineTale.block.workbenches.screen.FurnaceWorkbenchScreen;
4-
5-
import java.util.List;
6-
74
import com.tcm.MineTale.block.workbenches.screen.CampfireWorkbenchScreen;
85
import com.tcm.MineTale.registry.ModMenuTypes;
9-
import com.tcm.MineTale.registry.ModRecipeDisplay;
10-
import com.tcm.MineTale.registry.ModRecipes;
116

127
import net.fabricmc.api.ClientModInitializer;
138
import net.minecraft.client.gui.screens.MenuScreens;
14-
import net.minecraft.world.item.crafting.RecipeBookCategories;
159

1610
public class MineTaleClient implements ClientModInitializer {
1711

src/client/java/com/tcm/MineTale/datagen/builders/WorkbenchRecipeBuilder.java

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
import org.jspecify.annotations.Nullable;
99

10-
import com.mojang.serialization.Codec;
11-
import com.mojang.serialization.MapCodec;
12-
import com.mojang.serialization.codecs.RecordCodecBuilder;
1310
import com.tcm.MineTale.recipe.WorkbenchRecipe;
1411
import com.tcm.MineTale.registry.ModRecipeDisplay;
1512

@@ -46,28 +43,28 @@ public class WorkbenchRecipeBuilder implements RecipeBuilder {
4643
private int cookTime = 200;
4744
@Nullable private String group;
4845

49-
/**
50-
* Creates a MapCodec that serializes and deserializes WorkbenchRecipe instances bound to the given recipe type and serializer.
51-
*
52-
* The codec encodes the recipe's ingredients, results, and cookTime (default 200) and constructs a WorkbenchRecipe using the provided type and serializer.
53-
*
54-
* @param type the RecipeType associated with the encoded WorkbenchRecipe
55-
* @param serializer the RecipeSerializer used to (de)serialize the WorkbenchRecipe
56-
* @return a MapCodec for WorkbenchRecipe that reads/writes ingredients, results, and cookTime and produces WorkbenchRecipe instances tied to the given type and serializer
57-
*/
58-
public static final MapCodec<WorkbenchRecipe> CODEC(RecipeType<WorkbenchRecipe> type, RecipeSerializer<WorkbenchRecipe> serializer) {
59-
return RecordCodecBuilder.mapCodec(inst -> inst.group(
60-
Ingredient.CODEC.listOf().fieldOf("ingredients").forGetter(WorkbenchRecipe::ingredients),
61-
ItemStack.STRICT_CODEC.listOf().fieldOf("results").forGetter(WorkbenchRecipe::results),
62-
Codec.INT.optionalFieldOf("cookTime", 200).forGetter(WorkbenchRecipe::cookTime),
63-
// Updated to CraftingBookCategory codec
64-
CraftingBookCategory.CODEC.optionalFieldOf("category", CraftingBookCategory.MISC).forGetter(WorkbenchRecipe::category),
65-
Identifier.CODEC.fieldOf("book_category").forGetter(WorkbenchRecipe::bookCategory)
66-
).apply(inst, (ingredients, results, cookTime, category, bookCategory) ->
67-
// 2. Pass the new bookCategory into the constructor
68-
new WorkbenchRecipe(ingredients, results, cookTime, type, serializer, category, bookCategory)
69-
));
70-
}
46+
// /**
47+
// * Creates a MapCodec that serializes and deserializes WorkbenchRecipe instances bound to the given recipe type and serializer.
48+
// *
49+
// * The codec encodes the recipe's ingredients, results, and cookTime (default 200) and constructs a WorkbenchRecipe using the provided type and serializer.
50+
// *
51+
// * @param type the RecipeType associated with the encoded WorkbenchRecipe
52+
// * @param serializer the RecipeSerializer used to (de)serialize the WorkbenchRecipe
53+
// * @return a MapCodec for WorkbenchRecipe that reads/writes ingredients, results, and cookTime and produces WorkbenchRecipe instances tied to the given type and serializer
54+
// */
55+
// public static final MapCodec<WorkbenchRecipe> CODEC(RecipeType<WorkbenchRecipe> type, RecipeSerializer<WorkbenchRecipe> serializer) {
56+
// return RecordCodecBuilder.mapCodec(inst -> inst.group(
57+
// Ingredient.CODEC.listOf().fieldOf("ingredients").forGetter(WorkbenchRecipe::ingredients),
58+
// ItemStack.STRICT_CODEC.listOf().fieldOf("results").forGetter(WorkbenchRecipe::results),
59+
// Codec.INT.optionalFieldOf("cookTime", 200).forGetter(WorkbenchRecipe::cookTime),
60+
// // Updated to CraftingBookCategory codec
61+
// CraftingBookCategory.CODEC.optionalFieldOf("category", CraftingBookCategory.MISC).forGetter(WorkbenchRecipe::category),
62+
// Identifier.CODEC.fieldOf("book_category").forGetter(WorkbenchRecipe::bookCategory)
63+
// ).apply(inst, (ingredients, results, cookTime, category, bookCategory) ->
64+
// // 2. Pass the new bookCategory into the constructor
65+
// new WorkbenchRecipe(ingredients, results, cookTime, type, serializer, category, bookCategory)
66+
// ));
67+
// }
7168

7269
/**
7370
* Create a new WorkbenchRecipeBuilder configured for a specific recipe type and its serializer.

src/main/java/com/tcm/MineTale/block/workbenches/CampfireWorkbench.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,4 @@ public RenderShape getRenderShape(BlockState state) {
9595
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
9696
return SHAPE;
9797
}
98-
99-
/**
100-
* Create a block entity for the master block of this workbench.
101-
*
102-
* Only the master block of the multi-block workbench receives an entity; other positions return {@code null}.
103-
*
104-
* @return the block entity for the master block ({@link CampfireWorkbenchEntity}), or {@code null} if this position does not host an entity
105-
*/
106-
@Nullable
107-
@Override
108-
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
109-
// AbstractWorkbench logic ensures only the Master block gets the entity.
110-
// We override it here to point specifically to our Campfire entity.
111-
return super.newBlockEntity(pos, state);
112-
}
11398
}

src/main/java/com/tcm/MineTale/block/workbenches/FurnaceWorkbench.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,4 @@ public RenderShape getRenderShape(BlockState state) {
8686
// Essential so that the 2x2 model is visible
8787
return RenderShape.MODEL;
8888
}
89-
90-
/**
91-
* Create a block entity for the master block of this workbench.
92-
*
93-
* Only the master block of the multi-block workbench receives an entity; other positions return {@code null}.
94-
*
95-
* @return the block entity for the master block ({@link FurnaceWorkbenchEntity}), or {@code null} if this position does not host an entity
96-
*/
97-
@Nullable
98-
@Override
99-
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
100-
// AbstractWorkbench logic ensures only the Master block gets the entity.
101-
// We override it here to point specifically to our Furnace entity.
102-
return super.newBlockEntity(pos, state);
103-
}
10489
}

src/main/java/com/tcm/MineTale/registry/ModRecipeDisplay.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@ public static void initialize() {
3838
Identifier.fromNamespaceAndPath(MineTale.MOD_ID, "workbench_recipe_display"),
3939
WORKBENCH_TYPE
4040
);
41-
42-
// // Register the Category
43-
// Registry.register(
44-
// BuiltInRegistries.RECIPE_BOOK_CATEGORY,
45-
// Identifier.fromNamespaceAndPath(MineTale.MOD_ID, "campfire_recipe_book_category"),
46-
// CAMPFIRE_SEARCH
47-
// );
48-
49-
// Registry.register(
50-
// BuiltInRegistries.RECIPE_BOOK_CATEGORY,
51-
// Identifier.fromNamespaceAndPath(MineTale.MOD_ID, "furnace_t1_recipe_book_category"),
52-
// FURNACE_T1_SEARCH
53-
// );
5441
}
5542

5643
private static RecipeBookCategory registerCategory(String name) {

0 commit comments

Comments
 (0)