Fix recipe has empty result (#837)
This commit is contained in:
parent
ff387cc03e
commit
516d491734
|
@ -1,6 +1,7 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightSpecialRecipe;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
@ -24,6 +25,9 @@ public abstract class BlastingRecipeMixin extends AbstractCookingRecipe implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
|
if (this.result.isEmpty()) {
|
||||||
|
return new ArclightSpecialRecipe(this);
|
||||||
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
CraftBlastingRecipe recipe = new CraftBlastingRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
CraftBlastingRecipe recipe = new CraftBlastingRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||||
recipe.setGroup(this.group);
|
recipe.setGroup(this.group);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightSpecialRecipe;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
@ -24,6 +25,9 @@ public abstract class CampfireCookingRecipeMixin extends AbstractCookingRecipe i
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
|
if (this.result.isEmpty()) {
|
||||||
|
return new ArclightSpecialRecipe(this);
|
||||||
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
CraftCampfireRecipe recipe = new CraftCampfireRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
CraftCampfireRecipe recipe = new CraftCampfireRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||||
recipe.setGroup(this.group);
|
recipe.setGroup(this.group);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public abstract class ShapedRecipeMixin implements IRecipeBridge {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
if (this.getWidth() < 0 || this.getWidth() > 3 || this.getHeight() < 0 || this.getHeight() > 3) {
|
if (this.getWidth() < 1 || this.getWidth() > 3 || this.getHeight() < 1 || this.getHeight() > 3 || this.result.isEmpty()) {
|
||||||
return new ArclightSpecialRecipe((net.minecraft.world.item.crafting.Recipe<?>) this);
|
return new ArclightSpecialRecipe((net.minecraft.world.item.crafting.Recipe<?>) this);
|
||||||
}
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightSpecialRecipe;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.CraftingBookCategory;
|
import net.minecraft.world.item.crafting.CraftingBookCategory;
|
||||||
|
@ -22,12 +23,15 @@ public abstract class ShapelessRecipeMixin implements IRecipeBridge {
|
||||||
@Shadow @Final String group;
|
@Shadow @Final String group;
|
||||||
@Shadow @Final NonNullList<Ingredient> ingredients;
|
@Shadow @Final NonNullList<Ingredient> ingredients;
|
||||||
@Shadow public abstract CraftingBookCategory category();
|
@Shadow public abstract CraftingBookCategory category();
|
||||||
// @formatter:off
|
// @formatter:on
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
|
if (this.result.isEmpty()) {
|
||||||
|
return new ArclightSpecialRecipe((ShapelessRecipe) (Object) this);
|
||||||
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, (ShapelessRecipe)(Object) this);
|
CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, (ShapelessRecipe) (Object) this);
|
||||||
recipe.setGroup(this.group);
|
recipe.setGroup(this.group);
|
||||||
recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||||
for (Ingredient list : this.ingredients) {
|
for (Ingredient list : this.ingredients) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightSpecialRecipe;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
@ -24,6 +25,9 @@ public abstract class SmeltingRecipeMixin extends AbstractCookingRecipe implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
|
if (this.result.isEmpty()) {
|
||||||
|
return new ArclightSpecialRecipe(this);
|
||||||
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
|
|
||||||
CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightSpecialRecipe;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.Ingredient;
|
import net.minecraft.world.item.crafting.Ingredient;
|
||||||
|
@ -26,6 +27,9 @@ public class SmithingRecipeMixin implements IRecipeBridge {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
|
if (this.result.isEmpty()) {
|
||||||
|
return new ArclightSpecialRecipe((UpgradeRecipe) (Object) this);
|
||||||
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
return new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
return new CraftSmithingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
package io.izzel.arclight.common.mixin.core.world.item.crafting;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightSpecialRecipe;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
|
||||||
|
@ -24,6 +25,9 @@ public abstract class SmokingRecipeMixin extends AbstractCookingRecipe implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Recipe bridge$toBukkitRecipe() {
|
public Recipe bridge$toBukkitRecipe() {
|
||||||
|
if (this.result.isEmpty()) {
|
||||||
|
return new ArclightSpecialRecipe(this);
|
||||||
|
}
|
||||||
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||||
CraftSmokingRecipe recipe = new CraftSmokingRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
CraftSmokingRecipe recipe = new CraftSmokingRecipe(CraftNamespacedKey.fromMinecraft(this.getId()), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||||
recipe.setGroup(this.group);
|
recipe.setGroup(this.group);
|
||||||
|
|
|
@ -18,7 +18,7 @@ allprojects {
|
||||||
apiVersion = '1.5.1'
|
apiVersion = '1.5.1'
|
||||||
toolsVersion = '1.3.0'
|
toolsVersion = '1.3.0'
|
||||||
mixinVersion = '0.8.5'
|
mixinVersion = '0.8.5'
|
||||||
versionName = 'horn'
|
versionName = 'great-horn'
|
||||||
gitHash = getGitHash()
|
gitHash = getGitHash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user