mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 09:59:20 +00:00
改进视觉效果
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
items:
|
||||
default:cap:
|
||||
material: leather_helmet
|
||||
client-bound-material: leather_horse_armor
|
||||
$$<=1.21.1:
|
||||
client-bound-material: leather_horse_armor
|
||||
data:
|
||||
item-name: <!i><white><i18n:item.cap>
|
||||
unbreakable: true
|
||||
remove-components:
|
||||
- attribute_modifiers
|
||||
$$>=1.21.2:
|
||||
equippable:
|
||||
slot: head
|
||||
model:
|
||||
type: minecraft:model
|
||||
path: minecraft:item/custom/cap
|
||||
|
||||
@@ -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