mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Misc stuff
This commit is contained in:
parent
f3c30d547d
commit
8c1da19930
7 changed files with 40 additions and 66 deletions
|
@ -25,6 +25,7 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.Ingredient;
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -41,6 +42,7 @@ public final class ActuallyAdditionsAPI {
|
||||||
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
|
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
|
||||||
// public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
|
// public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
|
||||||
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
|
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
|
||||||
|
public static final List<EmpowererRecipe> EMPOWERER_RECIPES = new ArrayList<>();
|
||||||
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
||||||
|
@ -238,13 +240,8 @@ public final class ActuallyAdditionsAPI {
|
||||||
// TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
// TREASURE_CHEST_LOOT.add(new TreasureChestLoot(stack, chance, minAmount, maxAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
public static void addEmpowererRecipe(ResourceLocation id, Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, int particleColor) {
|
||||||
public static void addEmpowererRecipe(ItemStack input, ItemStack output, ItemStack modifier1, ItemStack modifier2, ItemStack modifier3, ItemStack modifier4, int energyPerStand, int time, float[] particleColor) {
|
EMPOWERER_RECIPES.add(new EmpowererRecipe(id, output, input, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
||||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addEmpowererRecipe(Ingredient input, ItemStack output, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3, Ingredient modifier4, int energyPerStand, int time, float[] particleColor) {
|
|
||||||
EMPOWERER_RECIPES.add(new EmpowererRecipe(input, output, modifier1, modifier2, modifier3, modifier4, energyPerStand, time, particleColor));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class ActuallyAdditionsData {
|
||||||
generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper));
|
generator.addProvider(new ItemTagsGenerator(generator, generatorBlockTags, helper));
|
||||||
|
|
||||||
generator.addProvider(new LaserRecipeGenerator(generator));
|
generator.addProvider(new LaserRecipeGenerator(generator));
|
||||||
generator.addProvider(new MiscRecipeGenerator(generator));
|
generator.addProvider(new EmpoweringRecipeGenerator(generator));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,8 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class MiscRecipeGenerator extends RecipeProvider {
|
public class EmpoweringRecipeGenerator extends RecipeProvider {
|
||||||
public MiscRecipeGenerator(DataGenerator p_i48262_1_) {
|
public EmpoweringRecipeGenerator(DataGenerator p_i48262_1_) {
|
||||||
super(p_i48262_1_);
|
super(p_i48262_1_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,14 @@ import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
|
import de.ellpeck.actuallyadditions.mod.recipe.HairyBallHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
|
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
@ -91,6 +92,7 @@ public class ActuallyAdditions {
|
||||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
||||||
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
MinecraftForge.EVENT_BUS.register(new CommonEvents());
|
||||||
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
MinecraftForge.EVENT_BUS.register(new DungeonLoot());
|
||||||
|
MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
|
||||||
|
|
||||||
eventBus.addListener(this::setup);
|
eventBus.addListener(this::setup);
|
||||||
eventBus.addListener(this::clientSetup);
|
eventBus.addListener(this::clientSetup);
|
||||||
|
@ -116,11 +118,14 @@ public class ActuallyAdditions {
|
||||||
CrusherCrafting.init();
|
CrusherCrafting.init();
|
||||||
HairyBallHandler.init();
|
HairyBallHandler.init();
|
||||||
LensRecipeHandler.init();
|
LensRecipeHandler.init();
|
||||||
EmpowererHandler.init();
|
|
||||||
LensMining.init();
|
LensMining.init();
|
||||||
InitBooklet.init();
|
InitBooklet.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void reloadEvent(AddReloadListenerEvent event){
|
||||||
|
event.addListener(new ResourceReloader(event.getDataPackRegistries()));
|
||||||
|
}
|
||||||
|
|
||||||
private void clientSetup(FMLClientSetupEvent event) {
|
private void clientSetup(FMLClientSetupEvent event) {
|
||||||
ActuallyAdditionsClient.setup();
|
ActuallyAdditionsClient.setup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import de.ellpeck.actuallyadditions.mod.items.ItemWingsOfTheBats;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensDisenchanting;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.EmpowererHandler;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("EmpowererHandler.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2017 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.recipe;
|
|
||||||
|
|
||||||
// TODO: [port] ADD BACK
|
|
||||||
public final class EmpowererHandler {
|
|
||||||
//
|
|
||||||
// public static final ArrayList<EmpowererRecipe> MAIN_PAGE_RECIPES = new ArrayList<>();
|
|
||||||
// public static EmpowererRecipe recipeEmpoweredCanolaSeed;
|
|
||||||
//
|
|
||||||
public static void init() {
|
|
||||||
// addCrystalEmpowering(TheCrystals.REDSTONE, "dyeRed", Ingredient.fromItems(Items.NETHERBRICK), Ingredient.fromItems(Items.REDSTONE), Ingredient.fromItems(Items.BRICK));
|
|
||||||
// addCrystalEmpowering(TheCrystals.LAPIS, "dyeCyan", Ingredient.fromItems(Items.PRISMARINE_SHARD), Ingredient.fromItems(Items.PRISMARINE_SHARD), Ingredient.fromItems(Items.PRISMARINE_SHARD));
|
|
||||||
// addCrystalEmpowering(TheCrystals.DIAMOND, "dyeLightBlue", Ingredient.fromItems(Items.CLAY_BALL), Ingredient.fromItems(Items.CLAY_BALL), fromBlock(Blocks.CLAY));
|
|
||||||
// addCrystalEmpowering(TheCrystals.IRON, "dyeGray", Ingredient.fromItems(Items.SNOWBALL), fromBlock(Blocks.STONE_BUTTON), fromBlock(Blocks.COBBLESTONE));
|
|
||||||
//
|
|
||||||
// addCrystalEmpowering(TheCrystals.COAL, "dyeBlack", igd(new ItemStack(Items.COAL, 1, 1)), Ingredient.fromItems(Items.FLINT), fromBlock(Blocks.STONE));
|
|
||||||
//
|
|
||||||
// List<ItemStack> balls = OreDictionary.getOres("slimeball");
|
|
||||||
// for (ItemStack ball : balls) {
|
|
||||||
// addCrystalEmpowering(TheCrystals.EMERALD, "dyeLime", igd(new ItemStack(Blocks.TALLGRASS, 1, 1)), igd(new ItemStack(Blocks.SAPLING)), igd(ball.copy()));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Ingredient seed = Ingredient.fromItems(InitItems.itemCanolaSeed);
|
|
||||||
// ActuallyAdditionsAPI.addEmpowererRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CRYSTALLIZED_CANOLA_SEED.ordinal())), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.EMPOWERED_CANOLA_SEED.ordinal()), seed, seed, seed, seed, 1000, 30, new float[]{1F, 91F / 255F, 76F / 255F});
|
|
||||||
// recipeEmpoweredCanolaSeed = RecipeUtil.lastEmpowererRecipe();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// private static void addCrystalEmpowering(TheCrystals type, String dye, Ingredient modifier1, Ingredient modifier2, Ingredient modifier3) {
|
|
||||||
// float[] color = type.conversionColorParticles;
|
|
||||||
//
|
|
||||||
// ActuallyAdditionsAPI.addEmpowererRecipe(Ingredient.fromStacks(new ItemStack(InitItems.itemCrystal, 1, type.ordinal())), new ItemStack(InitItems.itemCrystalEmpowered, 1, type.ordinal()), new OreIngredient(dye), modifier1, modifier2, modifier3, 5000, 50, color);
|
|
||||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe());
|
|
||||||
// ActuallyAdditionsAPI.addEmpowererRecipe(Ingredient.fromStacks(new ItemStack(InitBlocks.blockCrystal, 1, type.ordinal())), new ItemStack(InitBlocks.blockCrystalEmpowered, 1, type.ordinal()), new OreIngredient(dye), modifier1, modifier2, modifier3, 50000, 500, color);
|
|
||||||
// MAIN_PAGE_RECIPES.add(RecipeUtil.lastEmpowererRecipe());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static Ingredient igd(ItemStack s) {
|
|
||||||
// return Ingredient.fromStacks(s);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static Ingredient fromBlock(Block b) {
|
|
||||||
// return Ingredient.fromItems(Item.getItemFromBlock(b));
|
|
||||||
// }
|
|
||||||
}
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
||||||
|
import net.minecraft.item.crafting.RecipeManager;
|
||||||
|
import net.minecraft.resources.DataPackRegistries;
|
||||||
|
import net.minecraft.resources.IResourceManager;
|
||||||
|
import net.minecraftforge.resource.IResourceType;
|
||||||
|
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
|
||||||
|
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
public class ResourceReloader implements ISelectiveResourceReloadListener {
|
||||||
|
private final DataPackRegistries data;
|
||||||
|
public ResourceReloader(DataPackRegistries dataPackRegistries) {
|
||||||
|
data = dataPackRegistries;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate) {
|
||||||
|
RecipeManager recipeManager = data.getRecipeManager();
|
||||||
|
ActuallyAdditionsAPI.EMPOWERER_RECIPES.clear();
|
||||||
|
ActuallyAdditionsAPI.EMPOWERER_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue