mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-27 10:59:07 +00:00
改进视觉效果
This commit is contained in:
@@ -64,7 +64,7 @@ public class CustomSmithingTransformRecipe<T> extends AbstractedFixedResultRecip
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable CustomRecipeResult<T> visualResult() {
|
||||
public CustomRecipeResult<T> visualResult() {
|
||||
return this.visualResult;
|
||||
}
|
||||
|
||||
@@ -117,12 +117,26 @@ public class CustomSmithingTransformRecipe<T> extends AbstractedFixedResultRecip
|
||||
return RecipeType.SMITHING;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public T assembleVisual(RecipeInput input, ItemBuildContext context) {
|
||||
SmithingInput<T> smithingInput = ((SmithingInput<T>) input);
|
||||
Item<T> base = smithingInput.base().item();
|
||||
T result = this.visualResult().buildItemStack(context);
|
||||
return createSmithingResult(base, result);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public T assemble(RecipeInput input, ItemBuildContext context) {
|
||||
SmithingInput<T> smithingInput = ((SmithingInput<T>) input);
|
||||
Item<T> base = smithingInput.base().item();
|
||||
T result = this.result(context);
|
||||
return createSmithingResult(base, result);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T createSmithingResult(Item<T> base, T result) {
|
||||
Item<T> wrappedResult = (Item<T>) CraftEngine.instance().itemManager().wrap(result);
|
||||
Item<T> finalResult = wrappedResult;
|
||||
if (this.mergeComponents) {
|
||||
|
||||
@@ -4,10 +4,9 @@ import net.momirealms.craftengine.core.item.Item;
|
||||
import net.momirealms.craftengine.core.item.ItemBuildContext;
|
||||
import net.momirealms.craftengine.core.item.recipe.input.RecipeInput;
|
||||
import net.momirealms.craftengine.core.item.recipe.result.CustomRecipeResult;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface VisualResultRecipe<T> extends FixedResultRecipe<T> {
|
||||
@Nullable
|
||||
|
||||
CustomRecipeResult<T> visualResult();
|
||||
|
||||
default boolean hasVisualResult() {
|
||||
|
||||
Reference in New Issue
Block a user