2016-05-16 22:52:27 +02:00
|
|
|
/*
|
|
|
|
* This file ("BannerHelper.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
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-05-16 22:52:27 +02:00
|
|
|
*/
|
|
|
|
|
2016-05-13 23:19:30 +02:00
|
|
|
package de.ellpeck.actuallyadditions.mod.misc;
|
|
|
|
|
2018-05-10 11:38:58 +02:00
|
|
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
2021-03-01 21:23:52 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
2016-05-13 23:19:30 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-11-19 21:11:17 +01:00
|
|
|
import net.minecraft.tileentity.BannerPattern;
|
2016-05-13 23:19:30 +02:00
|
|
|
import net.minecraftforge.common.util.EnumHelper;
|
|
|
|
|
2021-02-27 22:44:00 +01:00
|
|
|
import java.util.Locale;
|
|
|
|
|
2018-04-20 02:08:05 +02:00
|
|
|
public final class BannerHelper {
|
2016-05-13 23:19:30 +02:00
|
|
|
|
2018-04-20 02:08:05 +02:00
|
|
|
public static void init() {
|
2021-03-01 21:23:52 +01:00
|
|
|
addCraftingPattern("drill", new ItemStack(ActuallyItems.itemDrill.get(), 1, 3));
|
|
|
|
addCraftingPattern("leaf_blo", new ItemStack(ActuallyItems.itemLeafBlower.get()));
|
|
|
|
addCraftingPattern("phan_con", new ItemStack(ActuallyItems.itemPhantomConnector.get()));
|
|
|
|
addCraftingPattern("book", new ItemStack(ActuallyItems.itemBooklet.get()));
|
2016-05-13 23:19:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* (Excerpted from Additional Banners by Darkhax with permission, thanks!)
|
2016-06-01 00:39:35 +02:00
|
|
|
* <p>
|
2016-05-13 23:19:30 +02:00
|
|
|
* Adds a new banner pattern to the game. This banner pattern will be applied by using the
|
|
|
|
* provided item in a crafting recipe with the banner.
|
|
|
|
*
|
|
|
|
* @param name The name of the banner pattern. This is used for the texture file, and is
|
|
|
|
* also converted into upper case and used for the enum entry. Given how this
|
|
|
|
* system works, it's critical that this value is unique, consider adding the
|
|
|
|
* mod id to the name.
|
2016-06-01 00:39:35 +02:00
|
|
|
* //@param id A small string used to represent the pattern without taking up much space. An
|
2016-05-13 23:19:30 +02:00
|
|
|
* example of this is "bri". Given how the system works, it is critical that
|
|
|
|
* this is a unique value. please consider adding the mod id to the pattern id.
|
|
|
|
* @param craftingStack An ItemStack which is used in the crafting recipe for this pattern.
|
|
|
|
* An example of this would be the creeper skull being used for the creeper
|
|
|
|
* pattern.
|
|
|
|
*/
|
2018-04-20 02:08:05 +02:00
|
|
|
public static void addCraftingPattern(String name, ItemStack craftingStack) {
|
2021-02-27 22:44:00 +01:00
|
|
|
Class<?>[] paramTypes = {String.class, String.class, ItemStack.class};
|
|
|
|
Object[] paramValues = {ActuallyAdditions.MODID + "_" + name, ActuallyAdditions.MODID + "_" + name, craftingStack};
|
2018-05-10 11:38:58 +02:00
|
|
|
EnumHelper.addEnum(BannerPattern.class, (ActuallyAdditions.MODID + "_" + name).toUpperCase(Locale.ROOT), paramTypes, paramValues);
|
2016-05-13 23:19:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|