misc refactoring 2

This commit is contained in:
Sen 2025-05-14 15:45:27 +02:00
parent 10ba39c70b
commit 660199b1d8
14 changed files with 344 additions and 420 deletions

View file

@ -8,7 +8,6 @@ public abstract class FlammabilityRegistry {
}
static void register() {
// setFlammable(Blocks.planks, 5, 20);
for(WoodType wood : WoodType.values()) {
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_planks"), 5, 20);
setFlammable(BlockRegistry.getRegisteredBlock(wood.getName() + "_slab"), 5, 20);
@ -31,45 +30,5 @@ public abstract class FlammabilityRegistry {
setFlammable(Blocks.coal_block, 5, 5);
setFlammable(Blocks.hay_block, 60, 20);
setFlammable(Blocks.carpet, 60, 20);
// setFlammable(Blocks.double_wooden_slab, 5, 20);
// setFlammable(Blocks.wooden_slab, 5, 20);
// setFlammable(Blocks.oak_fence_gate, 5, 20);
// setFlammable(Blocks.spruce_fence_gate, 5, 20);
// setFlammable(Blocks.birch_fence_gate, 5, 20);
// setFlammable(Blocks.jungle_fence_gate, 5, 20);
// setFlammable(Blocks.dark_oak_fence_gate, 5, 20);
// setFlammable(Blocks.acacia_fence_gate, 5, 20);
// setFlammable(Blocks.oak_fence, 5, 20);
// setFlammable(Blocks.spruce_fence, 5, 20);
// setFlammable(Blocks.birch_fence, 5, 20);
// setFlammable(Blocks.jungle_fence, 5, 20);
// setFlammable(Blocks.dark_oak_fence, 5, 20);
// setFlammable(Blocks.acacia_fence, 5, 20);
// setFlammable(Blocks.oak_stairs, 5, 20);
// setFlammable(Blocks.birch_stairs, 5, 20);
// setFlammable(Blocks.spruce_stairs, 5, 20);
// setFlammable(Blocks.jungle_stairs, 5, 20);
// setFlammable(Blocks.log, 5, 5);
// setFlammable(Blocks.log2, 5, 5);
// for(BlockLeaves leaves : BlockLeaves.LEAVES) {
// setFlammable(leaves, 30, 60);
//// setFlammable(Blocks.leaves2, 30, 60);
// }
// setFlammable(Blocks.red_flower, 60, 100);
// setFlammable(Blocks.cherry_leaves, 30, 60);
// setFlammable(Blocks.maple_leaves, 30, 60);
// setFlammable(Blocks.cherry_fence_gate, 5, 20);
// setFlammable(Blocks.maple_fence_gate, 5, 20);
// setFlammable(Blocks.cherry_fence, 5, 20);
// setFlammable(Blocks.maple_fence, 5, 20);
// setFlammable(Blocks.cherry_stairs, 5, 20);
// setFlammable(Blocks.maple_stairs, 5, 20);
// setFlammable(Blocks.wooden_vslab, 5, 20);
// setFlammable(Blocks.wooden_vslab2, 5, 20);
// for(BlockSlab slab : BlockSlab.SLABS) {
// if(slab.getMaterial() == Material.wood)
// setFlammable(slab, 5, 20);
// }
}
}

View file

@ -11,241 +11,208 @@ import common.item.ItemShears;
public abstract class Items {
public static final Item iron_shovel = get("iron_shovel");
public static final Item iron_pickaxe = get("iron_pickaxe");
public static final Item iron_axe = get("iron_axe");
public static final Item flint_and_steel = get("flint_and_steel");
public static final Item apple = get("apple");
public static final ItemBow bow = (ItemBow)get("bow");
public static final Item arrow = get("arrow");
public static final Item coal = get("coal");
public static final Item diamond = get("diamond");
public static final Item iron_ingot = get("iron_ingot");
public static final Item gold_ingot = get("gold_ingot");
public static final Item iron_sword = get("iron_sword");
public static final Item wood_sword = get("wood_sword");
public static final Item wood_shovel = get("wood_shovel");
public static final Item wood_pickaxe = get("wood_pickaxe");
public static final Item wood_axe = get("wood_axe");
public static final Item stone_sword = get("stone_sword");
public static final Item stone_shovel = get("stone_shovel");
public static final Item stone_pickaxe = get("stone_pickaxe");
public static final Item stone_axe = get("stone_axe");
public static final Item diamond_sword = get("diamond_sword");
public static final Item diamond_shovel = get("diamond_shovel");
public static final Item diamond_pickaxe = get("diamond_pickaxe");
public static final Item diamond_axe = get("diamond_axe");
public static final Item stick = get("stick");
public static final Item bowl = get("bowl");
public static final Item mushroom_stew = get("mushroom_stew");
public static final Item gold_sword = get("gold_sword");
public static final Item gold_shovel = get("gold_shovel");
public static final Item gold_pickaxe = get("gold_pickaxe");
public static final Item gold_axe = get("gold_axe");
public static final Item string = get("string");
public static final Item feather = get("feather");
public static final Item gunpowder = get("gunpowder");
public static final Item wood_hoe = get("wood_hoe");
public static final Item stone_hoe = get("stone_hoe");
public static final Item iron_hoe = get("iron_hoe");
public static final Item diamond_hoe = get("diamond_hoe");
public static final Item gold_hoe = get("gold_hoe");
public static final Item wheat = get("wheat");
public static final Item wheats = get("wheats");
public static final Item bread = get("bread");
public static final ItemArmor leather_helmet = (ItemArmor)get("leather_helmet");
public static final ItemArmor leather_chestplate = (ItemArmor)get("leather_chestplate");
public static final ItemArmor leather_leggings = (ItemArmor)get("leather_leggings");
public static final ItemArmor leather_boots = (ItemArmor)get("leather_boots");
public static final ItemArmor chain_helmet = (ItemArmor)get("chain_helmet");
public static final ItemArmor chain_chestplate = (ItemArmor)get("chain_chestplate");
public static final ItemArmor chain_leggings = (ItemArmor)get("chain_leggings");
public static final ItemArmor chain_boots = (ItemArmor)get("chain_boots");
public static final ItemArmor iron_helmet = (ItemArmor)get("iron_helmet");
public static final ItemArmor iron_chestplate = (ItemArmor)get("iron_chestplate");
public static final ItemArmor iron_leggings = (ItemArmor)get("iron_leggings");
public static final ItemArmor iron_boots = (ItemArmor)get("iron_boots");
public static final ItemArmor diamond_helmet = (ItemArmor)get("diamond_helmet");
public static final ItemArmor diamond_chestplate = (ItemArmor)get("diamond_chestplate");
public static final ItemArmor diamond_leggings = (ItemArmor)get("diamond_leggings");
public static final ItemArmor diamond_boots = (ItemArmor)get("diamond_boots");
public static final ItemArmor gold_helmet = (ItemArmor)get("gold_helmet");
public static final ItemArmor gold_chestplate = (ItemArmor)get("gold_chestplate");
public static final ItemArmor gold_leggings = (ItemArmor)get("gold_leggings");
public static final ItemArmor gold_boots = (ItemArmor)get("gold_boots");
public static final Item flint = get("flint");
public static final Item porkchop = get("porkchop");
public static final Item cooked_porkchop = get("cooked_porkchop");
// public static final Item painting = get("painting");
public static final Item golden_apple = get("golden_apple");
public static final Item sign = get("sign");
public static final Item oak_door = get("oak_door");
public static final Item spruce_door = get("spruce_door");
public static final Item birch_door = get("birch_door");
public static final Item jungle_door = get("jungle_door");
public static final Item acacia_door = get("acacia_door");
public static final Item dark_oak_door = get("dark_oak_door");
public static final Item bucket = get("bucket");
public static final Item water_bucket = get("water_bucket");
// public static final Item lava_bucket = get("lava_bucket");
// public static final Item fluid_bucket = get("fluid_bucket");
public static final Item minecart = get("minecart");
public static final Item saddle = get("saddle");
public static final Item iron_door = get("iron_door");
public static final Item redstone = get("redstone");
public static final Item snowball = get("snowball");
public static final Item boat = get("boat");
public static final Item leather = get("leather");
public static final Item milk_bucket = get("milk_bucket");
public static final Item brick = get("brick");
public static final Item clay_ball = get("clay_ball");
public static final Item reeds = get("reeds");
public static final Item paper = get("paper");
public static final Item book = get("book");
public static final Item slime_ball = get("slime_ball");
public static final Item chest_minecart = get("chest_minecart");
// public static final Item furnace_minecart = get("furnace_minecart");
public static final Item egg = get("egg");
public static final Item navigator = get("navigator");
public static final ItemFishingRod fishing_rod = (ItemFishingRod)get("fishing_rod");
// public static final Item clock = get("clock");
public static final Item glowstone_dust = get("glowstone_dust");
public static final Item fish = get("fish");
public static final Item cooked_fish = get("cooked_fish");
public static final Item dye = get("dye");
public static final Item bone = get("bone");
public static final Item sugar = get("sugar");
public static final Item cake = get("cake");
// public static final Item red_bed = get("red_bed");
public static final Item repeater = get("repeater");
public static final Item cookie = get("cookie");
public static final ItemShears iron_shears = (ItemShears)get("iron_shears");
public static final Item melon = get("melon");
public static final Item pumpkin_stem = get("pumpkin_stem");
public static final Item melon_stem = get("melon_stem");
public static final Item beef = get("beef");
public static final Item cooked_beef = get("cooked_beef");
public static final Item chicken = get("chicken");
public static final Item cooked_chicken = get("cooked_chicken");
public static final Item rotten_flesh = get("rotten_flesh");
public static final Item orb = get("orb");
public static final Item blaze_rod = get("blaze_rod");
public static final Item ghast_tear = get("ghast_tear");
public static final Item gold_nugget = get("gold_nugget");
public static final Item soul_wart = get("soul_wart");
public static final ItemPotion potion = (ItemPotion)get("potion");
public static final Item glass_bottle = get("glass_bottle");
public static final Item spider_eye = get("spider_eye");
public static final Item fermented_spider_eye = get("fermented_spider_eye");
public static final Item blaze_powder = get("blaze_powder");
public static final Item magma_cream = get("magma_cream");
public static final Item brewing_stand = get("brewing_stand");
public static final Item cauldron = get("cauldron");
public static final Item charged_orb = get("charged_orb");
public static final Item speckled_melon = get("speckled_melon");
// public static final Item spawn_egg = get("spawn_egg");
public static final Item experience_bottle = get("experience_bottle");
public static final Item fire_charge = get("fire_charge");
public static final Item writable_book = get("writable_book");
public static final Item written_book = get("written_book");
public static final Item emerald = get("emerald");
// public static final Item item_frame = get("item_frame");
public static final Item flower_pot = get("flower_pot");
public static final Item carrot = get("carrot");
public static final Item potato = get("potato");
public static final Item ahrd_fragment = get("ahrd_fragment");
public static final Item aluminium_ingot = get("aluminium_ingot");
public static final Item apple = get("apple");
public static final Item arrow = get("arrow");
public static final Item baked_potato = get("baked_potato");
public static final Item poisonous_potato = get("poisonous_potato");
public static final Item golden_carrot = get("golden_carrot");
public static final Item skull = get("skull");
public static final Item carrot_on_a_stick = get("carrot_on_a_stick");
public static final Item charge_crystal = get("charge_crystal");
public static final Item pumpkin_pie = get("pumpkin_pie");
public static final Item fireworks = get("fireworks");
public static final Item firework_charge = get("firework_charge");
public static final ItemEnchantedBook enchanted_book = (ItemEnchantedBook)get("enchanted_book");
public static final Item comparator = get("comparator");
public static final Item banner = get("banner");
public static final Item beef = get("beef");
public static final Item birch_door = get("birch_door");
public static final Item blaze_powder = get("blaze_powder");
public static final Item blaze_rod = get("blaze_rod");
public static final Item bloodbrick = get("bloodbrick");
public static final Item quartz = get("quartz");
public static final Item tnt_minecart = get("tnt_minecart");
public static final Item hopper_minecart = get("hopper_minecart");
public static final Item iron_horse_armor = get("iron_horse_armor");
public static final Item gold_horse_armor = get("gold_horse_armor");
public static final Item boat = get("boat");
public static final ItemAmmo bolt = (ItemAmmo)get("bolt");
public static final Item boltgun = get("boltgun");
public static final Item bone = get("bone");
public static final Item book = get("book");
public static final ItemBow bow = (ItemBow)get("bow");
public static final Item bowl = get("bowl");
public static final Item bread = get("bread");
public static final Item brewing_stand = get("brewing_stand");
public static final Item brick = get("brick");
public static final Item bucket = get("bucket");
public static final Item cake = get("cake");
public static final Item camera = get("camera");
public static final Item carrot = get("carrot");
public static final Item carrot_on_a_stick = get("carrot_on_a_stick");
public static final Item cauldron = get("cauldron");
public static final Item chain = get("chain");
public static final ItemArmor chain_boots = (ItemArmor)get("chain_boots");
public static final ItemArmor chain_chestplate = (ItemArmor)get("chain_chestplate");
public static final ItemArmor chain_helmet = (ItemArmor)get("chain_helmet");
public static final ItemArmor chain_leggings = (ItemArmor)get("chain_leggings");
public static final Item charge_crystal = get("charge_crystal");
public static final Item charged_orb = get("charged_orb");
public static final Item cherry_door = get("cherry_door");
public static final Item chest_minecart = get("chest_minecart");
public static final Item chick_magnet = get("chick_magnet");
public static final Item chicken = get("chicken");
public static final Item cinnabar = get("cinnabar");
public static final Item clay_ball = get("clay_ball");
public static final Item coal = get("coal");
public static final Item cobalt_ingot = get("cobalt_ingot");
public static final Item comparator = get("comparator");
public static final Item cooked_beef = get("cooked_beef");
public static final Item cooked_chicken = get("cooked_chicken");
public static final Item cooked_fish = get("cooked_fish");
public static final Item cooked_porkchop = get("cooked_porkchop");
public static final Item cookie = get("cookie");
public static final Item copper_ingot = get("copper_ingot");
public static final Item dark_oak_door = get("dark_oak_door");
public static final Item diamond = get("diamond");
public static final Item diamond_axe = get("diamond_axe");
public static final ItemArmor diamond_boots = (ItemArmor)get("diamond_boots");
public static final ItemArmor diamond_chestplate = (ItemArmor)get("diamond_chestplate");
public static final ItemArmor diamond_helmet = (ItemArmor)get("diamond_helmet");
public static final Item diamond_hoe = get("diamond_hoe");
public static final Item diamond_horse_armor = get("diamond_horse_armor");
public static final ItemArmor diamond_leggings = (ItemArmor)get("diamond_leggings");
public static final Item diamond_pickaxe = get("diamond_pickaxe");
public static final ItemShears diamond_shears = (ItemShears)get("diamond_shears");
public static final Item diamond_shovel = get("diamond_shovel");
public static final Item diamond_sword = get("diamond_sword");
public static final Item die = get("die");
public static final Item dye = get("dye");
public static final Item dynamite = get("dynamite");
public static final Item egg = get("egg");
public static final Item emerald = get("emerald");
public static final ItemEnchantedBook enchanted_book = (ItemEnchantedBook)get("enchanted_book");
public static final Item experience_bottle = get("experience_bottle");
public static final Item feather = get("feather");
public static final Item fermented_spider_eye = get("fermented_spider_eye");
public static final Item fire_charge = get("fire_charge");
public static final Item firework_charge = get("firework_charge");
public static final Item fireworks = get("fireworks");
public static final Item fish = get("fish");
public static final ItemFishingRod fishing_rod = (ItemFishingRod)get("fishing_rod");
public static final Item flint = get("flint");
public static final Item flint_and_steel = get("flint_and_steel");
public static final Item flower_pot = get("flower_pot");
public static final Item ghast_tear = get("ghast_tear");
public static final Item ghi_fragment = get("ghi_fragment");
public static final Item glass_bottle = get("glass_bottle");
public static final Item glowstone_dust = get("glowstone_dust");
public static final Item gold_axe = get("gold_axe");
public static final ItemArmor gold_boots = (ItemArmor)get("gold_boots");
public static final ItemArmor gold_chestplate = (ItemArmor)get("gold_chestplate");
public static final ItemArmor gold_helmet = (ItemArmor)get("gold_helmet");
public static final Item gold_hoe = get("gold_hoe");
public static final Item gold_horse_armor = get("gold_horse_armor");
public static final Item gold_ingot = get("gold_ingot");
public static final ItemArmor gold_leggings = (ItemArmor)get("gold_leggings");
public static final Item gold_nugget = get("gold_nugget");
public static final Item gold_pickaxe = get("gold_pickaxe");
public static final Item gold_shovel = get("gold_shovel");
public static final Item gold_sword = get("gold_sword");
public static final Item golden_apple = get("golden_apple");
public static final Item golden_carrot = get("golden_carrot");
public static final Item gunpowder = get("gunpowder");
public static final Item hopper_minecart = get("hopper_minecart");
public static final Item info_wand = get("info_wand");
public static final Item iron_axe = get("iron_axe");
public static final ItemArmor iron_boots = (ItemArmor)get("iron_boots");
public static final ItemArmor iron_chestplate = (ItemArmor)get("iron_chestplate");
public static final Item iron_door = get("iron_door");
public static final ItemArmor iron_helmet = (ItemArmor)get("iron_helmet");
public static final Item iron_hoe = get("iron_hoe");
public static final Item iron_horse_armor = get("iron_horse_armor");
public static final Item iron_ingot = get("iron_ingot");
public static final ItemArmor iron_leggings = (ItemArmor)get("iron_leggings");
public static final Item iron_pickaxe = get("iron_pickaxe");
public static final ItemShears iron_shears = (ItemShears)get("iron_shears");
public static final Item iron_shovel = get("iron_shovel");
public static final Item iron_sword = get("iron_sword");
public static final Item jungle_door = get("jungle_door");
public static final Item key = get("key");
public static final Item lead = get("lead");
public static final Item lead_ingot = get("lead_ingot");
public static final Item leather = get("leather");
public static final ItemArmor leather_boots = (ItemArmor)get("leather_boots");
public static final ItemArmor leather_chestplate = (ItemArmor)get("leather_chestplate");
public static final ItemArmor leather_helmet = (ItemArmor)get("leather_helmet");
public static final ItemArmor leather_leggings = (ItemArmor)get("leather_leggings");
public static final Item lightning_wand = get("lightning_wand");
public static final Item magma_cream = get("magma_cream");
public static final Item magnet = get("magnet");
public static final Item maple_door = get("maple_door");
public static final Item melon = get("melon");
public static final Item melon_stem = get("melon_stem");
public static final Item milk_bucket = get("milk_bucket");
public static final Item minecart = get("minecart");
public static final Item mushroom_stew = get("mushroom_stew");
public static final Item name_tag = get("name_tag");
public static final Item navigator = get("navigator");
public static final Item neodymium_ingot = get("neodymium_ingot");
public static final Item nickel_ingot = get("nickel_ingot");
public static final Item nieh_fragment = get("nieh_fragment");
public static final Item oak_door = get("oak_door");
public static final Item orb = get("orb");
public static final Item paper = get("paper");
public static final Item poisonous_potato = get("poisonous_potato");
public static final Item porkchop = get("porkchop");
public static final Item portal_frame = get("portal_frame");
public static final Item potato = get("potato");
public static final ItemPotion potion = (ItemPotion)get("potion");
public static final Item pumpkin_pie = get("pumpkin_pie");
public static final Item pumpkin_stem = get("pumpkin_stem");
public static final Item quartz = get("quartz");
public static final Item record_11 = get("record_11");
public static final Item record_13 = get("record_13");
public static final Item record_cat = get("record_cat");
public static final Item record_blocks = get("record_blocks");
public static final Item record_cat = get("record_cat");
public static final Item record_chirp = get("record_chirp");
public static final Item record_delay = get("record_delay");
public static final Item record_extend = get("record_extend");
public static final Item record_far = get("record_far");
public static final Item record_mall = get("record_mall");
public static final Item record_mellohi = get("record_mellohi");
public static final Item record_stal = get("record_stal");
public static final Item record_strad = get("record_strad");
public static final Item record_ward = get("record_ward");
public static final Item record_11 = get("record_11");
public static final Item record_wait = get("record_wait");
public static final Item record_delay = get("record_delay");
public static final Item record_extend = get("record_extend");
public static final Item banner = get("banner");
public static final Item portal_frame = get("portal_frame");
public static final Item dynamite = get("dynamite");
public static final Item cherry_door = get("cherry_door");
public static final Item maple_door = get("maple_door");
public static final ItemShears diamond_shears = (ItemShears)get("diamond_shears");
public static final Item thi_fragment = get("thi_fragment");
public static final Item ahrd_fragment = get("ahrd_fragment");
public static final Item ghi_fragment = get("ghi_fragment");
public static final Item nieh_fragment = get("nieh_fragment");
// public static final Item npc_spawner = get("npc_spawner");
public static final Item wand = get("wand");
// public static final Item navigator = get("navigator");
public static final Item copper_ingot = get("copper_ingot");
public static final Item tin_ingot = get("tin_ingot");
public static final Item aluminium_ingot = get("aluminium_ingot");
public static final Item lead_ingot = get("lead_ingot");
public static final Item nickel_ingot = get("nickel_ingot");
public static final Item cobalt_ingot = get("cobalt_ingot");
public static final Item neodymium_ingot = get("neodymium_ingot");
public static final Item die = get("die");
public static final Item lightning_wand = get("lightning_wand");
public static final Item info_wand = get("info_wand");
public static final Item key = get("key");
public static final Item record_ward = get("record_ward");
public static final Item redstone = get("redstone");
public static final Item reeds = get("reeds");
public static final Item repeater = get("repeater");
public static final Item rotten_flesh = get("rotten_flesh");
public static final Item ruby = get("ruby");
public static final Item chick_magnet = get("chick_magnet");
public static final Item magnet = get("magnet");
public static final Item cinnabar = get("cinnabar");
public static final Item chain = get("chain");
public static final Item camera = get("camera");
public static final Item boltgun = get("boltgun");
public static final ItemAmmo bolt = (ItemAmmo)get("bolt");
public static final Item saddle = get("saddle");
public static final Item sign = get("sign");
public static final Item skull = get("skull");
public static final Item slime_ball = get("slime_ball");
public static final Item snowball = get("snowball");
public static final Item soul_wart = get("soul_wart");
public static final Item speckled_melon = get("speckled_melon");
public static final Item spider_eye = get("spider_eye");
public static final Item spruce_door = get("spruce_door");
public static final Item stick = get("stick");
public static final Item stone_axe = get("stone_axe");
public static final Item stone_hoe = get("stone_hoe");
public static final Item stone_pickaxe = get("stone_pickaxe");
public static final Item stone_shovel = get("stone_shovel");
public static final Item stone_sword = get("stone_sword");
public static final Item string = get("string");
public static final Item sugar = get("sugar");
public static final Item thi_fragment = get("thi_fragment");
public static final Item tin_ingot = get("tin_ingot");
public static final Item tnt_minecart = get("tnt_minecart");
public static final Item wand = get("wand");
public static final Item water_bucket = get("water_bucket");
public static final Item wheat = get("wheat");
public static final Item wheats = get("wheats");
public static final Item wood_axe = get("wood_axe");
public static final Item wood_hoe = get("wood_hoe");
public static final Item wood_pickaxe = get("wood_pickaxe");
public static final Item wood_shovel = get("wood_shovel");
public static final Item wood_sword = get("wood_sword");
public static final Item writable_book = get("writable_book");
public static final Item written_book = get("written_book");
private static Item get(String id) {
if(!ItemRegistry.REGISTRY.containsKey(id))
throw new RuntimeException("Item " + id + " does not exist!");
return ItemRegistry.REGISTRY.getObject(id);
}
// static {
// for(Field field : Items.class.getDeclaredFields()) {
// if(Item.class.isAssignableFrom(field.getType())) {
// if(!ItemRegistry.REGISTRY.containsKey(field.getName())) {
// throw new RuntimeException("Item " + field.getName() + " does not exist!");
// }
// Item item = ItemRegistry.REGISTRY.getObject(field.getName());
// try {
// field.set(null, item);
// }
// catch(IllegalArgumentException | IllegalAccessException e) {
// throw new RuntimeException(e);
// }
// }
// }
// }
}

View file

@ -23,17 +23,18 @@ import common.tileentity.TileEntitySkull;
import common.tileentity.TileEntityTianReactor;
public abstract class TileRegistry {
public static final Map<String, Class<? extends TileEntity>> nameToClassMap = Maps.<String, Class<? extends TileEntity>>newHashMap();
public static final Map<Class<? extends TileEntity>, String> classToNameMap = Maps.<Class<? extends TileEntity>, String>newHashMap();
public static final Map<Class<? extends TileEntity>, Integer> classToIdMap = Maps.<Class<? extends TileEntity>, Integer>newHashMap();
public static final Map<String, Class<? extends TileEntity>> NAME_TO_CLASS = Maps.<String, Class<? extends TileEntity>>newHashMap();
public static final Map<Class<? extends TileEntity>, String> CLASS_TO_NAME = Maps.<Class<? extends TileEntity>, String>newHashMap();
public static final Map<Class<? extends TileEntity>, Integer> CLASS_TO_ID = Maps.<Class<? extends TileEntity>, Integer>newHashMap();
private static int nextId;
private static void addMapping(Class<? extends TileEntity> cl, String id) {
if(nameToClassMap.containsKey(id))
if(NAME_TO_CLASS.containsKey(id))
throw new IllegalArgumentException("Duplicate id: " + id);
nameToClassMap.put(id, cl);
classToNameMap.put(cl, id);
classToIdMap.put(cl, ++nextId);
NAME_TO_CLASS.put(id, cl);
CLASS_TO_NAME.put(cl, id);
CLASS_TO_ID.put(cl, ++nextId);
}
static void register() {

View file

@ -5,38 +5,38 @@ import java.util.Set;
import common.collect.Sets;
import common.item.Item;
public class ToolMaterial
{
public class ToolMaterial {
private static final int[] MAX_DAMAGE = new int[] {11, 16, 15, 13};
private static final float[] RAD_REDUCE = new float[] {1.0f, 1.7f, 1.6f, 1.4f};
private static final float[] MAG_REDUCE = new float[] {1.0f, 1.2f, 1.1f, 1.0f};
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int durability;
private final float efficiency;
private final int damage;
private final float radiationResistance;
private final float magicResistance;
private final int enchantability;
private final int maxDamageFactor;
private final int[] damageReductionAmountArray;
private final int[] damageReduction;
private final int armorEnchantability;
private final boolean tools;
private final boolean weapons;
private final boolean extras;
private final Set<Item> repair = Sets.newHashSet();
private boolean magnetic;
private int defColor = 0xffffffff;
private Set<Item> repair = Sets.newHashSet();
private ToolMaterial(float rad, float mag, int level, int uses, float efficiency, int damage, int ench, boolean tools,
boolean weapons, boolean extras, int auses, int aench, int r1, int r2, int r3, int r4) {
private ToolMaterial(float rad, float mag, int level, int uses, float efficiency, int damage, int ench, boolean tools, boolean weapons,
boolean extras, int auses, int aench, int r1, int r2, int r3, int r4) {
this.harvestLevel = level;
this.maxUses = uses;
this.efficiencyOnProperMaterial = efficiency;
this.damageVsEntity = damage;
this.durability = uses;
this.efficiency = efficiency;
this.damage = damage;
this.enchantability = ench;
this.maxDamageFactor = auses;
this.damageReductionAmountArray = new int[] {r1, r2, r3, r4};
this.damageReduction = new int[] {r1, r2, r3, r4};
this.armorEnchantability = aench;
this.radiationResistance = rad;
this.magicResistance = mag;
@ -61,8 +61,8 @@ public class ToolMaterial
this(rad, mag, 0, 0, 0.0F, 0, 0, false, false, false, auses, aench, r1, r2, r3, r4);
}
protected ToolMaterial(int level, float rad, float mag, int uses, float efficiency, int damage, int ench, boolean extras,
int auses, int aench, int r1, int r2, int r3, int r4) {
protected ToolMaterial(int level, float rad, float mag, int uses, float efficiency, int damage, int ench, boolean extras, int auses, int aench,
int r1, int r2, int r3, int r4) {
this(rad, mag, level, uses, efficiency, damage, ench, true, true, extras, auses, aench, r1, r2, r3, r4);
}
@ -96,28 +96,23 @@ public class ToolMaterial
return this.extras;
}
public int getMaxUses()
{
return this.maxUses;
public int getDurability() {
return this.durability;
}
public float getEfficiencyOnProperMaterial()
{
return this.efficiencyOnProperMaterial;
public float getEfficiency() {
return this.efficiency;
}
public int getDamageVsEntity()
{
return this.damageVsEntity;
public int getDamage() {
return this.damage;
}
public int getHarvestLevel()
{
public int getHarvestLevel() {
return this.harvestLevel;
}
public int getEnchantability()
{
public int getEnchantability() {
return this.enchantability;
}
@ -125,28 +120,23 @@ public class ToolMaterial
return this.repair.contains(item);
}
public int getDurability(int armorType)
{
public int getDurability(int armorType) {
return MAX_DAMAGE[armorType] * this.maxDamageFactor;
}
public float getRadiationReduction(int armorType)
{
public float getRadiationReduction(int armorType) {
return RAD_REDUCE[armorType] * this.radiationResistance;
}
public float getMagicReduction(int armorType)
{
public float getMagicReduction(int armorType) {
return MAG_REDUCE[armorType] * this.magicResistance;
}
public int getDamageReductionAmount(int armorType)
{
return this.damageReductionAmountArray[armorType];
public int getDamageReduction(int armorType) {
return this.damageReduction[armorType];
}
public int getArmorEnchantability()
{
public int getArmorEnchantability() {
return this.armorEnchantability;
}

View file

@ -71,6 +71,13 @@ public enum CheatTab
return Items.flint_and_steel;
}
},
tabLiquids("Flüssigkeiten")
{
protected Item getTabIconItem()
{
return Items.water_bucket;
}
},
tabCombat("Kampf")
{
protected Item getTabIconItem()

View file

@ -92,7 +92,7 @@ public class ItemArmor extends Item
this.texture = texture;
this.armorType = armorType;
// this.renderIndex = renderIndex;
this.damageReduceAmount = material.getDamageReductionAmount(armorType);
this.damageReduceAmount = material.getDamageReduction(armorType);
this.setMaxDamage(material.getDurability(armorType));
this.maxStackSize = 1;
this.setTab(CheatTab.tabCombat);

View file

@ -104,7 +104,7 @@ public class ItemBucket extends Item
this.maxStackSize = liquid == null ? 16 : 1;
this.liquid = liquid;
this.recursive = recursive;
this.setTab(CheatTab.tabTools);
this.setTab(liquid == null ? CheatTab.tabTools : CheatTab.tabLiquids);
// if(!empty)
// this.setHasSubtypes(true);
}

View file

@ -20,7 +20,7 @@ public class ItemHoe extends Item
{
this.theToolMaterial = material;
this.maxStackSize = 1;
this.setMaxDamage(material.getMaxUses());
this.setMaxDamage(material.getDurability());
this.setTab(CheatTab.tabTools);
}

View file

@ -15,7 +15,7 @@ public class ItemShears extends Item
public ItemShears(ToolMaterial material)
{
this.setMaxStackSize(1);
this.setMaxDamage(material.getMaxUses() - 12);
this.setMaxDamage(material.getDurability() - 12);
this.setTab(CheatTab.tabTools);
this.material = material;
}
@ -40,7 +40,7 @@ public class ItemShears extends Item
public float getStrVsBlock(ItemStack stack, Block state)
{
return state.getShearsEfficiency() <= 0 ? 1.0F : (((float)state.getShearsEfficiency()) * (this.material.getEfficiencyOnProperMaterial() - 1.0F));
return state.getShearsEfficiency() <= 0 ? 1.0F : (((float)state.getShearsEfficiency()) * (this.material.getEfficiency() - 1.0F));
// state != Blocks.web && state.getMaterial() != Material.leaves ? (state == Blocks.wool ? 5.0F : super.getStrVsBlock(stack, state)) : 15.0F;
}

View file

@ -26,9 +26,9 @@ public class ItemSword extends Item
{
this.material = material;
this.maxStackSize = 1;
this.setMaxDamage(material.getMaxUses());
this.setMaxDamage(material.getDurability());
this.setTab(CheatTab.tabCombat);
this.attackDamage = 4 + material.getDamageVsEntity();
this.attackDamage = 4 + material.getDamage();
}
/**
@ -36,7 +36,7 @@ public class ItemSword extends Item
*/
public int getDamageVsEntity()
{
return this.material.getDamageVsEntity();
return this.material.getDamage();
}
public ToolMaterial getToolMaterial()

View file

@ -30,9 +30,9 @@ public abstract class ItemTool extends Item
this.toolMaterial = material;
// this.effectiveBlocks = effectiveBlocks;
this.maxStackSize = 1;
this.setMaxDamage(material.getMaxUses());
this.efficiencyOnProperMaterial = material.getEfficiencyOnProperMaterial();
this.damageVsEntity = attackDamage + material.getDamageVsEntity();
this.setMaxDamage(material.getDurability());
this.efficiencyOnProperMaterial = material.getEfficiency();
this.damageVsEntity = attackDamage + material.getDamage();
this.setTab(CheatTab.tabTools);
}

View file

@ -23,7 +23,7 @@ public class S35PacketUpdateTileEntity implements Packet<IClientPlayer>
public S35PacketUpdateTileEntity(TileEntity tile)
{
this.blockPos = tile.getPos();
this.type = TileRegistry.classToIdMap.get(tile.getClass());
this.type = TileRegistry.CLASS_TO_ID.get(tile.getClass());
tile.writeToNBT(this.nbt = new NBTTagCompound());
}
@ -62,7 +62,7 @@ public class S35PacketUpdateTileEntity implements Packet<IClientPlayer>
public boolean isTileEntityType(TileEntity tile)
{
return this.type == TileRegistry.classToIdMap.get(tile.getClass());
return this.type == TileRegistry.CLASS_TO_ID.get(tile.getClass());
}
public NBTTagCompound getNbtCompound()

View file

@ -59,7 +59,7 @@ public abstract class TileEntity
public void writeToNBT(NBTTagCompound compound)
{
String s = (String)TileRegistry.classToNameMap.get(this.getClass());
String s = (String)TileRegistry.CLASS_TO_NAME.get(this.getClass());
if (s == null)
{
@ -83,7 +83,7 @@ public abstract class TileEntity
try
{
Class <? extends TileEntity > oclass = (Class)TileRegistry.nameToClassMap.get(nbt.getString("id"));
Class <? extends TileEntity > oclass = (Class)TileRegistry.NAME_TO_CLASS.get(nbt.getString("id"));
if (oclass != null)
{

View file

@ -212,7 +212,7 @@ public abstract class Converter {
}
private static void mapTile(Class<? extends TileEntity> clazz, String ... names) {
String name = TileRegistry.classToNameMap.get(clazz);
String name = TileRegistry.CLASS_TO_NAME.get(clazz);
for(String oldname : names) {
TILE_MAP.put(oldname, name);
}