mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Derp derp
This commit is contained in:
parent
cd37abb4ca
commit
08112ea11c
6 changed files with 11 additions and 69 deletions
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.items.base;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemSeeds;
|
import net.minecraft.item.ItemSeeds;
|
||||||
|
|
|
@ -13,15 +13,11 @@ package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.BannerPattern;
|
|
||||||
import net.minecraftforge.common.util.EnumHelper;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public final class BannerHelper {
|
public final class BannerHelper {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
addCraftingPattern("drill", new ItemStack(ActuallyItems.DRILL.get(), 1, 3));
|
addCraftingPattern("drill", new ItemStack(ActuallyItems.DRILL.get()));
|
||||||
addCraftingPattern("leaf_blo", new ItemStack(ActuallyItems.LEAF_BLOWER.get()));
|
addCraftingPattern("leaf_blo", new ItemStack(ActuallyItems.LEAF_BLOWER.get()));
|
||||||
addCraftingPattern("phan_con", new ItemStack(ActuallyItems.PHANTOM_CONNECTOR.get()));
|
addCraftingPattern("phan_con", new ItemStack(ActuallyItems.PHANTOM_CONNECTOR.get()));
|
||||||
addCraftingPattern("book", new ItemStack(ActuallyItems.ITEM_BOOKLET.get()));
|
addCraftingPattern("book", new ItemStack(ActuallyItems.ITEM_BOOKLET.get()));
|
||||||
|
@ -47,7 +43,7 @@ public final class BannerHelper {
|
||||||
public static void addCraftingPattern(String name, ItemStack craftingStack) {
|
public static void addCraftingPattern(String name, ItemStack craftingStack) {
|
||||||
Class<?>[] paramTypes = {String.class, String.class, ItemStack.class};
|
Class<?>[] paramTypes = {String.class, String.class, ItemStack.class};
|
||||||
Object[] paramValues = {ActuallyAdditions.MODID + "_" + name, ActuallyAdditions.MODID + "_" + name, craftingStack};
|
Object[] paramValues = {ActuallyAdditions.MODID + "_" + name, ActuallyAdditions.MODID + "_" + name, craftingStack};
|
||||||
EnumHelper.addEnum(BannerPattern.class, (ActuallyAdditions.MODID + "_" + name).toUpperCase(Locale.ROOT), paramTypes, paramValues);
|
// EnumHelper.addEnum(BannerPattern.class, (ActuallyAdditions.MODID + "_" + name).toUpperCase(Locale.ROOT), paramTypes, paramValues); //TODO wth banners
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.item.ItemEntity;
|
import net.minecraft.entity.item.ItemEntity;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
@ -113,7 +114,7 @@ public class MethodHandler implements IMethodHandler {
|
||||||
|
|
||||||
int prevCounter = tag.putInt("Counter");
|
int prevCounter = tag.putInt("Counter");
|
||||||
CompoundNBT compound = new CompoundNBT();
|
CompoundNBT compound = new CompoundNBT();
|
||||||
compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect()));
|
//compound.putInt("ID", Potion.getIdFromPotion(effect.getEffect())); //TODO ?!
|
||||||
compound.putInt("Duration", effect.getDuration());
|
compound.putInt("Duration", effect.getDuration());
|
||||||
compound.putInt("Amplifier", effect.getAmplifier());
|
compound.putInt("Amplifier", effect.getAmplifier());
|
||||||
|
|
||||||
|
@ -178,7 +179,7 @@ public class MethodHandler implements IMethodHandler {
|
||||||
if (StackUtil.isValid(output)) {
|
if (StackUtil.isValid(output)) {
|
||||||
tile.getWorldObject().levelEvent(2001, pos, Block.getId(state));
|
tile.getWorldObject().levelEvent(2001, pos, Block.getId(state));
|
||||||
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
|
recipe.transformHook(ItemStack.EMPTY, state, pos, tile);
|
||||||
if (output.getItem() instanceof ItemBlock) {
|
if (output.getItem() instanceof BlockItem) {
|
||||||
Block toPlace = Block.byItem(output.getItem());
|
Block toPlace = Block.byItem(output.getItem());
|
||||||
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
|
BlockState state2Place = toPlace.getStateForPlacement(tile.getWorldObject(), pos, facing, 0, 0, 0, output.getMetadata(), FakePlayerFactory.getMinecraft((WorldServer) tile.getWorldObject()), Hand.MAIN_HAND);
|
||||||
tile.getWorldObject().setBlock(pos, state2Place, 2);
|
tile.getWorldObject().setBlock(pos, state2Place, 2);
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
public interface IEnergyDisplay {
|
public interface IEnergyDisplay {
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
import de.ellpeck.actuallyadditions.mod.crafting.ActuallyRecipes;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||||
|
@ -30,7 +29,6 @@ import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
|
|
||||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||||
|
|
||||||
public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
|
@ -43,23 +41,8 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
super(ActuallyBlocks.EMPOWERER.getTileEntityType(), 1);
|
super(ActuallyBlocks.EMPOWERER.getTileEntityType(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated //Use findMatchingRecipe
|
|
||||||
public static List<EmpowererRecipe> getRecipesForInput(ItemStack input) {
|
|
||||||
List<EmpowererRecipe> recipesThatWork = new ArrayList<>();
|
|
||||||
if (StackUtil.isValid(input)) {
|
|
||||||
// TODO: [port] VALIDATOR OR REMOVE
|
|
||||||
for (EmpowererRecipe recipe : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
|
||||||
if (recipe.getInput().test(input)) {
|
|
||||||
recipesThatWork.add(recipe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return recipesThatWork;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPossibleInput(ItemStack stack) {
|
public static boolean isPossibleInput(ItemStack stack) {
|
||||||
for (EmpowererRecipe r : ActuallyAdditionsAPI.EMPOWERER_RECIPES) {
|
for (EmpowererRecipe r : ServerLifecycleHooks.getCurrentServer().getRecipeManager().getAllRecipesFor(ActuallyRecipes.Types.EMPOWERING)) {
|
||||||
// TODO: [port] move to proper recipe system
|
|
||||||
if (r.getInput().test(stack)) {
|
if (r.getInput().test(stack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +69,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase {
|
||||||
if (stands != null) {
|
if (stands != null) {
|
||||||
EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack());
|
EmpowererRecipe recipe = findMatchingRecipe(this.inv.getStackInSlot(0), stands[0].getStack(), stands[1].getStack(), stands[2].getStack(), stands[3].getStack());
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe);
|
//this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe); //TODO whats this?
|
||||||
|
|
||||||
boolean hasPower = true;
|
boolean hasPower = true;
|
||||||
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("RecipeUtil.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.util;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.LensConversionRecipe;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.crafting.RecipeHandler;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
|
|
||||||
public final class RecipeUtil {
|
|
||||||
|
|
||||||
public static LensConversionRecipe lastReconstructorRecipe() {
|
|
||||||
List<LensConversionRecipe> list = ActuallyAdditionsAPI.RECONSTRUCTOR_LENS_CONVERSION_RECIPES;
|
|
||||||
return list.get(list.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CrusherRecipe lastCrusherRecipe() {
|
|
||||||
List<CrusherRecipe> list = ActuallyAdditionsAPI.CRUSHER_RECIPES;
|
|
||||||
return list.get(list.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IRecipe lastIRecipe() {
|
|
||||||
return RecipeHandler.lastRecipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EmpowererRecipe lastEmpowererRecipe() {
|
|
||||||
List<EmpowererRecipe> list = ActuallyAdditionsAPI.EMPOWERER_RECIPES;
|
|
||||||
return list.get(list.size() - 1);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue