正确注册特殊配方,允许发射器发射迫击炮炮弹
This commit is contained in:
parent
c049eef081
commit
c808084db6
8 changed files with 63 additions and 3 deletions
|
@ -0,0 +1,4 @@
|
||||||
|
// 1.21.1 2025-04-03T22:15:00.0218531 Recipes
|
||||||
|
9775e550332c69f1ee2ac4a09834a35db6f6a2ed data/minecraft/recipe/ammo_box_add_ammo.json
|
||||||
|
9775e550332c69f1ee2ac4a09834a35db6f6a2ed data/minecraft/recipe/ammo_box_extract_ammo.json
|
||||||
|
2e1d1bbf32801f3d355c0d3f78ebbb1122cebd4c data/minecraft/recipe/potion_mortar_shell.json
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"type": "superbwarfare:ammo_box_add_ammo",
|
||||||
|
"category": "misc"
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"type": "superbwarfare:ammo_box_extract_ammo",
|
||||||
|
"category": "misc"
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"type": "superbwarfare:potion_mortar_shell",
|
||||||
|
"category": "misc"
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ public class DataGenerators {
|
||||||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
||||||
|
|
||||||
generator.addProvider(event.includeServer(), ModLootTableProvider.create(packOutput, event.getLookupProvider()));
|
generator.addProvider(event.includeServer(), ModLootTableProvider.create(packOutput, event.getLookupProvider()));
|
||||||
// generator.addProvider(event.includeServer(), new ModRecipeProvider(packOutput));
|
generator.addProvider(event.includeServer(), new ModRecipeProvider(packOutput, event.getLookupProvider()));
|
||||||
generator.addProvider(event.includeServer(), new ModBlockStateProvider(packOutput, existingFileHelper));
|
generator.addProvider(event.includeServer(), new ModBlockStateProvider(packOutput, existingFileHelper));
|
||||||
generator.addProvider(event.includeServer(), new ModItemModelProvider(packOutput, existingFileHelper));
|
generator.addProvider(event.includeServer(), new ModItemModelProvider(packOutput, existingFileHelper));
|
||||||
ModBlockTagProvider tagProvider = generator.addProvider(event.includeServer(), new ModBlockTagProvider(packOutput, lookupProvider, existingFileHelper));
|
ModBlockTagProvider tagProvider = generator.addProvider(event.includeServer(), new ModBlockTagProvider(packOutput, lookupProvider, existingFileHelper));
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.atsuishio.superbwarfare.datagen;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.recipe.AmmoBoxAddAmmoRecipe;
|
||||||
|
import com.atsuishio.superbwarfare.recipe.AmmoBoxExtractAmmoRecipe;
|
||||||
|
import com.atsuishio.superbwarfare.recipe.PotionMortarShellRecipe;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.data.PackOutput;
|
||||||
|
import net.minecraft.data.recipes.RecipeOutput;
|
||||||
|
import net.minecraft.data.recipes.RecipeProvider;
|
||||||
|
import net.minecraft.data.recipes.SpecialRecipeBuilder;
|
||||||
|
import net.neoforged.neoforge.common.conditions.IConditionBuilder;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder {
|
||||||
|
|
||||||
|
public ModRecipeProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) {
|
||||||
|
super(output, registries);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildRecipes(@NotNull RecipeOutput recipeOutput) {
|
||||||
|
SpecialRecipeBuilder.special(PotionMortarShellRecipe::new).save(recipeOutput, "potion_mortar_shell");
|
||||||
|
SpecialRecipeBuilder.special(AmmoBoxAddAmmoRecipe::new).save(recipeOutput, "ammo_box_add_ammo");
|
||||||
|
SpecialRecipeBuilder.special(AmmoBoxExtractAmmoRecipe::new).save(recipeOutput, "ammo_box_extract_ammo");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,20 @@
|
||||||
package com.atsuishio.superbwarfare.item.common.ammo;
|
package com.atsuishio.superbwarfare.item.common.ammo;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
||||||
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.core.Position;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.projectile.Projectile;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.ProjectileItem;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class MortarShell extends Item {
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
public class MortarShell extends Item implements ProjectileItem {
|
||||||
|
|
||||||
public MortarShell() {
|
public MortarShell() {
|
||||||
super(new Properties());
|
super(new Properties());
|
||||||
|
@ -17,4 +25,12 @@ public class MortarShell extends Item {
|
||||||
shellEntity.setEffectsFromItem(stack);
|
shellEntity.setEffectsFromItem(stack);
|
||||||
return shellEntity;
|
return shellEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public @NotNull Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) {
|
||||||
|
var shell = new MortarShellEntity(ModEntities.MORTAR_SHELL.get(), pos.x(), pos.y(), pos.z(), level);
|
||||||
|
shell.setEffectsFromItem(stack);
|
||||||
|
return shell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class PotionMortarShellRecipe extends CustomRecipe {
|
||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
} else {
|
} else {
|
||||||
ItemStack res = new ItemStack(ModItems.POTION_MORTAR_SHELL.get(), 4);
|
ItemStack res = new ItemStack(ModItems.POTION_MORTAR_SHELL.get(), 4);
|
||||||
res.set(DataComponents.POTION_CONTENTS, res.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY));
|
res.set(DataComponents.POTION_CONTENTS, stack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY));
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue