diff --git a/src/client/java/minicraft/item/Recipes.java b/src/client/java/minicraft/item/Recipes.java index 534561380..2ad9218c7 100644 --- a/src/client/java/minicraft/item/Recipes.java +++ b/src/client/java/minicraft/item/Recipes.java @@ -1,140 +1,144 @@ -package minicraft.item; - -import java.util.ArrayList; - -public class Recipes { - - public static final ArrayList anvilRecipes = new ArrayList<>(); - public static final ArrayList ovenRecipes = new ArrayList<>(); - public static final ArrayList furnaceRecipes = new ArrayList<>(); - public static final ArrayList workbenchRecipes = new ArrayList<>(); - public static final ArrayList enchantRecipes = new ArrayList<>(); - public static final ArrayList craftRecipes = new ArrayList<>(); - public static final ArrayList loomRecipes = new ArrayList<>(); - - static { - craftRecipes.add(new Recipe("Workbench_1", "Wood_10")); - craftRecipes.add(new Recipe("Torch_2", "Wood_1", "coal_1")); - craftRecipes.add(new Recipe("plank_2", "Wood_1")); - craftRecipes.add(new Recipe("Plank Wall_1", "plank_3")); - craftRecipes.add(new Recipe("Wood Door_1", "plank_5")); - - workbenchRecipes.add(new Recipe("Workbench_1", "Wood_10")); - workbenchRecipes.add(new Recipe("Torch_2", "Wood_1", "coal_1")); - workbenchRecipes.add(new Recipe("plank_2", "Wood_1")); - workbenchRecipes.add(new Recipe("Plank Wall_1", "plank_3")); - workbenchRecipes.add(new Recipe("Wood Door_1", "plank_5")); - workbenchRecipes.add(new Recipe("Lantern_1", "Wood_8", "slime_4", "glass_3")); - workbenchRecipes.add(new Recipe("Stone Brick_1", "Stone_2")); - workbenchRecipes.add(new Recipe("Ornate Stone_1", "Stone_2")); - workbenchRecipes.add(new Recipe("Stone Wall_1", "Stone Brick_3")); - workbenchRecipes.add(new Recipe("Stone Door_1", "Stone Brick_5")); - workbenchRecipes.add(new Recipe("Obsidian Brick_1", "Raw Obsidian_2")); - workbenchRecipes.add(new Recipe("Ornate Obsidian_1", "Raw Obsidian_2")); - workbenchRecipes.add(new Recipe("Obsidian Wall_1", "Obsidian Brick_3")); - workbenchRecipes.add(new Recipe("Obsidian Door_1", "Obsidian Brick_5")); - workbenchRecipes.add(new Recipe("Oven_1", "Stone_15")); - workbenchRecipes.add(new Recipe("Furnace_1", "Stone_20")); - workbenchRecipes.add(new Recipe("Enchanter_1", "Wood_5", "String_2", "Lapis_10")); - workbenchRecipes.add(new Recipe("Chest_1", "Wood_20")); - workbenchRecipes.add(new Recipe("Anvil_1", "iron_5")); - workbenchRecipes.add(new Recipe("Tnt_1", "Gunpowder_10", "Sand_8")); - workbenchRecipes.add(new Recipe("Loom_1", "Wood_10", "Wool_5")); - workbenchRecipes.add(new Recipe("Wood Fishing Rod_1", "Wood_10", "String_3")); - workbenchRecipes.add(new Recipe("Iron Fishing Rod_1", "Iron_10", "String_3")); - workbenchRecipes.add(new Recipe("Gold Fishing Rod_1", "Gold_10", "String_3")); - workbenchRecipes.add(new Recipe("Gem Fishing Rod_1", "Gem_10", "String_3")); - - workbenchRecipes.add(new Recipe("Wood Sword_1", "Wood_5")); - workbenchRecipes.add(new Recipe("Wood Axe_1", "Wood_5")); - workbenchRecipes.add(new Recipe("Wood Hoe_1", "Wood_5")); - workbenchRecipes.add(new Recipe("Wood Pickaxe_1", "Wood_5")); - workbenchRecipes.add(new Recipe("Wood Shovel_1", "Wood_5")); - workbenchRecipes.add(new Recipe("Wood Bow_1", "Wood_5", "string_2")); - workbenchRecipes.add(new Recipe("Rock Sword_1", "Wood_5", "Stone_5")); - workbenchRecipes.add(new Recipe("Rock Axe_1", "Wood_5", "Stone_5")); - workbenchRecipes.add(new Recipe("Rock Hoe_1", "Wood_5", "Stone_5")); - workbenchRecipes.add(new Recipe("Rock Pickaxe_1", "Wood_5", "Stone_5")); - workbenchRecipes.add(new Recipe("Rock Shovel_1", "Wood_5", "Stone_5")); - workbenchRecipes.add(new Recipe("Rock Bow_1", "Wood_5", "Stone_5", "string_2")); - - workbenchRecipes.add(new Recipe("arrow_3", "Wood_2", "Stone_2")); - workbenchRecipes.add(new Recipe("Leather Armor_1", "leather_10")); - workbenchRecipes.add(new Recipe("Snake Armor_1", "scale_15")); - - loomRecipes.add(new Recipe("String_2", "Wool_1")); - loomRecipes.add(new Recipe("red wool_1", "Wool_1", "rose_1")); - loomRecipes.add(new Recipe("blue wool_1", "Wool_1", "Lapis_1")); - loomRecipes.add(new Recipe("green wool_1", "Wool_1", "Cactus_1")); - loomRecipes.add(new Recipe("yellow wool_1", "Wool_1", "Flower_1")); - loomRecipes.add(new Recipe("black wool_1", "Wool_1", "coal_1")); - loomRecipes.add(new Recipe("Bed_1", "Wood_5", "Wool_3")); - - loomRecipes.add(new Recipe("blue clothes_1", "cloth_5", "Lapis_1")); - loomRecipes.add(new Recipe("green clothes_1", "cloth_5", "Cactus_1")); - loomRecipes.add(new Recipe("yellow clothes_1", "cloth_5", "Flower_1")); - loomRecipes.add(new Recipe("black clothes_1", "cloth_5", "coal_1")); - loomRecipes.add(new Recipe("orange clothes_1", "cloth_5", "rose_1", "Flower_1")); - loomRecipes.add(new Recipe("purple clothes_1", "cloth_5", "Lapis_1", "rose_1")); - loomRecipes.add(new Recipe("cyan clothes_1", "cloth_5", "Lapis_1", "Cactus_1")); - loomRecipes.add(new Recipe("reg clothes_1", "cloth_5")); - - loomRecipes.add(new Recipe("Leather Armor_1", "leather_10")); - - anvilRecipes.add(new Recipe("Iron Armor_1", "iron_10")); - anvilRecipes.add(new Recipe("Gold Armor_1", "gold_10")); - anvilRecipes.add(new Recipe("Gem Armor_1", "gem_65")); - anvilRecipes.add(new Recipe("Empty Bucket_1", "iron_5")); - anvilRecipes.add(new Recipe("Iron Lantern_1", "iron_8", "slime_5", "glass_4")); - anvilRecipes.add(new Recipe("Gold Lantern_1", "gold_10", "slime_5", "glass_4")); - anvilRecipes.add(new Recipe("Iron Sword_1", "Wood_5", "iron_5")); - anvilRecipes.add(new Recipe("Iron Claymore_1", "Iron Sword_1", "shard_15")); - anvilRecipes.add(new Recipe("Iron Axe_1", "Wood_5", "iron_5")); - anvilRecipes.add(new Recipe("Iron Hoe_1", "Wood_5", "iron_5")); - anvilRecipes.add(new Recipe("Iron Pickaxe_1", "Wood_5", "iron_5")); - anvilRecipes.add(new Recipe("Iron Shovel_1", "Wood_5", "iron_5")); - anvilRecipes.add(new Recipe("Iron Bow_1", "Wood_5", "iron_5", "string_2")); - anvilRecipes.add(new Recipe("Gold Sword_1", "Wood_5", "gold_5")); - anvilRecipes.add(new Recipe("Gold Claymore_1", "Gold Sword_1", "shard_15")); - anvilRecipes.add(new Recipe("Gold Axe_1", "Wood_5", "gold_5")); - anvilRecipes.add(new Recipe("Gold Hoe_1", "Wood_5", "gold_5")); - anvilRecipes.add(new Recipe("Gold Pickaxe_1", "Wood_5", "gold_5")); - anvilRecipes.add(new Recipe("Gold Shovel_1", "Wood_5", "gold_5")); - anvilRecipes.add(new Recipe("Gold Bow_1", "Wood_5", "gold_5", "string_2")); - anvilRecipes.add(new Recipe("Gem Sword_1", "Wood_5", "gem_50")); - anvilRecipes.add(new Recipe("Gem Claymore_1", "Gem Sword_1", "shard_15")); - anvilRecipes.add(new Recipe("Gem Axe_1", "Wood_5", "gem_50")); - anvilRecipes.add(new Recipe("Gem Hoe_1", "Wood_5", "gem_50")); - anvilRecipes.add(new Recipe("Gem Pickaxe_1", "Wood_5", "gem_50")); - anvilRecipes.add(new Recipe("Gem Shovel_1", "Wood_5", "gem_50")); - anvilRecipes.add(new Recipe("Gem Bow_1", "Wood_5", "gem_50", "string_2")); - anvilRecipes.add(new Recipe("Shears_1", "Iron_4")); - anvilRecipes.add(new Recipe("Watering Can_1", "Iron_3")); - - furnaceRecipes.add(new Recipe("iron_1", "iron Ore_4", "coal_1")); - furnaceRecipes.add(new Recipe("gold_1", "gold Ore_4", "coal_1")); - furnaceRecipes.add(new Recipe("glass_1", "sand_4", "coal_1")); - furnaceRecipes.add(new Recipe("glass bottle_1", "glass_3")); - - ovenRecipes.add(new Recipe("cooked pork_1", "raw pork_1", "coal_1")); - ovenRecipes.add(new Recipe("steak_1", "raw beef_1", "coal_1")); - ovenRecipes.add(new Recipe("cooked fish_1", "raw fish_1", "coal_1")); - ovenRecipes.add(new Recipe("bread_1", "wheat_4")); - ovenRecipes.add(new Recipe("Baked Potato_1", "Potato_1")); - - enchantRecipes.add(new Recipe("Gold Apple_1", "apple_1", "gold_8")); - enchantRecipes.add(new Recipe("awkward potion_1", "glass bottle_1", "Lapis_3")); - enchantRecipes.add(new Recipe("speed potion_1", "awkward potion_1", "Cactus_5")); - enchantRecipes.add(new Recipe("light potion_1", "awkward potion_1", "slime_5")); - enchantRecipes.add(new Recipe("swim potion_1", "awkward potion_1", "raw fish_5")); - enchantRecipes.add(new Recipe("haste potion_1", "awkward potion_1", "Wood_5", "Stone_5")); - enchantRecipes.add(new Recipe("lava potion_1", "awkward potion_1", "Lava Bucket_1")); - enchantRecipes.add(new Recipe("energy potion_1", "awkward potion_1", "gem_25")); - enchantRecipes.add(new Recipe("regen potion_1", "awkward potion_1", "Gold Apple_1")); - enchantRecipes.add(new Recipe("Health Potion_1", "awkward potion_1", "GunPowder_2", "Leather Armor_1")); - enchantRecipes.add(new Recipe("Escape Potion_1", "awkward potion_1", "GunPowder_3", "Lapis_7")); - enchantRecipes.add(new Recipe("Totem of Air_1", "gold_10", "gem_10", "Lapis_5", "Cloud Ore_5")); - enchantRecipes.add(new Recipe("Obsidian Poppet_1", "gold_10", "gem_10", "Lapis_5", "Shard_15")); - enchantRecipes.add(new Recipe("Arcane Fertilizer_3", "Lapis_6", "Bone_2")); - } -} +package minicraft.item; + +import java.util.ArrayList; + +public class Recipes { + + public static final ArrayList anvilRecipes = new ArrayList<>(); + public static final ArrayList ovenRecipes = new ArrayList<>(); + public static final ArrayList furnaceRecipes = new ArrayList<>(); + public static final ArrayList workbenchRecipes = new ArrayList<>(); + public static final ArrayList enchantRecipes = new ArrayList<>(); + public static final ArrayList craftRecipes = new ArrayList<>(); + public static final ArrayList loomRecipes = new ArrayList<>(); + + static { + craftRecipes.add(new Recipe("Workbench_1", "Wood_10")); + craftRecipes.add(new Recipe("Torch_2", "Wood_1", "coal_1")); + craftRecipes.add(new Recipe("plank_2", "Wood_1")); + craftRecipes.add(new Recipe("Plank Wall_1", "plank_3")); + craftRecipes.add(new Recipe("Wood Door_1", "plank_5")); + craftRecipes.add(new Recipe("Wood Fence_1", "plank_3")); + + workbenchRecipes.add(new Recipe("Workbench_1", "Wood_10")); + workbenchRecipes.add(new Recipe("Torch_2", "Wood_1", "coal_1")); + workbenchRecipes.add(new Recipe("plank_2", "Wood_1")); + workbenchRecipes.add(new Recipe("Plank Wall_1", "plank_3")); + workbenchRecipes.add(new Recipe("Wood Door_1", "plank_5")); + workbenchRecipes.add(new Recipe("Wood Fence_1", "plank_3")); + workbenchRecipes.add(new Recipe("Lantern_1", "Wood_8", "slime_4", "glass_3")); + workbenchRecipes.add(new Recipe("Stone Brick_1", "Stone_2")); + workbenchRecipes.add(new Recipe("Ornate Stone_1", "Stone_2")); + workbenchRecipes.add(new Recipe("Stone Wall_1", "Stone Brick_3")); + workbenchRecipes.add(new Recipe("Stone Door_1", "Stone Brick_5")); + workbenchRecipes.add(new Recipe("Stone Fence_1", "Stone Brick_3")); + workbenchRecipes.add(new Recipe("Obsidian Brick_1", "Raw Obsidian_2")); + workbenchRecipes.add(new Recipe("Ornate Obsidian_1", "Raw Obsidian_2")); + workbenchRecipes.add(new Recipe("Obsidian Wall_1", "Obsidian Brick_3")); + workbenchRecipes.add(new Recipe("Obsidian Door_1", "Obsidian Brick_5")); + workbenchRecipes.add(new Recipe("Obsidian Fence_1", "Obsidian Brick_3")); + workbenchRecipes.add(new Recipe("Oven_1", "Stone_15")); + workbenchRecipes.add(new Recipe("Furnace_1", "Stone_20")); + workbenchRecipes.add(new Recipe("Enchanter_1", "Wood_5", "String_2", "Lapis_10")); + workbenchRecipes.add(new Recipe("Chest_1", "Wood_20")); + workbenchRecipes.add(new Recipe("Anvil_1", "iron_5")); + workbenchRecipes.add(new Recipe("Tnt_1", "Gunpowder_10", "Sand_8")); + workbenchRecipes.add(new Recipe("Loom_1", "Wood_10", "Wool_5")); + workbenchRecipes.add(new Recipe("Wood Fishing Rod_1", "Wood_10", "String_3")); + workbenchRecipes.add(new Recipe("Iron Fishing Rod_1", "Iron_10", "String_3")); + workbenchRecipes.add(new Recipe("Gold Fishing Rod_1", "Gold_10", "String_3")); + workbenchRecipes.add(new Recipe("Gem Fishing Rod_1", "Gem_10", "String_3")); + + workbenchRecipes.add(new Recipe("Wood Sword_1", "Wood_5")); + workbenchRecipes.add(new Recipe("Wood Axe_1", "Wood_5")); + workbenchRecipes.add(new Recipe("Wood Hoe_1", "Wood_5")); + workbenchRecipes.add(new Recipe("Wood Pickaxe_1", "Wood_5")); + workbenchRecipes.add(new Recipe("Wood Shovel_1", "Wood_5")); + workbenchRecipes.add(new Recipe("Wood Bow_1", "Wood_5", "string_2")); + workbenchRecipes.add(new Recipe("Rock Sword_1", "Wood_5", "Stone_5")); + workbenchRecipes.add(new Recipe("Rock Axe_1", "Wood_5", "Stone_5")); + workbenchRecipes.add(new Recipe("Rock Hoe_1", "Wood_5", "Stone_5")); + workbenchRecipes.add(new Recipe("Rock Pickaxe_1", "Wood_5", "Stone_5")); + workbenchRecipes.add(new Recipe("Rock Shovel_1", "Wood_5", "Stone_5")); + workbenchRecipes.add(new Recipe("Rock Bow_1", "Wood_5", "Stone_5", "string_2")); + + workbenchRecipes.add(new Recipe("arrow_3", "Wood_2", "Stone_2")); + workbenchRecipes.add(new Recipe("Leather Armor_1", "leather_10")); + workbenchRecipes.add(new Recipe("Snake Armor_1", "scale_15")); + + loomRecipes.add(new Recipe("String_2", "Wool_1")); + loomRecipes.add(new Recipe("red wool_1", "Wool_1", "rose_1")); + loomRecipes.add(new Recipe("blue wool_1", "Wool_1", "Lapis_1")); + loomRecipes.add(new Recipe("green wool_1", "Wool_1", "Cactus_1")); + loomRecipes.add(new Recipe("yellow wool_1", "Wool_1", "Flower_1")); + loomRecipes.add(new Recipe("black wool_1", "Wool_1", "coal_1")); + loomRecipes.add(new Recipe("Bed_1", "Wood_5", "Wool_3")); + + loomRecipes.add(new Recipe("blue clothes_1", "cloth_5", "Lapis_1")); + loomRecipes.add(new Recipe("green clothes_1", "cloth_5", "Cactus_1")); + loomRecipes.add(new Recipe("yellow clothes_1", "cloth_5", "Flower_1")); + loomRecipes.add(new Recipe("black clothes_1", "cloth_5", "coal_1")); + loomRecipes.add(new Recipe("orange clothes_1", "cloth_5", "rose_1", "Flower_1")); + loomRecipes.add(new Recipe("purple clothes_1", "cloth_5", "Lapis_1", "rose_1")); + loomRecipes.add(new Recipe("cyan clothes_1", "cloth_5", "Lapis_1", "Cactus_1")); + loomRecipes.add(new Recipe("reg clothes_1", "cloth_5")); + + loomRecipes.add(new Recipe("Leather Armor_1", "leather_10")); + + anvilRecipes.add(new Recipe("Iron Armor_1", "iron_10")); + anvilRecipes.add(new Recipe("Gold Armor_1", "gold_10")); + anvilRecipes.add(new Recipe("Gem Armor_1", "gem_65")); + anvilRecipes.add(new Recipe("Empty Bucket_1", "iron_5")); + anvilRecipes.add(new Recipe("Iron Lantern_1", "iron_8", "slime_5", "glass_4")); + anvilRecipes.add(new Recipe("Gold Lantern_1", "gold_10", "slime_5", "glass_4")); + anvilRecipes.add(new Recipe("Iron Sword_1", "Wood_5", "iron_5")); + anvilRecipes.add(new Recipe("Iron Claymore_1", "Iron Sword_1", "shard_15")); + anvilRecipes.add(new Recipe("Iron Axe_1", "Wood_5", "iron_5")); + anvilRecipes.add(new Recipe("Iron Hoe_1", "Wood_5", "iron_5")); + anvilRecipes.add(new Recipe("Iron Pickaxe_1", "Wood_5", "iron_5")); + anvilRecipes.add(new Recipe("Iron Shovel_1", "Wood_5", "iron_5")); + anvilRecipes.add(new Recipe("Iron Bow_1", "Wood_5", "iron_5", "string_2")); + anvilRecipes.add(new Recipe("Gold Sword_1", "Wood_5", "gold_5")); + anvilRecipes.add(new Recipe("Gold Claymore_1", "Gold Sword_1", "shard_15")); + anvilRecipes.add(new Recipe("Gold Axe_1", "Wood_5", "gold_5")); + anvilRecipes.add(new Recipe("Gold Hoe_1", "Wood_5", "gold_5")); + anvilRecipes.add(new Recipe("Gold Pickaxe_1", "Wood_5", "gold_5")); + anvilRecipes.add(new Recipe("Gold Shovel_1", "Wood_5", "gold_5")); + anvilRecipes.add(new Recipe("Gold Bow_1", "Wood_5", "gold_5", "string_2")); + anvilRecipes.add(new Recipe("Gem Sword_1", "Wood_5", "gem_50")); + anvilRecipes.add(new Recipe("Gem Claymore_1", "Gem Sword_1", "shard_15")); + anvilRecipes.add(new Recipe("Gem Axe_1", "Wood_5", "gem_50")); + anvilRecipes.add(new Recipe("Gem Hoe_1", "Wood_5", "gem_50")); + anvilRecipes.add(new Recipe("Gem Pickaxe_1", "Wood_5", "gem_50")); + anvilRecipes.add(new Recipe("Gem Shovel_1", "Wood_5", "gem_50")); + anvilRecipes.add(new Recipe("Gem Bow_1", "Wood_5", "gem_50", "string_2")); + anvilRecipes.add(new Recipe("Shears_1", "Iron_4")); + anvilRecipes.add(new Recipe("Watering Can_1", "Iron_3")); + + furnaceRecipes.add(new Recipe("iron_1", "iron Ore_4", "coal_1")); + furnaceRecipes.add(new Recipe("gold_1", "gold Ore_4", "coal_1")); + furnaceRecipes.add(new Recipe("glass_1", "sand_4", "coal_1")); + furnaceRecipes.add(new Recipe("glass bottle_1", "glass_3")); + + ovenRecipes.add(new Recipe("cooked pork_1", "raw pork_1", "coal_1")); + ovenRecipes.add(new Recipe("steak_1", "raw beef_1", "coal_1")); + ovenRecipes.add(new Recipe("cooked fish_1", "raw fish_1", "coal_1")); + ovenRecipes.add(new Recipe("bread_1", "wheat_4")); + ovenRecipes.add(new Recipe("Baked Potato_1", "Potato_1")); + + enchantRecipes.add(new Recipe("Gold Apple_1", "apple_1", "gold_8")); + enchantRecipes.add(new Recipe("awkward potion_1", "glass bottle_1", "Lapis_3")); + enchantRecipes.add(new Recipe("speed potion_1", "awkward potion_1", "Cactus_5")); + enchantRecipes.add(new Recipe("light potion_1", "awkward potion_1", "slime_5")); + enchantRecipes.add(new Recipe("swim potion_1", "awkward potion_1", "raw fish_5")); + enchantRecipes.add(new Recipe("haste potion_1", "awkward potion_1", "Wood_5", "Stone_5")); + enchantRecipes.add(new Recipe("lava potion_1", "awkward potion_1", "Lava Bucket_1")); + enchantRecipes.add(new Recipe("energy potion_1", "awkward potion_1", "gem_25")); + enchantRecipes.add(new Recipe("regen potion_1", "awkward potion_1", "Gold Apple_1")); + enchantRecipes.add(new Recipe("Health Potion_1", "awkward potion_1", "GunPowder_2", "Leather Armor_1")); + enchantRecipes.add(new Recipe("Escape Potion_1", "awkward potion_1", "GunPowder_3", "Lapis_7")); + enchantRecipes.add(new Recipe("Totem of Air_1", "gold_10", "gem_10", "Lapis_5","Cloud Ore_5")); + enchantRecipes.add(new Recipe("Obsidian Poppet_1", "gold_10", "gem_10", "Lapis_5","Shard_15")); + enchantRecipes.add(new Recipe("Arcane Fertilizer_3", "Lapis_6", "Bone_2")); + } +} diff --git a/src/client/java/minicraft/item/TileItem.java b/src/client/java/minicraft/item/TileItem.java index dad79ffee..ffa1a91d7 100644 --- a/src/client/java/minicraft/item/TileItem.java +++ b/src/client/java/minicraft/item/TileItem.java @@ -35,16 +35,19 @@ protected static ArrayList getAllInstances() { items.add(new TileItem("Plank", new LinkedSprite(SpriteType.Item, "plank"), new TileModel("Wood Planks"), "hole", "water", "cloud")); items.add(new TileItem("Plank Wall", new LinkedSprite(SpriteType.Item, "plank_wall"), new TileModel("Wood Wall"), "Wood Planks")); items.add(new TileItem("Wood Door", new LinkedSprite(SpriteType.Item, "wood_door"), new TileModel("Wood Door"), "Wood Planks")); + items.add(new TileItem("Wood Fence", new LinkedSprite(SpriteType.Item, "wood_fence"), new TileModel("Wood Fence"), "grass")); items.add(new TileItem("Stone", new LinkedSprite(SpriteType.Item, "stone"), new TileModel("Stone"), "hole", "water", "cloud", "lava")); items.add(new TileItem("Stone Brick", new LinkedSprite(SpriteType.Item, "stone_brick"), new TileModel("Stone Bricks"), "hole", "water", "cloud", "lava")); items.add(new TileItem("Ornate Stone", new LinkedSprite(SpriteType.Item, "stone_brick"), new TileModel("Ornate Stone"), "hole", "water", "cloud", "lava")); items.add(new TileItem("Stone Wall", new LinkedSprite(SpriteType.Item, "stone_wall"), new TileModel("Stone Wall"), "Stone Bricks")); items.add(new TileItem("Stone Door", new LinkedSprite(SpriteType.Item, "stone_wall"), new TileModel("Stone Door"), "Stone Bricks")); + items.add(new TileItem("Stone Fence", new LinkedSprite(SpriteType.Item, "stone_fence"), new TileModel("Stone Fence"), "Stone Bricks")); items.add(new TileItem("Raw Obsidian", new LinkedSprite(SpriteType.Item, "obsidian"), new TileModel("Raw Obsidian"), "hole", "water", "cloud", "lava")); items.add(new TileItem("Obsidian Brick", new LinkedSprite(SpriteType.Item, "obsidian_brick"), new TileModel("Obsidian"), "hole", "water", "cloud", "lava")); items.add(new TileItem("Ornate Obsidian", new LinkedSprite(SpriteType.Item, "obsidian_brick"), new TileModel("Ornate Obsidian"),"hole", "water", "cloud", "lava")); items.add(new TileItem("Obsidian Wall", new LinkedSprite(SpriteType.Item, "obsidian_wall"), new TileModel("Obsidian Wall"), "Obsidian")); items.add(new TileItem("Obsidian Door", new LinkedSprite(SpriteType.Item, "obsidian_door"), new TileModel("Obsidian Door"), "Obsidian")); + items.add(new TileItem("Obsidian Fence", new LinkedSprite(SpriteType.Item, "obsidian_fence"), new TileModel("Obsidian Fence"), "Obsidian")); items.add(new TileItem("Wool", new LinkedSprite(SpriteType.Item, "wool"), new TileModel("Wool"), "hole", "water")); items.add(new TileItem("Red Wool", new LinkedSprite(SpriteType.Item, "red_wool"), new TileModel("Red Wool"), "hole", "water")); diff --git a/src/client/java/minicraft/level/tile/FenceTile.java b/src/client/java/minicraft/level/tile/FenceTile.java new file mode 100644 index 000000000..2fd0c3e0d --- /dev/null +++ b/src/client/java/minicraft/level/tile/FenceTile.java @@ -0,0 +1,178 @@ +package minicraft.level.tile; + +import minicraft.core.Game; +import minicraft.core.io.Sound; +import minicraft.entity.Direction; +import minicraft.entity.Entity; +import minicraft.entity.mob.Mob; +import minicraft.entity.mob.Player; +import minicraft.entity.particle.SmashParticle; +import minicraft.entity.particle.TextParticle; +import minicraft.gfx.Color; +import minicraft.gfx.Screen; +import minicraft.gfx.Sprite; +import minicraft.gfx.SpriteAnimation; +import minicraft.gfx.SpriteLinker; +import minicraft.gfx.SpriteLinker.LinkedSprite; +import minicraft.gfx.SpriteLinker.SpriteType; +import minicraft.item.Item; +import minicraft.item.Items; +import minicraft.item.ToolItem; +import minicraft.level.Level; +import minicraft.util.AdvancementElement; +import minicraft.util.Logging; + +public class FenceTile extends Tile { + + private static SpriteAnimation wood = new SpriteAnimation(SpriteType.Tile, "wood_fence"); + private static SpriteAnimation stone = new SpriteAnimation(SpriteType.Tile, "stone_fence"); + private static SpriteAnimation obsidian = new SpriteAnimation(SpriteType.Tile, "obsidian_fence"); + + protected Material type; + + protected SpriteAnimation top, bottom, left, right; + + public boolean connectUp = false, connectDown = false, connectLeft = false, connectRight = false; + + protected FenceTile(Material type) { this(type, null); } + protected FenceTile(Material type, String name) { + super(type.name() + " " + (name == null ? "Fence" : name), null); + this.type = type; + switch (type) + { + case Wood: + sprite = wood; + connectsToGrass = true; + break; + case Stone: + sprite = stone; + break; + case Obsidian: + sprite = obsidian; + break; + } + top = new SpriteAnimation(SpriteType.Tile, type.name().toLowerCase() + "_fence_top"); + bottom = new SpriteAnimation(SpriteType.Tile, type.name().toLowerCase() + "_fence_bottom"); + left = new SpriteAnimation(SpriteType.Tile, type.name().toLowerCase() + "_fence_left"); + right = new SpriteAnimation(SpriteType.Tile, type.name().toLowerCase() + "_fence_right"); + } + + public void updateConnections(Level level, int x, int y) + { + connectUp = level.getTile(x, y - 1).name.equals(name); + connectDown = level.getTile(x, y + 1).name.equals(name); + connectLeft = level.getTile(x - 1, y).name.equals(name); + connectRight = level.getTile(x + 1, y).name.equals(name); + } + + public boolean mayPass(Level level, int x, int y, Entity e) { + return false; + } + + public void render(Screen screen, Level level, int x, int y) + { + switch (type) + { + case Wood: Tiles.get("Grass").render(screen, level, x, y); break; + case Stone: Tiles.get("Stone Bricks").render(screen, level, x, y); break; + case Obsidian: Tiles.get("Obsidian").render(screen, level, x, y); break; + } + + sprite.render(screen, level, x, y); + + updateConnections(level, x, y); + + // up + if (connectUp) { + top.render(screen, level, x, y); + } + // bottom + if (connectDown) { + bottom.render(screen, level, x, y); + } + // left + if (connectLeft) { + left.render(screen, level, x, y); + } + // right + if (connectRight) { + right.render(screen, level, x, y); + } + } + + @Override + public boolean hurt(Level level, int x, int y, Mob source, int dmg, Direction attackDir) { + hurt(level, x, y, dmg); + return true; + } + + @Override + public boolean interact(Level level, int xt, int yt, Player player, Item item, Direction attackDir) { + if(Game.isMode("minicraft.settings.mode.creative")) + return false; // Go directly to hurt method + if (item instanceof ToolItem) { + ToolItem tool = (ToolItem) item; + if (tool.type == type.getRequiredTool()) { + if (player.payStamina(4 - tool.level) && tool.payDurability()) { + int data = level.getData(xt, yt); + hurt(level, xt, yt, tool.getDamage()); + AdvancementElement.AdvancementTrigger.ItemUsedOnTileTrigger.INSTANCE.trigger( + new AdvancementElement.AdvancementTrigger.ItemUsedOnTileTrigger.ItemUsedOnTileTriggerConditionHandler.ItemUsedOnTileTriggerConditions( + item, this, data, xt, yt, level.depth)); + return true; + } + } + } + return false; + } + + public void hurt(Level level, int x, int y, int dmg) { + int damage = level.getData(x, y) + dmg; + int fenceHealth = 5; + if (Game.isMode("minicraft.settings.mode.creative")) dmg = damage = fenceHealth; + + level.add(new SmashParticle(x * 16, y * 16)); + Sound.play("monsterhurt"); + + level.add(new TextParticle("" + dmg, x * 16 + 8, y * 16 + 8, Color.RED)); + + if (damage >= fenceHealth) { + String itemName = "", tilename = ""; + switch (type) { // Get what tile to set and what item to drop + case Wood: { + itemName = "Wood Fence"; + tilename = "Grass"; + break; + } + case Stone: { + itemName = "Stone Fence"; + tilename = "Stone Bricks"; + break; + } + case Obsidian: { + itemName = "Obsidian Fence"; + tilename = "Obsidian"; + break; + } + } + + level.dropItem(x * 16 + 8, y * 16 + 8, 1, 1, Items.get(itemName)); + level.setTile(x, y, Tiles.get(tilename)); + } else { + level.setData(x, y, damage); + } + } + + public boolean tick(Level level, int xt, int yt) { + int damage = level.getData(xt, yt); + if (damage > 0) { + level.setData(xt, yt, damage - 1); + return true; + } + return false; + } + + public String getName(int data) { + return Material.values[data].name() + " Fence"; + } +} diff --git a/src/client/java/minicraft/level/tile/Tiles.java b/src/client/java/minicraft/level/tile/Tiles.java index d138b227a..30856124b 100644 --- a/src/client/java/minicraft/level/tile/Tiles.java +++ b/src/client/java/minicraft/level/tile/Tiles.java @@ -76,6 +76,9 @@ public static void initTileList() { tiles.put((short)47, new BossWallTile()); tiles.put((short)48, new BossFloorTile()); tiles.put((short)49, new BossDoorTile()); + tiles.put((short)50, new FenceTile(Tile.Material.Wood)); + tiles.put((short)51, new FenceTile(Tile.Material.Stone)); + tiles.put((short)52, new FenceTile(Tile.Material.Obsidian)); tiles.put((short)50, new TomatoTile("Tomato")); tiles.put((short)51, new CarrotTile("Carrot")); tiles.put((short)52, new HeavenlyBerriesTile("Heavenly Berries")); diff --git a/src/client/resources/assets/localization/en-us.json b/src/client/resources/assets/localization/en-us.json index e10178853..22a2d1de9 100644 --- a/src/client/resources/assets/localization/en-us.json +++ b/src/client/resources/assets/localization/en-us.json @@ -469,5 +469,8 @@ "Infinite Fall": "Infinite Fall", "Cloud Cactus": "Cloud Cactus", "Raw Obsidian": "Raw Obsidian", - "Totem of Air": "Totem of Air" + "Totem of Air": "Totem of Air", + "Wood Fence": "Wood Fence", + "Stone Fence": "Stone Fence", + "Obsidian Fence": "Obsidian Fence" } diff --git a/src/client/resources/assets/textures/item/obsidian_fence.png b/src/client/resources/assets/textures/item/obsidian_fence.png new file mode 100644 index 000000000..9a7a86e57 Binary files /dev/null and b/src/client/resources/assets/textures/item/obsidian_fence.png differ diff --git a/src/client/resources/assets/textures/item/stone_fence.png b/src/client/resources/assets/textures/item/stone_fence.png new file mode 100644 index 000000000..08b69d230 Binary files /dev/null and b/src/client/resources/assets/textures/item/stone_fence.png differ diff --git a/src/client/resources/assets/textures/item/wood_fence.png b/src/client/resources/assets/textures/item/wood_fence.png new file mode 100644 index 000000000..4e0f48340 Binary files /dev/null and b/src/client/resources/assets/textures/item/wood_fence.png differ diff --git a/src/client/resources/assets/textures/tile/obsidian_fence.png b/src/client/resources/assets/textures/tile/obsidian_fence.png new file mode 100644 index 000000000..726623712 Binary files /dev/null and b/src/client/resources/assets/textures/tile/obsidian_fence.png differ diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_bottom.png b/src/client/resources/assets/textures/tile/obsidian_fence_bottom.png new file mode 100644 index 000000000..1c98de36a Binary files /dev/null and b/src/client/resources/assets/textures/tile/obsidian_fence_bottom.png differ diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_left.png b/src/client/resources/assets/textures/tile/obsidian_fence_left.png new file mode 100644 index 000000000..03b15107e Binary files /dev/null and b/src/client/resources/assets/textures/tile/obsidian_fence_left.png differ diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_right.png b/src/client/resources/assets/textures/tile/obsidian_fence_right.png new file mode 100644 index 000000000..eca4910d0 Binary files /dev/null and b/src/client/resources/assets/textures/tile/obsidian_fence_right.png differ diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_top.png b/src/client/resources/assets/textures/tile/obsidian_fence_top.png new file mode 100644 index 000000000..de2aa9d97 Binary files /dev/null and b/src/client/resources/assets/textures/tile/obsidian_fence_top.png differ diff --git a/src/client/resources/assets/textures/tile/stone_fence.png b/src/client/resources/assets/textures/tile/stone_fence.png new file mode 100644 index 000000000..9df752393 Binary files /dev/null and b/src/client/resources/assets/textures/tile/stone_fence.png differ diff --git a/src/client/resources/assets/textures/tile/stone_fence_bottom.png b/src/client/resources/assets/textures/tile/stone_fence_bottom.png new file mode 100644 index 000000000..5091f520e Binary files /dev/null and b/src/client/resources/assets/textures/tile/stone_fence_bottom.png differ diff --git a/src/client/resources/assets/textures/tile/stone_fence_left.png b/src/client/resources/assets/textures/tile/stone_fence_left.png new file mode 100644 index 000000000..2c52b3695 Binary files /dev/null and b/src/client/resources/assets/textures/tile/stone_fence_left.png differ diff --git a/src/client/resources/assets/textures/tile/stone_fence_right.png b/src/client/resources/assets/textures/tile/stone_fence_right.png new file mode 100644 index 000000000..0fa689d4a Binary files /dev/null and b/src/client/resources/assets/textures/tile/stone_fence_right.png differ diff --git a/src/client/resources/assets/textures/tile/stone_fence_top.png b/src/client/resources/assets/textures/tile/stone_fence_top.png new file mode 100644 index 000000000..725f6a6de Binary files /dev/null and b/src/client/resources/assets/textures/tile/stone_fence_top.png differ diff --git a/src/client/resources/assets/textures/tile/wood_fence.png b/src/client/resources/assets/textures/tile/wood_fence.png new file mode 100644 index 000000000..e714c6788 Binary files /dev/null and b/src/client/resources/assets/textures/tile/wood_fence.png differ diff --git a/src/client/resources/assets/textures/tile/wood_fence_bottom.png b/src/client/resources/assets/textures/tile/wood_fence_bottom.png new file mode 100644 index 000000000..eb91e92cd Binary files /dev/null and b/src/client/resources/assets/textures/tile/wood_fence_bottom.png differ diff --git a/src/client/resources/assets/textures/tile/wood_fence_left.png b/src/client/resources/assets/textures/tile/wood_fence_left.png new file mode 100644 index 000000000..ca1baee05 Binary files /dev/null and b/src/client/resources/assets/textures/tile/wood_fence_left.png differ diff --git a/src/client/resources/assets/textures/tile/wood_fence_right.png b/src/client/resources/assets/textures/tile/wood_fence_right.png new file mode 100644 index 000000000..ae9196037 Binary files /dev/null and b/src/client/resources/assets/textures/tile/wood_fence_right.png differ diff --git a/src/client/resources/assets/textures/tile/wood_fence_top.png b/src/client/resources/assets/textures/tile/wood_fence_top.png new file mode 100644 index 000000000..3a5f0267e Binary files /dev/null and b/src/client/resources/assets/textures/tile/wood_fence_top.png differ diff --git a/src/client/resources/resources/recipes.json b/src/client/resources/resources/recipes.json index 335f7e8c2..aa51e66b6 100644 --- a/src/client/resources/resources/recipes.json +++ b/src/client/resources/resources/recipes.json @@ -142,6 +142,32 @@ } } }, + "minicraft.advancements.recipes.wood_fence": { + "criteria": { + "has_plank": { + "trigger": "inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "plank" + ] + } + ] + } + } + }, + "requirements": [ + [ + "has_plank" + ] + ], + "rewards": { + "recipes": { + "Wood Fence_1": ["plank_3"] + } + } + }, "minicraft.advancements.recipes.lantern": { "criteria": { "has_wood": { @@ -298,6 +324,32 @@ } } }, + "minicraft.advancements.recipes.stone_fence": { + "criteria": { + "has_stone_brick": { + "trigger": "inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "stone brick" + ] + } + ] + } + } + }, + "requirements": [ + [ + "has_stone_brick" + ] + ], + "rewards": { + "recipes": { + "Stone Fence_1": ["Stone Brick_3"] + } + } + }, "minicraft.advancements.recipes.obsidian_brick": { "criteria": { "has_raw_obsidian": { @@ -402,6 +454,32 @@ } } }, + "minicraft.advancements.recipes.obsidian_fence": { + "criteria": { + "has_obsidian_brick": { + "trigger": "inventory_changed", + "conditions": { + "items": [ + { + "items": [ + "obsidian brick" + ] + } + ] + } + } + }, + "requirements": [ + [ + "has_obsidian_brick" + ] + ], + "rewards": { + "recipes": { + "Obsidian Fence_1": ["Obsidian Brick_3"] + } + } + }, "minicraft.advancements.recipes.oven": { "criteria": { "has_stone": {