feat: enderrift tweaks

This commit is contained in:
Timo Ley 2023-12-05 19:46:03 +01:00
parent 401cc8d2df
commit baf1172ce9
7 changed files with 188 additions and 12 deletions

View file

@ -7,17 +7,21 @@ import net.anvilcraft.anvillib.cosmetics.CosmeticsManager;
import net.anvilcraft.anvillib.event.Bus;
import net.anvilcraft.ntx4core.cosmetics.StaticCosmeticProvider;
import net.anvilcraft.ntx4core.recipes.InputReplacements;
import net.anvilcraft.ntx4core.recipes.OrbDuplicationRecipe;
import net.anvilcraft.ntx4core.recipes.RecipeRemovals;
import net.anvilcraft.ntx4core.recipes.RecipeReplacements;
import net.anvilcraft.ntx4core.recipes.ShapedRecipes;
import net.anvilcraft.ntx4core.worldgen.Ntx4CoreFeatures;
import net.anvilcraft.ntx4core.worldgen.Ntx4CoreStructures;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.SpecialRecipeSerializer;
import net.minecraft.resource.ResourcePackProfile;
import net.minecraft.resource.ResourcePackSource;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.AddPackFindersEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
@ -38,6 +42,7 @@ public class Ntx4Core {
Ntx4CoreFeatures.STRUCTURE_FEATURES.register(bus);
Ntx4CoreStructures.CONFIGURED_STRUCTURE_FEATURES.register(bus);
bus.addListener(Ntx4Core::addPackFinders);
bus.addGenericListener(RecipeSerializer.class, this::registerRecipeSerializers);
Bus.MAIN.register(new InputReplacements());
Bus.MAIN.register(new RecipeRemovals());
@ -72,4 +77,10 @@ public class Ntx4Core {
);
}
}
public void registerRecipeSerializers(RegistryEvent.Register<RecipeSerializer<?>> event) {
event.getRegistry().registerAll(
new SpecialRecipeSerializer<>(OrbDuplicationRecipe::new).setRegistryName("orb_duplication")
);
}
}

View file

@ -0,0 +1,144 @@
package net.anvilcraft.ntx4core.recipes;
import net.minecraftforge.common.crafting.IShapedRecipe;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ObjectHolder;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.SpecialCraftingRecipe;
import net.minecraft.recipe.SpecialRecipeSerializer;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
public class OrbDuplicationRecipe extends SpecialCraftingRecipe implements IShapedRecipe<CraftingInventory>
{
@ObjectHolder("ntx4core:orb_duplication")
public static SpecialRecipeSerializer<OrbDuplicationRecipe> SERIALIZER;
private Item flux = ForgeRegistries.ITEMS.getValue(new Identifier("fluxnetworks", "flux_dust"));
private Item nitro = ForgeRegistries.ITEMS.getValue(new Identifier("powah", "crystal_nitro"));
private Item orb = ForgeRegistries.ITEMS.getValue(new Identifier("enderrift", "rift_orb"));
private DefaultedList<Ingredient> ingredients = DefaultedList.copyOf(
Ingredient.EMPTY,
Ingredient.ofItems(this.flux),
Ingredient.ofItems(this.nitro),
Ingredient.ofItems(this.flux),
Ingredient.ofItems(this.nitro),
Ingredient.ofItems(this.orb),
Ingredient.ofItems(this.nitro),
Ingredient.ofItems(this.flux),
Ingredient.ofItems(this.nitro),
Ingredient.ofItems(this.flux)
);
private ItemStack output = new ItemStack(this.orb, 2);
public OrbDuplicationRecipe(Identifier recipeId)
{
super(recipeId);
}
@Override
public DefaultedList<Ingredient> getIngredients()
{
return ingredients;
}
@Override
public boolean matches(CraftingInventory crafting, World worldIn)
{
if (crafting.size() < 9)
return false;
ItemStack stack = crafting.getStack(4);
if (stack.getCount() <= 0)
return false;
if (stack.getItem() != this.orb)
return false;
NbtCompound tag = stack.getNbt();
if (tag == null || !tag.contains("RiftId"))
return false;
if (!slotHasItem(crafting, 0, this.flux))
return false;
if (!slotHasItem(crafting, 1, this.nitro))
return false;
if (!slotHasItem(crafting, 2, this.flux))
return false;
if (!slotHasItem(crafting, 3, this.nitro))
return false;
if (!slotHasItem(crafting, 5, this.nitro))
return false;
if (!slotHasItem(crafting, 6, this.flux))
return false;
if (!slotHasItem(crafting, 7, this.nitro))
return false;
if (!slotHasItem(crafting, 8, this.flux))
return false;
return true;
}
private boolean slotHasItem(CraftingInventory crafting, int slot, Item item)
{
ItemStack stack = crafting.getStack(slot);
return stack.getItem() == item;
}
@Override
public ItemStack craft(CraftingInventory crafting)
{
ItemStack stack = crafting.getStack(4).copy();
stack.setCount(2);
return stack;
}
@Override
public boolean fits(int width, int height)
{
return (width == 3) && (height == 3);
}
@Override
public ItemStack getOutput()
{
return output;
}
@Override
public DefaultedList<ItemStack> getRemainder(CraftingInventory inv)
{
return DefaultedList.ofSize(inv.size(), ItemStack.EMPTY);
}
@Override
public RecipeSerializer<?> getSerializer()
{
return SERIALIZER;
}
@Override
public int getRecipeWidth()
{
return 3;
}
@Override
public int getRecipeHeight()
{
return 3;
}
}

