81 lines
3.6 KiB
Java
81 lines
3.6 KiB
Java
/* */ package com.bernard.torch.init;
|
|
/* */
|
|
/* */ import java.util.HashMap;
|
|
/* */ import java.util.Map;
|
|
/* */ import net.minecraft.block.Block;
|
|
/* */ import net.minecraft.item.Item;
|
|
/* */ import net.minecraft.item.ItemStack;
|
|
/* */
|
|
/* */
|
|
/* */
|
|
/* */ public class CoalStickAndTorchesRegister
|
|
/* */ {
|
|
/* 13 */ private static Map<Item, Integer[]> registered = new HashMap();
|
|
/* */ private static final int coalValue = 0;
|
|
/* */ private static final int stickValue = 1;
|
|
/* */ private static final int torchValue = 2;
|
|
/* */
|
|
/* */ public static void registerCoal(Item i, int value) {
|
|
/* 19 */ registered.put(i, new Integer[] { Integer.valueOf(0), Integer.valueOf(Math.abs(value)) });
|
|
/* */ }
|
|
/* */
|
|
/* 22 */ public static void registerCoal(Block b, int value) { registered.put(Item.getItemFromBlock(b), new Integer[] { Integer.valueOf(0), Integer.valueOf(Math.abs(value)) }); }
|
|
/* */
|
|
/* */ public static void registerCoal(ItemStack s, int value) {
|
|
/* 25 */ registered.put(s.getItem(), new Integer[] { Integer.valueOf(0), Integer.valueOf(Math.abs(value)) });
|
|
/* */ }
|
|
/* */
|
|
/* 28 */ public static void registerStick(Item i, int value) { registered.put(i, new Integer[] { Integer.valueOf(1), Integer.valueOf(Math.abs(value)) }); }
|
|
/* */
|
|
/* */ public static void registerStick(Block b, int value) {
|
|
/* 31 */ registered.put(Item.getItemFromBlock(b), new Integer[] { Integer.valueOf(1), Integer.valueOf(Math.abs(value)) });
|
|
/* */ }
|
|
/* */
|
|
/* 34 */ public static void registerStick(ItemStack s, int value) { registered.put(s.getItem(), new Integer[] { Integer.valueOf(1), Integer.valueOf(Math.abs(value)) }); }
|
|
/* */
|
|
/* */ public static void registerTorch(Item i, int value) {
|
|
/* 37 */ registered.put(i, new Integer[] { Integer.valueOf(2), Integer.valueOf(Math.abs(value)) });
|
|
/* */ }
|
|
/* */
|
|
/* 40 */ public static void registerTorch(Block b, int value) { registered.put(Item.getItemFromBlock(b), new Integer[] { Integer.valueOf(2), Integer.valueOf(Math.abs(value)) }); }
|
|
/* */
|
|
/* */
|
|
/* 43 */ public static void registerTorch(ItemStack s, int value) { registered.put(s.getItem(), new Integer[] { Integer.valueOf(2), Integer.valueOf(Math.abs(value)) }); }
|
|
/* */
|
|
/* */ public static boolean isCoal(Item i) {
|
|
/* 46 */ if (!registered.containsKey(i))
|
|
/* 47 */ return false;
|
|
/* 48 */ return ((Integer[])registered.get(i))[0].intValue() == 0;
|
|
/* */ }
|
|
/* */
|
|
/* 51 */ public static boolean isRegistered(Item i) { return registered.containsKey(i); }
|
|
/* */
|
|
/* */ public static boolean isStick(Item i) {
|
|
/* 54 */ if (!registered.containsKey(i))
|
|
/* 55 */ return false;
|
|
/* 56 */ return ((Integer[])registered.get(i))[0].intValue() == 1;
|
|
/* */ }
|
|
/* */
|
|
/* 59 */ public static boolean isTorch(Item i) { if (!registered.containsKey(i))
|
|
/* 60 */ return false;
|
|
/* 61 */ return ((Integer[])registered.get(i))[0].intValue() == 2;
|
|
/* */ }
|
|
/* */
|
|
/* 64 */ public static int getCoalValue(Item i) { if (!isCoal(i))
|
|
/* 65 */ return 0;
|
|
/* 66 */ return ((Integer[])registered.get(i))[1].intValue();
|
|
/* */ }
|
|
/* */
|
|
/* 69 */ public static int getStickValue(Item i) { if (!isStick(i))
|
|
/* 70 */ return 0;
|
|
/* 71 */ return ((Integer[])registered.get(i))[1].intValue();
|
|
/* */ }
|
|
/* */
|
|
/* 74 */ public static int getTorchValue(Item i) { if (!isTorch(i))
|
|
/* 75 */ return 0;
|
|
/* 76 */ return ((Integer[])registered.get(i))[1].intValue();
|
|
/* */ }
|
|
/* */ }
|
|
|
|
|