generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
119 additions
and
87 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
src/generated/resources/data/nmt/recipe/obsidian_tipped_arrow.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"type": "nmt:crafting_special_obsidiantippedarrow", | ||
"category": "misc" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
src/main/java/net/nova/nmt/client/renderer/entity/ObsidianTippableArrowRenderer.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/java/net/nova/nmt/entity/projectile/ObsidianTippedArrow.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package net.nova.nmt.init; | ||
|
||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.world.item.crafting.RecipeSerializer; | ||
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; | ||
import net.minecraft.world.item.crafting.TippedArrowRecipe; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
import net.nova.nmt.recipe.ObsidianTippedArrowRecipe; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import static net.nova.nmt.NoMoreThings.MODID; | ||
|
||
public class NMTRecipeSerializers { | ||
public static final DeferredRegister<RecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(Registries.RECIPE_SERIALIZER, MODID); | ||
|
||
public static final Supplier<RecipeSerializer<ObsidianTippedArrowRecipe>> OBSIDIAN_TIPPED_ARROW = RECIPE_SERIALIZERS.register("crafting_special_obsidiantippedarrow", () -> new SimpleCraftingRecipeSerializer<>(ObsidianTippedArrowRecipe::new)); | ||
} |
39 changes: 0 additions & 39 deletions
39
src/main/java/net/nova/nmt/item/ObsidianTippedArrowItem.java
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
src/main/java/net/nova/nmt/recipe/ObsidianTippedArrowRecipe.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package net.nova.nmt.recipe; | ||
|
||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.component.DataComponents; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.crafting.CraftingBookCategory; | ||
import net.minecraft.world.item.crafting.CraftingInput; | ||
import net.minecraft.world.item.crafting.CustomRecipe; | ||
import net.minecraft.world.item.crafting.RecipeSerializer; | ||
import net.minecraft.world.level.Level; | ||
import net.nova.nmt.init.NMTItems; | ||
import net.nova.nmt.init.NMTRecipeSerializers; | ||
|
||
public class ObsidianTippedArrowRecipe extends CustomRecipe { | ||
public ObsidianTippedArrowRecipe(CraftingBookCategory category) { | ||
super(category); | ||
} | ||
|
||
public boolean matches(CraftingInput input, Level level) { | ||
if (input.width() == 3 && input.height() == 3) { | ||
for (int i = 0; i < input.height(); i++) { | ||
for (int j = 0; j < input.width(); j++) { | ||
ItemStack itemstack = input.getItem(j, i); | ||
if (itemstack.isEmpty()) { | ||
return false; | ||
} | ||
|
||
if (j == 1 && i == 1) { | ||
if (!itemstack.is(NMTItems.LINGERING_OBSIDIAN_POTION)) { | ||
return false; | ||
} | ||
} else if (!itemstack.is(Items.ARROW)) { | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
public ItemStack assemble(CraftingInput input, HolderLookup.Provider registries) { | ||
ItemStack itemstack = input.getItem(1, 1); | ||
if (!itemstack.is(NMTItems.LINGERING_OBSIDIAN_POTION)) { | ||
return ItemStack.EMPTY; | ||
} else { | ||
ItemStack itemstack1 = new ItemStack(NMTItems.OBSIDIAN_TIPPED_ARROW.get(), 8); | ||
itemstack1.set(DataComponents.POTION_CONTENTS, itemstack.get(DataComponents.POTION_CONTENTS)); | ||
return itemstack1; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean canCraftInDimensions(int width, int height) { | ||
return width >= 3 && height >= 3; | ||
} | ||
|
||
@Override | ||
public RecipeSerializer<?> getSerializer() { | ||
return NMTRecipeSerializers.OBSIDIAN_TIPPED_ARROW.get(); | ||
} | ||
} |