View file

@ -27,6 +27,7 @@ public class RecipeRemovals implements IEventBusRegisterable {
ev.removeRecipeID(new Identifier("draconicevolution", "components/awakened_core"));
ev.removeRecipeID(new Identifier("electrodynamics", "ingotsteel_ingot_smelting"));
ev.removeRecipeID(new Identifier("beyond_earth", "steel_ingot_blasting"));
ev.removeRecipeID(new Identifier("enderrift", "rift_orb"));
}
@Override

View file

@ -136,22 +136,15 @@ public class RecipeReplacements implements IEventBusRegisterable {
new Identifier("enderrift", "rift"),
r
-> new ShapedRecipeBuilder(Ntx4Core.id("enderrift"), r.getOutput())
.pattern("PDP", "DCD", "PDP")
.pattern("DPD", "P P", "DPD")
.ingredient('P', "ae2:fluix_pearl")
.ingredient('C', "mekanism:qio_drive_array")
.ingredient('D', "fluxnetworks:flux_dust")
.build()
);
ev.mapRecipeID(
new Identifier("enderrift", "rift_orb"),
r
-> new ShapedRecipeBuilder(Ntx4Core.id("rift_orb"), r.getOutput())
.pattern("DPD", "PCP", "DPD")
.ingredient('D', "projecte:dark_matter")
.ingredient('P', Items.ENDER_EYE)
.ingredient('C', "ae2:singularity")
.build()
new Identifier("enderrift", "orb_duplication"),
r -> new OrbDuplicationRecipe(r.getId())
);
ev.mapRecipeID(

View file

@ -7,6 +7,6 @@
},
"output": {
"gas": "mekanism:antimatter",
"amount": 1
"amount": 10
}
}

View file

@ -14,7 +14,7 @@
"item": "ae2:fluix_dust"
}
],
"energy": 10000000,
"energy": 100000,
"result": {
"item": "fluxnetworks:flux_dust",
"count": 4

View file

@ -0,0 +1,27 @@
{
"type": "powah:energizing",
"ingredients": [
{
"item": "ae2:singularity"
},
{
"item": "minecraft:ender_eye"
},
{
"item": "powah:crystal_nitro"
},
{
"item": "powah:crystal_nitro"
},
{
"item": "mekanism:pellet_antimatter"
},
{
"item": "fluxnetworks:flux_dust"
}
],
"energy": 10000000,
"result": {
"item": "enderrift:rift_orb"
}
}