Compiling version (some features are currently disabled and need a rewrite)
This commit is contained in:
parent
b1f4173ce4
commit
f8bcba4d3a
48 changed files with 488 additions and 506 deletions
|
@ -24,6 +24,14 @@ public class BlastFurnaceRecipe extends CookingRecipe<BlastFurnaceRecipe, Contai
|
|||
|
||||
@Override
|
||||
protected BlastingRecipe buildRecipe() {
|
||||
return new BlastingRecipe(id, group, input, new ItemStack(output, count), experience, cookingTime);
|
||||
return new BlastingRecipe(
|
||||
id,
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
experience,
|
||||
cookingTime
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.CookingBookCategory;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
@ -11,6 +12,7 @@ import net.minecraft.world.level.ItemLike;
|
|||
public abstract class CookingRecipe<T extends AbstractSimpleRecipe, C extends Container, R extends Recipe<C>> extends AbstractSimpleRecipe<T, C, R> {
|
||||
protected float experience;
|
||||
protected int cookingTime;
|
||||
protected CookingBookCategory bookCategory;
|
||||
|
||||
CookingRecipe(ResourceLocation id, RecipeType<R> type, ItemLike output) {
|
||||
this(id, type, type.toString(), output);
|
||||
|
@ -20,6 +22,7 @@ public abstract class CookingRecipe<T extends AbstractSimpleRecipe, C extends Co
|
|||
super(id, type, category, output);
|
||||
cookingTime = 1000;
|
||||
experience = 0;
|
||||
this.bookCategory = CookingBookCategory.MISC;
|
||||
}
|
||||
|
||||
public T setInput(ItemLike in) {
|
||||
|
@ -39,4 +42,9 @@ public abstract class CookingRecipe<T extends AbstractSimpleRecipe, C extends Co
|
|||
cookingTime = time;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T setCookingBookCategory(CookingBookCategory c) {
|
||||
bookCategory = c;
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
private int count;
|
||||
private int time;
|
||||
private float xp;
|
||||
protected CookingBookCategory bookCategory;
|
||||
|
||||
private FurnaceRecipe() {
|
||||
}
|
||||
|
@ -34,6 +35,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
INSTANCE.xp = 0;
|
||||
INSTANCE.exist = BCLRecipeManager.exists(output);
|
||||
INSTANCE.createAdvancement(INSTANCE.id, false);
|
||||
INSTANCE.bookCategory = CookingBookCategory.MISC;
|
||||
|
||||
return INSTANCE;
|
||||
}
|
||||
|
@ -76,6 +78,11 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FurnaceRecipe setCookingBookCategory(CookingBookCategory c) {
|
||||
bookCategory = c;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void build() {
|
||||
build(false, false, false);
|
||||
}
|
||||
|
@ -96,6 +103,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
SmeltingRecipe recipe = new SmeltingRecipe(
|
||||
new ResourceLocation(id + "_smelting"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
@ -108,6 +116,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
BlastingRecipe recipe2 = new BlastingRecipe(
|
||||
new ResourceLocation(id + "_blasting"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
@ -121,6 +130,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
CampfireCookingRecipe recipe2 = new CampfireCookingRecipe(
|
||||
new ResourceLocation(id + "_campfire"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
@ -134,6 +144,7 @@ public class FurnaceRecipe extends AbstractAdvancementRecipe {
|
|||
SmokingRecipe recipe2 = new SmokingRecipe(
|
||||
new ResourceLocation(id + "_smoker"),
|
||||
group,
|
||||
bookCategory,
|
||||
input,
|
||||
new ItemStack(output, count),
|
||||
xp,
|
||||
|
|
|
@ -31,6 +31,8 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
private int count;
|
||||
private boolean exist;
|
||||
|
||||
protected CraftingBookCategory bookCategory;
|
||||
|
||||
private GridRecipe() {
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,7 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
INSTANCE.shape = new String[]{"#"};
|
||||
INSTANCE.materialKeys.clear();
|
||||
INSTANCE.count = 1;
|
||||
INSTANCE.bookCategory = CraftingBookCategory.MISC;
|
||||
|
||||
INSTANCE.exist = output != null && BCLRecipeManager.exists(output);
|
||||
INSTANCE.createAdvancement(id, output);
|
||||
|
@ -122,6 +125,11 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
return materials;
|
||||
}
|
||||
|
||||
public GridRecipe setCraftingBookCategory(CraftingBookCategory c) {
|
||||
bookCategory = c;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public void build() {
|
||||
if (!exist) {
|
||||
|
@ -145,11 +153,12 @@ public class GridRecipe extends AbstractAdvancementRecipe {
|
|||
CraftingRecipe recipe = shaped ? new ShapedRecipe(
|
||||
id,
|
||||
group,
|
||||
bookCategory,
|
||||
width,
|
||||
height,
|
||||
materials,
|
||||
result
|
||||
) : new ShapelessRecipe(id, group, result, materials);
|
||||
) : new ShapelessRecipe(id, group, bookCategory, result, materials);
|
||||
|
||||
BCLRecipeManager.addRecipe(type, recipe);
|
||||
registerAdvancement(recipe);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue