mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-23 03:49:22 +01:00
Merge remote-tracking branch 'origin/1.16' into 1.16
This commit is contained in:
commit
11db8c8324
10 changed files with 544 additions and 545 deletions
|
@ -24,7 +24,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
|||
public final class ActuallyBlocks {
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
|
||||
|
||||
public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.create(Material.ROCK).harvestLevel(1).harvestTool(ToolType.PICKAXE).hardnessAndResistance(1.5f,10f);
|
||||
public static final AbstractBlock.Properties miscBlockProperties = AbstractBlock.Properties.create(Material.ROCK).harvestLevel(1).harvestTool(ToolType.PICKAXE).hardnessAndResistance(1.5f, 10f);
|
||||
@Deprecated
|
||||
public static final RegistryObject<Block> blockMisc = BLOCKS.register("misc", () -> new Block(miscBlockProperties)); // TODO this isnt a real block?
|
||||
public static final RegistryObject<Block> WOOD_CASING = BLOCKS.register("wood_casing", () -> new Block(miscBlockProperties));
|
||||
|
@ -35,8 +35,7 @@ public final class ActuallyBlocks {
|
|||
public static final RegistryObject<Block> FEEDER = BLOCKS.register("feeder", BlockFeeder::new);
|
||||
public static final RegistryObject<Block> GRINDER = BLOCKS.register("grinder", () -> new BlockGrinder(false));
|
||||
public static final RegistryObject<Block> GRINDER_DOUBLE = BLOCKS.register("grinder_double", () -> new BlockGrinder(true));
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Block> CRYSTAL_CLUSTER_REDSTONE = BLOCKS.register("crystal_cluster_redstone", () -> new BlockCrystalCluster(TheCrystals.REDSTONE));
|
||||
public static final RegistryObject<Block> CRYSTAL_CLUSTER_LAPIS = BLOCKS.register("crystal_cluster_lapis", () -> new BlockCrystalCluster(TheCrystals.LAPIS));
|
||||
public static final RegistryObject<Block> CRYSTAL_CLUSTER_DIAMOND = BLOCKS.register("crystal_cluster_diamond", () -> new BlockCrystalCluster(TheCrystals.DIAMOND));
|
||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.items;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.misc.DispenserHandlerFertilize;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.DispenserBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemDye;
|
||||
|
@ -28,7 +28,7 @@ public class ItemFertilizer extends ItemBase {
|
|||
public ItemFertilizer() {
|
||||
super(name);
|
||||
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, new DispenserHandlerFertilize());
|
||||
DispenserBlock.registerDispenseBehavior(this, new DispenserHandlerFertilize());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,102 +1,102 @@
|
|||
/*
|
||||
* This file ("CommonCapsUtil.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.compat;
|
||||
|
||||
import org.cyclops.commoncapabilities.api.capability.itemhandler.DefaultSlotlessItemHandlerWrapper;
|
||||
import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer.SlotlessItemHandlerInfo;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public final class CommonCapsUtil {
|
||||
|
||||
public static ISlotlessItemHandler createSlotlessItemViewerHandler(final TileEntityItemViewer tile, IItemHandler normalHandler) {
|
||||
return new DefaultSlotlessItemHandlerWrapper(normalHandler) {
|
||||
@Override
|
||||
public ItemStack insertItem(ItemStack stack, boolean simulate) {
|
||||
ItemStack remain = stack.copy();
|
||||
for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||
if (handler.isLoaded() && tile.isWhitelisted(handler, stack, false)) {
|
||||
if (handler.handler instanceof ISlotlessItemHandler) {
|
||||
remain = ((ISlotlessItemHandler) handler.handler).insertItem(stack, simulate);
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) {
|
||||
tile.markDirty();
|
||||
tile.doItemParticle(stack, handler.relayInQuestion.getPos(), tile.connectedRelay.getPos());
|
||||
}
|
||||
|
||||
if (!StackUtil.isValid(remain)) { return StackUtil.getEmpty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.insertItem(remain, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(int amount, boolean simulate) {
|
||||
for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||
if (handler.isLoaded()) {
|
||||
if (handler.handler instanceof ISlotlessItemHandler) {
|
||||
ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
||||
|
||||
ItemStack would = slotless.extractItem(amount, true);
|
||||
if (StackUtil.isValid(would)) {
|
||||
if (tile.isWhitelisted(handler, would, true)) {
|
||||
ItemStack has;
|
||||
if (simulate) {
|
||||
has = would;
|
||||
} else {
|
||||
has = slotless.extractItem(amount, false);
|
||||
}
|
||||
|
||||
if (StackUtil.isValid(has) && !simulate) {
|
||||
tile.markDirty();
|
||||
tile.doItemParticle(has, tile.connectedRelay.getPos(), handler.relayInQuestion.getPos());
|
||||
}
|
||||
|
||||
return has;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.extractItem(amount, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(ItemStack matchStack, int matchFlags, boolean simulate) {
|
||||
for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||
if (handler.isLoaded()) {
|
||||
if (handler.handler instanceof ISlotlessItemHandler) {
|
||||
ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
||||
|
||||
ItemStack would = slotless.extractItem(matchStack, matchFlags, true);
|
||||
if (StackUtil.isValid(would)) {
|
||||
if (tile.isWhitelisted(handler, would, true)) {
|
||||
if (simulate) {
|
||||
return would;
|
||||
} else {
|
||||
return slotless.extractItem(matchStack, matchFlags, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.extractItem(matchStack, matchFlags, simulate);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
///*
|
||||
// * This file ("CommonCapsUtil.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.compat;
|
||||
//
|
||||
//import org.cyclops.commoncapabilities.api.capability.itemhandler.DefaultSlotlessItemHandlerWrapper;
|
||||
//import org.cyclops.commoncapabilities.api.capability.itemhandler.ISlotlessItemHandler;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer;
|
||||
//import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemViewer.SlotlessItemHandlerInfo;
|
||||
//import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraftforge.items.IItemHandler;
|
||||
//
|
||||
//public final class CommonCapsUtil {
|
||||
//
|
||||
// public static ISlotlessItemHandler createSlotlessItemViewerHandler(final TileEntityItemViewer tile, IItemHandler normalHandler) {
|
||||
// return new DefaultSlotlessItemHandlerWrapper(normalHandler) {
|
||||
// @Override
|
||||
// public ItemStack insertItem(ItemStack stack, boolean simulate) {
|
||||
// ItemStack remain = stack.copy();
|
||||
// for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||
// if (handler.isLoaded() && tile.isWhitelisted(handler, stack, false)) {
|
||||
// if (handler.handler instanceof ISlotlessItemHandler) {
|
||||
// remain = ((ISlotlessItemHandler) handler.handler).insertItem(stack, simulate);
|
||||
//
|
||||
// if (!ItemStack.areItemStacksEqual(remain, stack) && !simulate) {
|
||||
// tile.markDirty();
|
||||
// tile.doItemParticle(stack, handler.relayInQuestion.getPos(), tile.connectedRelay.getPos());
|
||||
// }
|
||||
//
|
||||
// if (!StackUtil.isValid(remain)) { return StackUtil.getEmpty(); }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return super.insertItem(remain, simulate);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack extractItem(int amount, boolean simulate) {
|
||||
// for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||
// if (handler.isLoaded()) {
|
||||
// if (handler.handler instanceof ISlotlessItemHandler) {
|
||||
// ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
||||
//
|
||||
// ItemStack would = slotless.extractItem(amount, true);
|
||||
// if (StackUtil.isValid(would)) {
|
||||
// if (tile.isWhitelisted(handler, would, true)) {
|
||||
// ItemStack has;
|
||||
// if (simulate) {
|
||||
// has = would;
|
||||
// } else {
|
||||
// has = slotless.extractItem(amount, false);
|
||||
// }
|
||||
//
|
||||
// if (StackUtil.isValid(has) && !simulate) {
|
||||
// tile.markDirty();
|
||||
// tile.doItemParticle(has, tile.connectedRelay.getPos(), handler.relayInQuestion.getPos());
|
||||
// }
|
||||
//
|
||||
// return has;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return super.extractItem(amount, simulate);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack extractItem(ItemStack matchStack, int matchFlags, boolean simulate) {
|
||||
// for (SlotlessItemHandlerInfo handler : tile.slotlessInfos) {
|
||||
// if (handler.isLoaded()) {
|
||||
// if (handler.handler instanceof ISlotlessItemHandler) {
|
||||
// ISlotlessItemHandler slotless = (ISlotlessItemHandler) handler.handler;
|
||||
//
|
||||
// ItemStack would = slotless.extractItem(matchStack, matchFlags, true);
|
||||
// if (StackUtil.isValid(would)) {
|
||||
// if (tile.isWhitelisted(handler, would, true)) {
|
||||
// if (simulate) {
|
||||
// return would;
|
||||
// } else {
|
||||
// return slotless.extractItem(matchStack, matchFlags, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return super.extractItem(matchStack, matchFlags, simulate);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
package de.ellpeck.actuallyadditions.mod.util.compat;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import shadows.fastbench.gui.ContainerFastBench;
|
||||
import shadows.fastbench.gui.GuiFastBench;
|
||||
|
||||
public class CompatFastBench {
|
||||
|
||||
public static Container getFastBenchContainer(PlayerEntity p, World world) {
|
||||
return new ContainerFastBench(p, world, BlockPos.ORIGIN) {
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static Gui getFastBenchGui(PlayerEntity p, World world) {
|
||||
return new GuiFastBench(p.inventory, world, BlockPos.ORIGIN);
|
||||
}
|
||||
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.util.compat;
|
||||
//
|
||||
//import net.minecraft.client.gui.Gui;
|
||||
//import net.minecraft.entity.player.PlayerEntity;
|
||||
//import net.minecraft.inventory.container.Container;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//import shadows.fastbench.gui.ContainerFastBench;
|
||||
//import shadows.fastbench.gui.GuiFastBench;
|
||||
//
|
||||
//public class CompatFastBench {
|
||||
//
|
||||
// public static Container getFastBenchContainer(PlayerEntity p, World world) {
|
||||
// return new ContainerFastBench(p, world, BlockPos.ORIGIN) {
|
||||
// @Override
|
||||
// public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
// public static Gui getFastBenchGui(PlayerEntity p, World world) {
|
||||
// return new GuiFastBench(p.inventory, world, BlockPos.ORIGIN);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
/*
|
||||
* This file ("CompatUtil.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.compat;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.ContainerWorkbench;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
|
||||
public final class CompatUtil {
|
||||
|
||||
static boolean fb = Loader.isModLoaded("fastbench");
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static Object getCrafterGuiElement(PlayerEntity player, World world, int x, int y, int z) {
|
||||
if (fb) {
|
||||
return CompatFastBench.getFastBenchGui(player, world);
|
||||
}
|
||||
return new GuiCrafting(player.inventory, world, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
public static Object getCrafterContainerElement(PlayerEntity player, World world, int x, int y, int z) {
|
||||
if (fb) {
|
||||
return CompatFastBench.getFastBenchContainer(player, world);
|
||||
}
|
||||
return new ContainerWorkbench(player.inventory, world, new BlockPos(x, y, z)) {
|
||||
@Override
|
||||
public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static void registerCraftingTweaks() {
|
||||
CompoundNBT t = new CompoundNBT();
|
||||
if (fb) {
|
||||
t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatFastBench$1");
|
||||
} else {
|
||||
t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil$1");
|
||||
}
|
||||
FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", t);
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * This file ("CompatUtil.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.compat;
|
||||
//
|
||||
//import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
//import net.minecraft.entity.player.PlayerEntity;
|
||||
//import net.minecraft.inventory.ContainerWorkbench;
|
||||
//import net.minecraft.nbt.CompoundNBT;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//import net.minecraftforge.fml.common.Loader;
|
||||
//import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
//
|
||||
//
|
||||
//public final class CompatUtil {
|
||||
//
|
||||
// static boolean fb = Loader.isModLoaded("fastbench");
|
||||
//
|
||||
// @OnlyIn(Dist.CLIENT)
|
||||
// public static Object getCrafterGuiElement(PlayerEntity player, World world, int x, int y, int z) {
|
||||
// if (fb) {
|
||||
// return CompatFastBench.getFastBenchGui(player, world);
|
||||
// }
|
||||
// return new GuiCrafting(player.inventory, world, new BlockPos(x, y, z));
|
||||
// }
|
||||
//
|
||||
// public static Object getCrafterContainerElement(PlayerEntity player, World world, int x, int y, int z) {
|
||||
// if (fb) {
|
||||
// return CompatFastBench.getFastBenchContainer(player, world);
|
||||
// }
|
||||
// return new ContainerWorkbench(player.inventory, world, new BlockPos(x, y, z)) {
|
||||
// @Override
|
||||
// public boolean canInteractWith(PlayerEntity playerIn) {
|
||||
// return true;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// public static void registerCraftingTweaks() {
|
||||
// CompoundNBT t = new CompoundNBT();
|
||||
// if (fb) {
|
||||
// t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatFastBench$1");
|
||||
// } else {
|
||||
// t.setString("ContainerClass", "de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil$1");
|
||||
// }
|
||||
// FMLInterModComms.sendMessage("craftingtweaks", "RegisterProvider", t);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
/*
|
||||
* This file ("IMCHandler.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.compat;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockGiantChest;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockItemViewer;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockItemViewerHopping;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockTinyTorch;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockWildPlant;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
public final class IMCHandler {
|
||||
|
||||
private static final Class<?>[] NO_CARRYING = new Class<?>[] { BlockGiantChest.class, BlockWildPlant.class, BlockPlant.class, BlockPhantom.class, BlockTinyTorch.class, BlockItemViewer.class, BlockItemViewerHopping.class, BlockLaserRelay.class };
|
||||
|
||||
public static void doBlockIMC(Block block) {
|
||||
boolean allow = !ArrayUtils.contains(NO_CARRYING, block.getClass());
|
||||
FMLInterModComms.sendMessage("charset", (allow ? "add" : "remove") + "Carry", block.getRegistryName());
|
||||
}
|
||||
|
||||
public static void doItemIMC(Item item) {
|
||||
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * This file ("IMCHandler.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.compat;
|
||||
//
|
||||
//import org.apache.commons.lang3.ArrayUtils;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockGiantChest;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockItemViewer;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockItemViewerHopping;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockLaserRelay;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockTinyTorch;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.BlockWildPlant;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.base.BlockPlant;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
//
|
||||
//public final class IMCHandler {
|
||||
//
|
||||
// private static final Class<?>[] NO_CARRYING = new Class<?>[] { BlockGiantChest.class, BlockWildPlant.class, BlockPlant.class, BlockPhantom.class, BlockTinyTorch.class, BlockItemViewer.class, BlockItemViewerHopping.class, BlockLaserRelay.class };
|
||||
//
|
||||
// public static void doBlockIMC(Block block) {
|
||||
// boolean allow = !ArrayUtils.contains(NO_CARRYING, block.getClass());
|
||||
// FMLInterModComms.sendMessage("charset", (allow ? "add" : "remove") + "Carry", block.getRegistryName());
|
||||
// }
|
||||
//
|
||||
// public static void doItemIMC(Item item) {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
public class BlankRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World worldIn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFit(int width, int height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||
//
|
||||
//import net.minecraft.inventory.InventoryCrafting;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.crafting.IRecipe;
|
||||
//import net.minecraft.world.World;
|
||||
//import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
//
|
||||
//public class BlankRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
//
|
||||
// @Override
|
||||
// public boolean matches(InventoryCrafting inv, World worldIn) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||
// return ItemStack.EMPTY;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean canFit(int width, int height) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getRecipeOutput() {
|
||||
// return ItemStack.EMPTY;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* This file ("IRecipeGrouped.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.crafting;
|
||||
|
||||
public interface IRecipeGrouped {
|
||||
|
||||
String getRecipeGroup();
|
||||
|
||||
}
|
||||
///*
|
||||
// * This file ("IRecipeGrouped.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.crafting;
|
||||
//
|
||||
//public interface IRecipeGrouped {
|
||||
//
|
||||
// String getRecipeGroup();
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
/*
|
||||
Copyright 2014-2017, the Biomes O' Plenty Team
|
||||
|
||||
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
|
||||
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
|
||||
Original: https://github.com/Glitchfiend/BiomesOPlenty/blob/0f8be0526e01d918cf8f22d4904a3b74981dee6f/src/main/java/biomesoplenty/common/util/inventory/CraftingUtil.java
|
||||
(edited to work with multiple mods)
|
||||
*/
|
||||
package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
|
||||
public final class RecipeHandler {
|
||||
|
||||
public static IRecipe lastRecipe;
|
||||
|
||||
public static void addOreDictRecipe(ItemStack output, Object... inputs) {
|
||||
addShapedRecipe(output, inputs);
|
||||
}
|
||||
|
||||
public static void addShapelessOreDictRecipe(ItemStack output, Object... inputs) {
|
||||
addShapelessRecipe(output, inputs);
|
||||
}
|
||||
|
||||
public static void addShapelessRecipe(ItemStack output, Object... inputs) {
|
||||
RecipeHelper.addOldShapeless(output, inputs);
|
||||
}
|
||||
|
||||
public static void addShapedRecipe(ItemStack output, Object... inputs) {
|
||||
RecipeHelper.addOldShaped(output, inputs);
|
||||
}
|
||||
|
||||
}
|
||||
///*
|
||||
// Copyright 2014-2017, the Biomes O' Plenty Team
|
||||
//
|
||||
// This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License.
|
||||
//
|
||||
// To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
//
|
||||
// Original: https://github.com/Glitchfiend/BiomesOPlenty/blob/0f8be0526e01d918cf8f22d4904a3b74981dee6f/src/main/java/biomesoplenty/common/util/inventory/CraftingUtil.java
|
||||
// (edited to work with multiple mods)
|
||||
// */
|
||||
//package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.crafting.IRecipe;
|
||||
//
|
||||
//public final class RecipeHandler {
|
||||
//
|
||||
// public static IRecipe lastRecipe;
|
||||
//
|
||||
// public static void addOreDictRecipe(ItemStack output, Object... inputs) {
|
||||
// addShapedRecipe(output, inputs);
|
||||
// }
|
||||
//
|
||||
// public static void addShapelessOreDictRecipe(ItemStack output, Object... inputs) {
|
||||
// addShapelessRecipe(output, inputs);
|
||||
// }
|
||||
//
|
||||
// public static void addShapelessRecipe(ItemStack output, Object... inputs) {
|
||||
// RecipeHelper.addOldShapeless(output, inputs);
|
||||
// }
|
||||
//
|
||||
// public static void addShapedRecipe(ItemStack output, Object... inputs) {
|
||||
// RecipeHelper.addOldShaped(output, inputs);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,232 +1,232 @@
|
|||
package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper.ShapedPrimer;
|
||||
import net.minecraftforge.oredict.OreIngredient;
|
||||
|
||||
//This class created by Shadows_of_Fire
|
||||
//MIT License
|
||||
public final class RecipeHelper {
|
||||
|
||||
private static int j = 0;
|
||||
private static final String MODID = ActuallyAdditions.MODID;
|
||||
private static final String MODNAME = ActuallyAdditions.NAME;
|
||||
public static final List<IRecipe> RECIPE_LIST = RegistryHandler.RECIPES_TO_REGISTER;
|
||||
|
||||
/*
|
||||
* This adds the recipe to the list of crafting recipes. Since who cares about names, it adds it as recipesX, where X is the current recipe you are adding.
|
||||
*/
|
||||
public static void addRecipe(int j, IRecipe rec) {
|
||||
addRecipe("recipes" + j, rec);
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds the recipe to the list of crafting recipes. Cares about names.
|
||||
*/
|
||||
public static void addRecipe(String name, IRecipe rec) {
|
||||
Item i = rec.getRecipeOutput().getItem();
|
||||
if (i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe();
|
||||
if (rec.getRegistryName() == null) {
|
||||
RECIPE_LIST.add(rec.setRegistryName(new ResourceLocation(MODID, name)));
|
||||
} else {
|
||||
RECIPE_LIST.add(rec);
|
||||
}
|
||||
RecipeHandler.lastRecipe = rec;
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds a shaped recipe to the list of crafting recipes, using the forge format.
|
||||
*/
|
||||
public static void addOldShaped(ItemStack output, Object... input) {
|
||||
ShapedPrimer primer = CraftingHelper.parseShaped(input);
|
||||
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), primer.width, primer.height, primer.input, output));
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group.
|
||||
*/
|
||||
public static void addOldShaped(String group, ItemStack output, Object... input) {
|
||||
ShapedPrimer primer = CraftingHelper.parseShaped(input);
|
||||
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output));
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group.
|
||||
*/
|
||||
public static void addOldShaped(String name, String group, ItemStack output, Object... input) {
|
||||
ShapedPrimer primer = CraftingHelper.parseShaped(input);
|
||||
addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output).setRegistryName(MODID, name));
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds a shapeless recipe to the list of crafting recipes, using the forge format.
|
||||
*/
|
||||
public static void addOldShapeless(ItemStack output, Object... input) {
|
||||
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), output, createInput(input)));
|
||||
}
|
||||
|
||||
/*
|
||||
* This adds a shapeless recipe to the list of crafting recipes, using the forge format, with a custom group.
|
||||
*/
|
||||
public static void addOldShapeless(String group, ItemStack output, Object... input) {
|
||||
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)));
|
||||
}
|
||||
|
||||
public static void addOldShapeless(String name, String group, ItemStack output, Object... input) {
|
||||
addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)).setRegistryName(MODID, name));
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered.
|
||||
*/
|
||||
public static void addShapeless(ItemStack output, Object... inputs) {
|
||||
addRecipe(j++, new ShapelessRecipes(MODID + ":" + j, output, createInput(inputs)));
|
||||
}
|
||||
|
||||
public static void addShapeless(Item output, Object... inputs) {
|
||||
addShapeless(new ItemStack(output), inputs);
|
||||
}
|
||||
|
||||
public static void addShapeless(Block output, Object... inputs) {
|
||||
addShapeless(new ItemStack(output), inputs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. This has a custom group.
|
||||
*/
|
||||
public static void addShapeless(String group, ItemStack output, Object... inputs) {
|
||||
addRecipe(j++, new ShapelessRecipes(MODID + ":" + group, output, createInput(inputs)));
|
||||
}
|
||||
|
||||
public static void addShapeless(String group, Item output, Object... inputs) {
|
||||
addShapeless(group, new ItemStack(output), inputs);
|
||||
}
|
||||
|
||||
public static void addShapeless(String group, Block output, Object... inputs) {
|
||||
addShapeless(group, new ItemStack(output), inputs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height.
|
||||
* This array is ordered, and items must follow from left to right, top to bottom of the crafting grid.
|
||||
*/
|
||||
public static void addShaped(ItemStack output, int width, int height, Object... input) {
|
||||
addRecipe(j++, genShaped(output, width, height, input));
|
||||
}
|
||||
|
||||
public static void addShaped(Item output, int width, int height, Object... input) {
|
||||
addShaped(new ItemStack(output), width, height, input);
|
||||
}
|
||||
|
||||
public static void addShaped(Block output, int width, int height, Object... input) {
|
||||
addShaped(new ItemStack(output), width, height, input);
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height.
|
||||
* This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. This has a custom group.
|
||||
*/
|
||||
public static void addShaped(String group, ItemStack output, int width, int height, Object... input) {
|
||||
addRecipe(j++, genShaped(MODID + ":" + group, output, width, height, input));
|
||||
}
|
||||
|
||||
public static void addShaped(String group, Item output, int width, int height, Object... input) {
|
||||
addShaped(group, new ItemStack(output), width, height, input);
|
||||
}
|
||||
|
||||
public static void addShaped(String group, Block output, int width, int height, Object... input) {
|
||||
addShaped(group, new ItemStack(output), width, height, input);
|
||||
}
|
||||
|
||||
public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input) {
|
||||
if (input[0] instanceof Object[]) {
|
||||
input = (Object[]) input[0];
|
||||
}
|
||||
if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); }
|
||||
NonNullList<Ingredient> inputL = NonNullList.create();
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
Object k = input[i];
|
||||
if (k instanceof String) {
|
||||
inputL.add(i, new OreIngredient((String) k));
|
||||
} else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) {
|
||||
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
|
||||
} else if (k instanceof Item) {
|
||||
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
|
||||
} else if (k instanceof Block) {
|
||||
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
|
||||
} else {
|
||||
inputL.add(i, Ingredient.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
return new ShapedRecipes(MODID + ":" + j, l, w, inputL, output);
|
||||
}
|
||||
|
||||
public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input) {
|
||||
if (input[0] instanceof List) {
|
||||
input = ((List<?>) input[0]).toArray();
|
||||
} else if (input[0] instanceof Object[]) {
|
||||
input = (Object[]) input[0];
|
||||
}
|
||||
if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); }
|
||||
NonNullList<Ingredient> inputL = NonNullList.create();
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
Object k = input[i];
|
||||
if (k instanceof String) {
|
||||
inputL.add(i, new OreIngredient((String) k));
|
||||
} else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) {
|
||||
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
|
||||
} else if (k instanceof Item) {
|
||||
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
|
||||
} else if (k instanceof Block) {
|
||||
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
|
||||
} else if (k instanceof Ingredient) {
|
||||
inputL.add(i, (Ingredient) k);
|
||||
} else {
|
||||
inputL.add(i, Ingredient.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
return new ShapedRecipes(group, l, w, inputL, output);
|
||||
}
|
||||
|
||||
public static NonNullList<Ingredient> createInput(Object[] input) {
|
||||
if (input[0] instanceof List) {
|
||||
input = ((List<?>) input[0]).toArray();
|
||||
} else if (input[0] instanceof Object[]) {
|
||||
input = (Object[]) input[0];
|
||||
}
|
||||
NonNullList<Ingredient> inputL = NonNullList.create();
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
Object k = input[i];
|
||||
if (k instanceof String) {
|
||||
inputL.add(i, new OreIngredient((String) k));
|
||||
} else if (k instanceof ItemStack) {
|
||||
inputL.add(i, Ingredient.fromStacks((ItemStack) k));
|
||||
} else if (k instanceof Item) {
|
||||
inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
|
||||
} else if (k instanceof Block) {
|
||||
inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
|
||||
} else if (k instanceof Ingredient) {
|
||||
inputL.add(i, (Ingredient) k);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME);
|
||||
}
|
||||
}
|
||||
return inputL;
|
||||
}
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.util.crafting;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
//import de.ellpeck.actuallyadditions.mod.RegistryHandler;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.item.Item;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.crafting.IRecipe;
|
||||
//import net.minecraft.item.crafting.Ingredient;
|
||||
//import net.minecraft.item.crafting.ShapedRecipes;
|
||||
//import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
//import net.minecraft.util.NonNullList;
|
||||
//import net.minecraft.util.ResourceLocation;
|
||||
//import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
//import net.minecraftforge.common.crafting.CraftingHelper.ShapedPrimer;
|
||||
//import net.minecraftforge.oredict.OreIngredient;
|
||||
//
|
||||
////This class created by Shadows_of_Fire
|
||||
////MIT License
|
||||
//public final class RecipeHelper {
|
||||
//
|
||||
// private static int j = 0;
|
||||
// private static final String MODID = ActuallyAdditions.MODID;
|
||||
// private static final String MODNAME = ActuallyAdditions.NAME;
|
||||
// public static final List<IRecipe> RECIPE_LIST = RegistryHandler.RECIPES_TO_REGISTER;
|
||||
//
|
||||
// /*
|
||||
// * This adds the recipe to the list of crafting recipes. Since who cares about names, it adds it as recipesX, where X is the current recipe you are adding.
|
||||
// */
|
||||
// public static void addRecipe(int j, IRecipe rec) {
|
||||
// addRecipe("recipes" + j, rec);
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * This adds the recipe to the list of crafting recipes. Cares about names.
|
||||
// */
|
||||
// public static void addRecipe(String name, IRecipe rec) {
|
||||
// Item i = rec.getRecipeOutput().getItem();
|
||||
// if (i instanceof IDisableableItem && ((IDisableableItem) i).isDisabled()) rec = new BlankRecipe();
|
||||
// if (rec.getRegistryName() == null) {
|
||||
// RECIPE_LIST.add(rec.setRegistryName(new ResourceLocation(MODID, name)));
|
||||
// } else {
|
||||
// RECIPE_LIST.add(rec);
|
||||
// }
|
||||
// RecipeHandler.lastRecipe = rec;
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * This adds a shaped recipe to the list of crafting recipes, using the forge format.
|
||||
// */
|
||||
// public static void addOldShaped(ItemStack output, Object... input) {
|
||||
// ShapedPrimer primer = CraftingHelper.parseShaped(input);
|
||||
// addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), primer.width, primer.height, primer.input, output));
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group.
|
||||
// */
|
||||
// public static void addOldShaped(String group, ItemStack output, Object... input) {
|
||||
// ShapedPrimer primer = CraftingHelper.parseShaped(input);
|
||||
// addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output));
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * This adds a shaped recipe to the list of crafting recipes, using the forge format, with a custom group.
|
||||
// */
|
||||
// public static void addOldShaped(String name, String group, ItemStack output, Object... input) {
|
||||
// ShapedPrimer primer = CraftingHelper.parseShaped(input);
|
||||
// addRecipe(j++, new ShapedRecipes(new ResourceLocation(MODID, group).toString(), primer.width, primer.height, primer.input, output).setRegistryName(MODID, name));
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * This adds a shapeless recipe to the list of crafting recipes, using the forge format.
|
||||
// */
|
||||
// public static void addOldShapeless(ItemStack output, Object... input) {
|
||||
// addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, "recipes" + j).toString(), output, createInput(input)));
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * This adds a shapeless recipe to the list of crafting recipes, using the forge format, with a custom group.
|
||||
// */
|
||||
// public static void addOldShapeless(String group, ItemStack output, Object... input) {
|
||||
// addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)));
|
||||
// }
|
||||
//
|
||||
// public static void addOldShapeless(String name, String group, ItemStack output, Object... input) {
|
||||
// addRecipe(j++, new ShapelessRecipes(new ResourceLocation(MODID, group).toString(), output, createInput(input)).setRegistryName(MODID, name));
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered.
|
||||
// */
|
||||
// public static void addShapeless(ItemStack output, Object... inputs) {
|
||||
// addRecipe(j++, new ShapelessRecipes(MODID + ":" + j, output, createInput(inputs)));
|
||||
// }
|
||||
//
|
||||
// public static void addShapeless(Item output, Object... inputs) {
|
||||
// addShapeless(new ItemStack(output), inputs);
|
||||
// }
|
||||
//
|
||||
// public static void addShapeless(Block output, Object... inputs) {
|
||||
// addShapeless(new ItemStack(output), inputs);
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * Adds a shapeless recipe with X output using an array of inputs. Use Strings for OreDictionary support. This array is not ordered. This has a custom group.
|
||||
// */
|
||||
// public static void addShapeless(String group, ItemStack output, Object... inputs) {
|
||||
// addRecipe(j++, new ShapelessRecipes(MODID + ":" + group, output, createInput(inputs)));
|
||||
// }
|
||||
//
|
||||
// public static void addShapeless(String group, Item output, Object... inputs) {
|
||||
// addShapeless(group, new ItemStack(output), inputs);
|
||||
// }
|
||||
//
|
||||
// public static void addShapeless(String group, Block output, Object... inputs) {
|
||||
// addShapeless(group, new ItemStack(output), inputs);
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height.
|
||||
// * This array is ordered, and items must follow from left to right, top to bottom of the crafting grid.
|
||||
// */
|
||||
// public static void addShaped(ItemStack output, int width, int height, Object... input) {
|
||||
// addRecipe(j++, genShaped(output, width, height, input));
|
||||
// }
|
||||
//
|
||||
// public static void addShaped(Item output, int width, int height, Object... input) {
|
||||
// addShaped(new ItemStack(output), width, height, input);
|
||||
// }
|
||||
//
|
||||
// public static void addShaped(Block output, int width, int height, Object... input) {
|
||||
// addShaped(new ItemStack(output), width, height, input);
|
||||
// }
|
||||
//
|
||||
// /*
|
||||
// * Adds a shapeless recipe with X output on a crafting grid that is W x H, using an array of inputs. Use null for nothing, use Strings for OreDictionary support, this array must have a length of width * height.
|
||||
// * This array is ordered, and items must follow from left to right, top to bottom of the crafting grid. This has a custom group.
|
||||
// */
|
||||
// public static void addShaped(String group, ItemStack output, int width, int height, Object... input) {
|
||||
// addRecipe(j++, genShaped(MODID + ":" + group, output, width, height, input));
|
||||
// }
|
||||
//
|
||||
// public static void addShaped(String group, Item output, int width, int height, Object... input) {
|
||||
// addShaped(group, new ItemStack(output), width, height, input);
|
||||
// }
|
||||
//
|
||||
// public static void addShaped(String group, Block output, int width, int height, Object... input) {
|
||||
// addShaped(group, new ItemStack(output), width, height, input);
|
||||
// }
|
||||
//
|
||||
// public static ShapedRecipes genShaped(ItemStack output, int l, int w, Object[] input) {
|
||||
// if (input[0] instanceof Object[]) {
|
||||
// input = (Object[]) input[0];
|
||||
// }
|
||||
// if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); }
|
||||
// NonNullList<Ingredient> inputL = NonNullList.create();
|
||||
// for (int i = 0; i < input.length; i++) {
|
||||
// Object k = input[i];
|
||||
// if (k instanceof String) {
|
||||
// inputL.add(i, new OreIngredient((String) k));
|
||||
// } else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) {
|
||||
// inputL.add(i, Ingredient.fromStacks((ItemStack) k));
|
||||
// } else if (k instanceof Item) {
|
||||
// inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
|
||||
// } else if (k instanceof Block) {
|
||||
// inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
|
||||
// } else {
|
||||
// inputL.add(i, Ingredient.EMPTY);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return new ShapedRecipes(MODID + ":" + j, l, w, inputL, output);
|
||||
// }
|
||||
//
|
||||
// public static ShapedRecipes genShaped(String group, ItemStack output, int l, int w, Object[] input) {
|
||||
// if (input[0] instanceof List) {
|
||||
// input = ((List<?>) input[0]).toArray();
|
||||
// } else if (input[0] instanceof Object[]) {
|
||||
// input = (Object[]) input[0];
|
||||
// }
|
||||
// if (l * w != input.length) { throw new UnsupportedOperationException("Attempted to add invalid shaped recipe. Complain to the author of " + MODNAME); }
|
||||
// NonNullList<Ingredient> inputL = NonNullList.create();
|
||||
// for (int i = 0; i < input.length; i++) {
|
||||
// Object k = input[i];
|
||||
// if (k instanceof String) {
|
||||
// inputL.add(i, new OreIngredient((String) k));
|
||||
// } else if (k instanceof ItemStack && !((ItemStack) k).isEmpty()) {
|
||||
// inputL.add(i, Ingredient.fromStacks((ItemStack) k));
|
||||
// } else if (k instanceof Item) {
|
||||
// inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
|
||||
// } else if (k instanceof Block) {
|
||||
// inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
|
||||
// } else if (k instanceof Ingredient) {
|
||||
// inputL.add(i, (Ingredient) k);
|
||||
// } else {
|
||||
// inputL.add(i, Ingredient.EMPTY);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return new ShapedRecipes(group, l, w, inputL, output);
|
||||
// }
|
||||
//
|
||||
// public static NonNullList<Ingredient> createInput(Object[] input) {
|
||||
// if (input[0] instanceof List) {
|
||||
// input = ((List<?>) input[0]).toArray();
|
||||
// } else if (input[0] instanceof Object[]) {
|
||||
// input = (Object[]) input[0];
|
||||
// }
|
||||
// NonNullList<Ingredient> inputL = NonNullList.create();
|
||||
// for (int i = 0; i < input.length; i++) {
|
||||
// Object k = input[i];
|
||||
// if (k instanceof String) {
|
||||
// inputL.add(i, new OreIngredient((String) k));
|
||||
// } else if (k instanceof ItemStack) {
|
||||
// inputL.add(i, Ingredient.fromStacks((ItemStack) k));
|
||||
// } else if (k instanceof Item) {
|
||||
// inputL.add(i, Ingredient.fromStacks(new ItemStack((Item) k)));
|
||||
// } else if (k instanceof Block) {
|
||||
// inputL.add(i, Ingredient.fromStacks(new ItemStack((Block) k)));
|
||||
// } else if (k instanceof Ingredient) {
|
||||
// inputL.add(i, (Ingredient) k);
|
||||
// } else {
|
||||
// throw new UnsupportedOperationException("Attempted to add invalid shapeless recipe. Complain to the author of " + MODNAME);
|
||||
// }
|
||||
// }
|
||||
// return inputL;
|
||||
// }
|
||||
//}
|
||||
|
|
Loading…
Reference in a new issue