From 0a98da300cbb6a91694e6313db1d2d501dc0657e Mon Sep 17 00:00:00 2001 From: GameJarne <69422663+GameJarne@users.noreply.github.com> Date: Sat, 30 Sep 2023 12:22:13 +0200 Subject: [PATCH 1/5] fences added fences --- src/client/java/minicraft/item/Recipes.java | 4 + src/client/java/minicraft/item/TileItem.java | 3 + .../java/minicraft/level/tile/FenceTile.java | 166 ++++++++++++++++++ .../java/minicraft/level/tile/Tiles.java | 3 + .../assets/textures/item/obsidian_fence.png | Bin 0 -> 182 bytes .../assets/textures/item/stone_fence.png | Bin 0 -> 171 bytes .../assets/textures/item/wood_fence.png | Bin 0 -> 182 bytes .../assets/textures/tile/obsidian_fence.png | Bin 0 -> 174 bytes .../textures/tile/obsidian_fence_bottom.png | Bin 0 -> 126 bytes .../textures/tile/obsidian_fence_left.png | Bin 0 -> 191 bytes .../textures/tile/obsidian_fence_right.png | Bin 0 -> 156 bytes .../textures/tile/obsidian_fence_up.png | Bin 0 -> 115 bytes .../assets/textures/tile/stone_fence.png | Bin 0 -> 181 bytes .../assets/textures/tile/stone_fence_down.png | Bin 0 -> 115 bytes .../assets/textures/tile/stone_fence_left.png | Bin 0 -> 177 bytes .../textures/tile/stone_fence_right.png | Bin 0 -> 146 bytes .../assets/textures/tile/stone_fence_up.png | Bin 0 -> 111 bytes .../assets/textures/tile/wood_fence.png | Bin 0 -> 174 bytes .../textures/tile/wood_fence_bottom.png | Bin 0 -> 120 bytes .../assets/textures/tile/wood_fence_left.png | Bin 0 -> 179 bytes .../assets/textures/tile/wood_fence_right.png | Bin 0 -> 140 bytes .../assets/textures/tile/wood_fence_top.png | Bin 0 -> 115 bytes src/client/resources/resources/recipes.json | 78 ++++++++ 23 files changed, 254 insertions(+) create mode 100644 src/client/java/minicraft/level/tile/FenceTile.java create mode 100644 src/client/resources/assets/textures/item/obsidian_fence.png create mode 100644 src/client/resources/assets/textures/item/stone_fence.png create mode 100644 src/client/resources/assets/textures/item/wood_fence.png create mode 100644 src/client/resources/assets/textures/tile/obsidian_fence.png create mode 100644 src/client/resources/assets/textures/tile/obsidian_fence_bottom.png create mode 100644 src/client/resources/assets/textures/tile/obsidian_fence_left.png create mode 100644 src/client/resources/assets/textures/tile/obsidian_fence_right.png create mode 100644 src/client/resources/assets/textures/tile/obsidian_fence_up.png create mode 100644 src/client/resources/assets/textures/tile/stone_fence.png create mode 100644 src/client/resources/assets/textures/tile/stone_fence_down.png create mode 100644 src/client/resources/assets/textures/tile/stone_fence_left.png create mode 100644 src/client/resources/assets/textures/tile/stone_fence_right.png create mode 100644 src/client/resources/assets/textures/tile/stone_fence_up.png create mode 100644 src/client/resources/assets/textures/tile/wood_fence.png create mode 100644 src/client/resources/assets/textures/tile/wood_fence_bottom.png create mode 100644 src/client/resources/assets/textures/tile/wood_fence_left.png create mode 100644 src/client/resources/assets/textures/tile/wood_fence_right.png create mode 100644 src/client/resources/assets/textures/tile/wood_fence_top.png diff --git a/src/client/java/minicraft/item/Recipes.java b/src/client/java/minicraft/item/Recipes.java index 725406d9a..80daca00a 100644 --- a/src/client/java/minicraft/item/Recipes.java +++ b/src/client/java/minicraft/item/Recipes.java @@ -18,21 +18,25 @@ public class Recipes { 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")); diff --git a/src/client/java/minicraft/item/TileItem.java b/src/client/java/minicraft/item/TileItem.java index 0212fbdcd..a645dcef0 100644 --- a/src/client/java/minicraft/item/TileItem.java +++ b/src/client/java/minicraft/item/TileItem.java @@ -33,16 +33,19 @@ protected static ArrayList getAllInstances() { items.add(new TileItem("Plank", new LinkedSprite(SpriteType.Item, "plank"), "Wood Planks", "hole", "water", "cloud")); items.add(new TileItem("Plank Wall", new LinkedSprite(SpriteType.Item, "plank_wall"), "Wood Wall", "Wood Planks")); items.add(new TileItem("Wood Door", new LinkedSprite(SpriteType.Item, "wood_door"), "Wood Door", "Wood Planks")); + items.add(new TileItem("Wood Fence", new LinkedSprite(SpriteType.Item, "wood_fence"), "Wood Fence", "grass")); items.add(new TileItem("Stone", new LinkedSprite(SpriteType.Item, "stone"), "Stone", "hole", "water", "cloud", "lava")); items.add(new TileItem("Stone Brick", new LinkedSprite(SpriteType.Item, "stone_brick"), "Stone Bricks", "hole", "water", "cloud", "lava")); items.add(new TileItem("Ornate Stone", new LinkedSprite(SpriteType.Item, "stone_brick"), "Ornate Stone", "hole", "water", "cloud", "lava")); items.add(new TileItem("Stone Wall", new LinkedSprite(SpriteType.Item, "stone_wall"), "Stone Wall", "Stone Bricks")); items.add(new TileItem("Stone Door", new LinkedSprite(SpriteType.Item, "stone_wall"), "Stone Door", "Stone Bricks")); + items.add(new TileItem("Stone Fence", new LinkedSprite(SpriteType.Item, "stone_fence"), "Stone Fence", "Stone Bricks")); items.add(new TileItem("Raw Obsidian", new LinkedSprite(SpriteType.Item, "obsidian"), "Raw Obsidian", "hole", "water", "cloud", "lava")); items.add(new TileItem("Obsidian Brick", new LinkedSprite(SpriteType.Item, "obsidian_brick"), "Obsidian", "hole", "water", "cloud", "lava")); items.add(new TileItem("Ornate Obsidian", new LinkedSprite(SpriteType.Item, "obsidian_brick"), "Ornate Obsidian","hole", "water", "cloud", "lava")); items.add(new TileItem("Obsidian Wall", new LinkedSprite(SpriteType.Item, "obsidian_wall"), "Obsidian Wall", "Obsidian")); items.add(new TileItem("Obsidian Door", new LinkedSprite(SpriteType.Item, "obsidian_door"), "Obsidian Door", "Obsidian")); + items.add(new TileItem("Obsidian Fence", new LinkedSprite(SpriteType.Item, "obsidian_fence"), "Obsidian Fence", "Obsidian")); items.add(new TileItem("Wool", new LinkedSprite(SpriteType.Item, "wool"), "Wool", "hole", "water")); items.add(new TileItem("Red Wool", new LinkedSprite(SpriteType.Item, "red_wool"), "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..6897d1dc1 --- /dev/null +++ b/src/client/java/minicraft/level/tile/FenceTile.java @@ -0,0 +1,166 @@ +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; + + 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 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); + + // up + if (level.getTile(x, y - 1).name.equals(name)) { + top.render(screen, level, x, y); + } + // bottom + if (level.getTile(x, y + 1).name.equals(name)) { + bottom.render(screen, level, x, y); + } + // left + if (level.getTile(x - 1, y).name.equals(name)) { + left.render(screen, level, x, y); + } + // right + if (level.getTile(x + 1, y).name.equals(name)) { + 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 c5106a385..01e7ee87d 100644 --- a/src/client/java/minicraft/level/tile/Tiles.java +++ b/src/client/java/minicraft/level/tile/Tiles.java @@ -72,6 +72,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)); // WARNING: don't use this tile for anything! tiles.put((short)255, new ConnectTile()); 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 0000000000000000000000000000000000000000..9a7a86e5795634c71ed41dca4ea23fa1e9718e84 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|3OrpLLnNm5 z_8W3F7znVa2RhX>wEAAK+kayB-`2fJlMk_LI4z2`IC|*iyJ^ySjt_1Z{4|RxTAs3E zHDALVrOReo466FS(ijqMK2KWlJ1xPMzo=`?^FXH9Qj6q^dkT)(J&SrZXXDXH!6`TE eZGJvj{fyV_nod}->Y)Un-3*?telF{r5}E)cuSH-0 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..08b69d2306448b5ff9ab2bede5000b29eee5ddbf GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|QaxQ9LnNl= z_HPtqQRHF%Ubo`-#;%2Y;*PQ*k2-Gfemux)Ur>K4=kzVXoJl6CzV}oz-H!Bh91i)W zXxz`<5R`rNOhNgXH|ZH`C(f*yx5Acn!IyjekG%@N-!?e5L#)_+&ENRR>1Xwi)#y&h T^b-;WTFBt(>gTe~DWM4fDF8ph literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..4e0f48340ba8f2273e928964a6fd36f216a2e85e GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|3OrpLLnNjq zCpa*@{5S3Y<-fZBmAf}8c(=J`9N6(cJQd9=@7tULZVUOR0-Q zg4Nbimj_*kluRT*+!+!V7&hgt3CnohVX!8ukolpz=EC2ui literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..78b431ef7c4e96235af8fce660be44a6e035fcb5 GIT binary patch literal 174 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|GCW-zLo9le z6C^SYbohSw|NlSFt|Yzx6OZcczjgS;iH?Up>zQ69l zBqv6n9V$<5SUfQ4@twqYgsF>HL4vL25YuwT6aS8-pAg_+-W2PQW3|9SKY)jUtxe%l TlYi)Spq&h!u6{1-oD!MZh literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..cd2535b51adcfaa0098f1a70d0367b1cb987507e GIT binary patch literal 126 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|EIeHtLo9le z6C_wG8v9m!u9ppb{{P1ngGZOw99Vhc01$k5@VmB6d;RyM(9!PC{xWt~$(697-%E6xA_ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..a5d8a4037e15e8a3ba46639aa8193349d131c2f9 GIT binary patch literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Dm`5sLo9le z6C_xBtQMX7f01?lo_nV~)-dXD&FSLlult)YA^EX`ghLZ|gxud>2M+)N!(vZXo&W#r z)V-B?4F3J^7i8h->2YCaWbR%!gL@e#56=;HCE?8~7q=xc`xNEK@EDvqaG*g*+GXd1 mgWrE^F!ApTezIU82gBSnspW^?t3(1F!QkoY=d#Wzp$P!j7(=E2 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..3b2e025a9d5b8cd3143d204322ef19b40f5371d1 GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|!aQ9ZLo9le z6C_xBmS|iPEdAH7cg(4ak!wyDPk-ItgbB%y70x%f@2^{MK}Gt*`}f5>hLa9G_+Q_n zu%KAM$k02fV`2(J(Tl@L%__`tHT(OIsk?q(z{=3EQ1VpvBCAxO4Gf;HelF{r5}E*q Ca5k_2 literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_up.png b/src/client/resources/assets/textures/tile/obsidian_fence_up.png new file mode 100644 index 0000000000000000000000000000000000000000..c9c56cdcc1439b94501695117ef95d6ec64ff969 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|bUj@hLo9le zQw}hexXk^pU7%%T00cHa>gGQ@^?Gm5jVp!^jS@t9ngR{3Ffi0#W@o8hZp#hS$l&Sf K=d#Wzp$Pz}ULvIc literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..9df75239360a767abb05c791b3520b0aa174f761 GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|@;zM~Lo9le z|NQ@N&%Ci=;zU8`p3aQB77W~aoZjBvBFkm%>trrh#jr(0Mg4pK>eZn%g*HWt*n*dr zRAYiP7}6zPynJ~uQ)0FXa|i2|Zq^710WR)2Yzn`n=PNoZ@SG@P-1xFVFg)+bH1Q2j c-MSbVBp8(qcD76C1FdH8boFyt=akR{0BE5*3jhEB literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/textures/tile/stone_fence_down.png b/src/client/resources/assets/textures/tile/stone_fence_down.png new file mode 100644 index 0000000000000000000000000000000000000000..7a0656aa2f32bc6ea9c88a2a86d0e329d8eb9eca GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|bUj@hLo9le z6C_wG8e3bB)^l@r|4+%bD|vC@zjHg^L(`Vdoaen#23ZWIyg;pCyw(LDJ_Q3cGI+ZB KxvXib~h|B r=;-V`D4=|j;mL*eqijdxB!D)&VvwwEd?IN8G?&5C)z4*}Q$iB}z8o&> literal 0 HcmV?d00001 diff --git a/src/client/resources/assets/textures/tile/stone_fence_up.png b/src/client/resources/assets/textures/tile/stone_fence_up.png new file mode 100644 index 0000000000000000000000000000000000000000..bf5760f941e882d71e06aef08b72558b0e6f6ccf GIT binary patch literal 111 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|G(BA$Lo9le z6Am!y=;-{Dw<>w@f1z{xzvzgFKgXB$aZW#?A;G#hVFe?@i2}~s0cT&912r*ty85}S Ib4q9e04<~ug4l$YCWDgCiRvJFYUYv9YzS4!`$c zk`trP4wWsXE)Pt4d?zs;Vd~;lkYH;$#I&68#J^+dCj>Z{H^n;SSS_&758z?oTBEdS Te%1L{pq&h!u6{1-oD!MyKUyf8mHIr{oqwevkawoToH@ S@0tYE&EVJ!;>-QvHxF+am){r5-A!hHVwniXebeqf-apEcm zbImdKI;Vst0P%A=LjV8( literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..afeecd1595fbf63670e2696dd9e95a182def13c2 GIT binary patch literal 140 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|+&oTPgQu&X%Q~loCIGm8ELi{m literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..bef437c24bdb62f2ca080892dcba45566be5d5b2 GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|bUj@hLo9le zQw}g*`m6iD-8I7i1lB|qHYYwi_PFQ96~l){2_ijBfd*F?7`h&_vv5o-TLRR`;OXk; Jvd$@?2>{7mBVzyn literal 0 HcmV?d00001 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": { From 783fd84db3cb5b64f358740249f4014d51dfe34e Mon Sep 17 00:00:00 2001 From: GameJarne <69422663+GameJarne@users.noreply.github.com> Date: Sat, 30 Sep 2023 12:53:25 +0200 Subject: [PATCH 2/5] Update FenceTile.java --- .../java/minicraft/level/tile/FenceTile.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/client/java/minicraft/level/tile/FenceTile.java b/src/client/java/minicraft/level/tile/FenceTile.java index 6897d1dc1..2fd0c3e0d 100644 --- a/src/client/java/minicraft/level/tile/FenceTile.java +++ b/src/client/java/minicraft/level/tile/FenceTile.java @@ -32,6 +32,8 @@ public class FenceTile extends Tile { 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); @@ -55,6 +57,14 @@ protected FenceTile(Material type, String name) { 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; } @@ -70,20 +80,22 @@ public void render(Screen screen, Level level, int x, int y) sprite.render(screen, level, x, y); + updateConnections(level, x, y); + // up - if (level.getTile(x, y - 1).name.equals(name)) { + if (connectUp) { top.render(screen, level, x, y); } // bottom - if (level.getTile(x, y + 1).name.equals(name)) { + if (connectDown) { bottom.render(screen, level, x, y); } // left - if (level.getTile(x - 1, y).name.equals(name)) { + if (connectLeft) { left.render(screen, level, x, y); } // right - if (level.getTile(x + 1, y).name.equals(name)) { + if (connectRight) { right.render(screen, level, x, y); } } From acab5ec62320dbcb031fb29e04c0045c7928736b Mon Sep 17 00:00:00 2001 From: GameJarne <69422663+GameJarne@users.noreply.github.com> Date: Sat, 30 Sep 2023 13:38:29 +0200 Subject: [PATCH 3/5] Update en-us.json --- src/client/resources/assets/localization/en-us.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/resources/assets/localization/en-us.json b/src/client/resources/assets/localization/en-us.json index 5104b46ff..bd4ab0adc 100644 --- a/src/client/resources/assets/localization/en-us.json +++ b/src/client/resources/assets/localization/en-us.json @@ -467,5 +467,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" } From 9d364243e9f928e005f018b2dbbb880ca5d5c520 Mon Sep 17 00:00:00 2001 From: GameJarne <69422663+GameJarne@users.noreply.github.com> Date: Sat, 30 Sep 2023 15:42:14 +0200 Subject: [PATCH 4/5] Update fence textures --- .../textures/tile/obsidian_fence_bottom.png | Bin 126 -> 159 bytes .../assets/textures/tile/obsidian_fence_up.png | Bin 115 -> 115 bytes .../assets/textures/tile/stone_fence_down.png | Bin 115 -> 138 bytes .../assets/textures/tile/stone_fence_up.png | Bin 111 -> 111 bytes .../assets/textures/tile/wood_fence_bottom.png | Bin 120 -> 145 bytes .../assets/textures/tile/wood_fence_top.png | Bin 115 -> 115 bytes 6 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_bottom.png b/src/client/resources/assets/textures/tile/obsidian_fence_bottom.png index cd2535b51adcfaa0098f1a70d0367b1cb987507e..1c98de36ac6208af4fd2f8703dcfd51e3d0da881 100644 GIT binary patch delta 116 zcmb=M&p5#_FVfS+F~p)bIYEN8qOotq=X%+|=l_3PF?e+O%n_ZF2Y}$i`}f6d+Uvh3 zg`RFYUt(#-#|8v#?Dq>-Cmu>ausGiSgQu`rgM>pgb3$SR{{!A53kBJj=kqa0eG9!&5yeI4^O?`+jHZJ;X|VYk)EbNgDVUS^~&rl58qa%G5~?6 LtDnm{r-UW|%*+=j delta 56 zcmXRep5S1tU7%%T00cHa>gGQ@^?Gm5jVp!^jS@t9ngR{3Ffi0#W@o8hZp+O81fH&b JF6*2UngESz6;S{H diff --git a/src/client/resources/assets/textures/tile/stone_fence_down.png b/src/client/resources/assets/textures/tile/stone_fence_down.png index 7a0656aa2f32bc6ea9c88a2a86d0e329d8eb9eca..5091f520ee83a06b175cb4d25b2067786bfbaf9e 100644 GIT binary patch delta 95 zcmXT!Vw_+Y>Eh|)7-G?zoFKtk(b(F0w4R&0`+rKdUCE0J|DD_U9-6kW&R3kS7ps&Z yC~W6xYioOoM}h6aHHM@^4EYLty#^9LN*EYC`@|fLx9*c>00K`}KbLh*2~7Zwd?5`0 delta 72 zcmeBTES_NKr0eP87-G?zoFKtk(b(F0w4R&0`+rKdUCE0J|DD_U9-6jv<~;9}GRR^u bX>FVdQ&MBb@0D!U( A&;S4c diff --git a/src/client/resources/assets/textures/tile/wood_fence_top.png b/src/client/resources/assets/textures/tile/wood_fence_top.png index bef437c24bdb62f2ca080892dcba45566be5d5b2..4f9b0dbdec253f1156574de607074a1ff304d6a9 100644 GIT binary patch delta 52 zcmXRep5US%v-eZm!&g(yd5q2F(vK|bzmvv4F FO#nT16a)YO From b7d02b9f3559b313ff8ac44e83b30b99e5bd96a3 Mon Sep 17 00:00:00 2001 From: GameJarne <69422663+GameJarne@users.noreply.github.com> Date: Sun, 1 Oct 2023 14:31:18 +0200 Subject: [PATCH 5/5] fixed fence textures stone and obsidian textures were broken + updated wood fence textures --- .../assets/textures/tile/obsidian_fence.png | Bin 174 -> 193 bytes .../textures/tile/obsidian_fence_left.png | Bin 191 -> 180 bytes .../textures/tile/obsidian_fence_right.png | Bin 156 -> 161 bytes ...dian_fence_up.png => obsidian_fence_top.png} | Bin ...ne_fence_down.png => stone_fence_bottom.png} | Bin .../{stone_fence_up.png => stone_fence_top.png} | Bin .../assets/textures/tile/wood_fence.png | Bin 174 -> 229 bytes .../assets/textures/tile/wood_fence_bottom.png | Bin 145 -> 212 bytes .../assets/textures/tile/wood_fence_left.png | Bin 179 -> 194 bytes .../assets/textures/tile/wood_fence_right.png | Bin 140 -> 193 bytes .../assets/textures/tile/wood_fence_top.png | Bin 115 -> 159 bytes 11 files changed, 0 insertions(+), 0 deletions(-) rename src/client/resources/assets/textures/tile/{obsidian_fence_up.png => obsidian_fence_top.png} (100%) rename src/client/resources/assets/textures/tile/{stone_fence_down.png => stone_fence_bottom.png} (100%) rename src/client/resources/assets/textures/tile/{stone_fence_up.png => stone_fence_top.png} (100%) diff --git a/src/client/resources/assets/textures/tile/obsidian_fence.png b/src/client/resources/assets/textures/tile/obsidian_fence.png index 78b431ef7c4e96235af8fce660be44a6e035fcb5..7266237126e6eea8c654f229394c3fd9d3b6c80e 100644 GIT binary patch delta 152 zcmV;J0B8TM0l@)~F@JkWL_t(IjbmUKXuya~&_^zX;lcO&|B=NmzuLpd$cU+&1)Bj6 zzTf}P#4L#-rYq+1ADe|(4PankV31?uKrB{_kZG1z5TZipE%L6at`ZkMv#c8 zg{a|?4UrvJ8Q9p^+T8coJ(%Rg=(9uR$qkDKCOy8B7>_V@@hV8LwH#tv&UoVAvGfxH k9L$?y9dfJ|Sm+1vFtD{LTx#+Uz0Lpxp00i_>zopr09QITkN^Mx diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_left.png b/src/client/resources/assets/textures/tile/obsidian_fence_left.png index a5d8a4037e15e8a3ba46639aa8193349d131c2f9..03b15107ef07bc3c2f4fe458d0461b710cee282a 100644 GIT binary patch delta 139 zcmdnbxP@_oVSS#bi(`mIZ*qbJYme2UbN?^0uHSR-w8t7o9iKCkc#3jlc>3%9Dx7B3 z0Wm?qU{+&e<3k}$Hk%)H^L1uFWYZ|nO8W7gt5fd)hYK4U+au<{#$Z9`2`b_W?RJ(M o4}N<8zS!dV!SYF8_{13)zopr0NZmkSpWb4 delta 150 zcmV;H0BQfU0lxu|F@JeUL_t(IjbmUK1&lhP&i~N`ue{#NNUQ-Y3Y>}zkAD4NkYnRO z7(jvxSRVcQ!N9=4zyPC31uXymJ|{~f3^4xxj}Zh6jEqDF0RxM!m_xmUU55806prHr=on{)R!w>HySpWb407*qoM6N<$ Ef~=@L9RL6T diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_right.png b/src/client/resources/assets/textures/tile/obsidian_fence_right.png index 3b2e025a9d5b8cd3143d204322ef19b40f5371d1..eca4910d0a0ac957df6c407d4bf6b77ca43812ab 100644 GIT binary patch delta 119 zcmV--0Eqvb0igkqF>qT+L_t(IjbmUK1&pL9))967k1obSiUCZ_k_>We91M?s{UFZ( zIW`Uynq&hWe7}z&Mv?&voQfD>Myd-a3q%D@MGP^L3_uQjSZt7Fz`wuG;p_+BNzpl| Z0RRj17O0~^EeZet002ovPDHLkV1fy!Dpddg delta 114 zcmV-&0FD2l0h|GlF>6*yL_t(IjbmUK1&pL9))967k1obSiUA6oiVTl_{a}z|;~>v~ zN56ic&?Fo1@9%RAF_OaI|9^}ipmQKHF-u~Ikz@dJ=)+=zBm*9NzmLWzMfacu0EnR( U%4?!JWdHyG07*qoM6N<$g6Z-v&Hw-a diff --git a/src/client/resources/assets/textures/tile/obsidian_fence_up.png b/src/client/resources/assets/textures/tile/obsidian_fence_top.png similarity index 100% rename from src/client/resources/assets/textures/tile/obsidian_fence_up.png rename to src/client/resources/assets/textures/tile/obsidian_fence_top.png diff --git a/src/client/resources/assets/textures/tile/stone_fence_down.png b/src/client/resources/assets/textures/tile/stone_fence_bottom.png similarity index 100% rename from src/client/resources/assets/textures/tile/stone_fence_down.png rename to src/client/resources/assets/textures/tile/stone_fence_bottom.png diff --git a/src/client/resources/assets/textures/tile/stone_fence_up.png b/src/client/resources/assets/textures/tile/stone_fence_top.png similarity index 100% rename from src/client/resources/assets/textures/tile/stone_fence_up.png rename to src/client/resources/assets/textures/tile/stone_fence_top.png diff --git a/src/client/resources/assets/textures/tile/wood_fence.png b/src/client/resources/assets/textures/tile/wood_fence.png index e0fdeb6bc3d7c17e4a0078fd9ed88930584f0ca3..e714c6788a4725258ca3e25f5b7d54315b69e1fb 100644 GIT binary patch delta 201 zcmZ3-_>^&iN~-K3$OlR&&d%B!2;OQb$4nuFf3k0001JNkllD>0mK4| z4Imf>gu()+0m%NwXUGr;1F~H}Y&xJgFHj5s3alcspL)+-01E&B07*qoM6N<$f(BYR A^#A|> diff --git a/src/client/resources/assets/textures/tile/wood_fence_bottom.png b/src/client/resources/assets/textures/tile/wood_fence_bottom.png index 9aa448053077348ee416ad6d3ad235abd5132e93..eb91e92cd123db3bd9273d46585f02cbc93a913d 100644 GIT binary patch delta 184 zcmbQpc!hC-NoV^a!y|W;sXZ`G#D=_+||(7*!b|(RP!H8KJEsw z9i!b_jF>wZx0p7}FgPIH@xdU%a~U^~@7>A6Q)1}F&hVgFbb1$$i5SpgzSIcMG+$o^ YEg+i%h(X{|@MI9>>FVdQ&MBb@03?w?&Hw-a delta 116 zcmV-)0E_?B0g(ZaBy9n6Qb$4nuFf3k0000>Nkl zXp;H$ delta 151 zcmV;I0BHZh0kZ*+B!2;OQb$4nuFf3k0001ONkl!{+9pI1!rzN&Pc2Q zEMXBE3|FtbVbInQK{kMB7qDEt@`izdfq?-=lL}bK)d&NO|NmnI0Rtl=(Lun#k`Z8q zX#xWS@qvgOcyO?hXa}GgfF2t}8L(=_4HN-N19b=j070%F{Sa+j><<6{002ovPDHLk FV1hXmH-G>D diff --git a/src/client/resources/assets/textures/tile/wood_fence_right.png b/src/client/resources/assets/textures/tile/wood_fence_right.png index afeecd1595fbf63670e2696dd9e95a182def13c2..ae919603751b702670bae687da49c0503a8fba35 100644 GIT binary patch delta 165 zcmeBSJjggfrJl3EBeIx*fm;}a85w5Hkzin8i1c)E46*1<{`3F8J+o>(QOjr ziG}>#yj^=8CNbVPaNs#BLw313o8jT6NkB{ZQX@RmmdK II;Vst0B^T93;+NC delta 111 zcmV-#0FeK|0gM5VBxnJ1Qb$4nuFf3k0000+NklgTe~DWM4fHD@U< delta 85 zcmV-b0IL6=0dtTfPXTjMM?wIu&K&6g001pXL_t(IjbmiM0n+^~|A$3rFkHRzhT-a! rHw-g39%sa+jtQ3mqhJ(_f}sWgQ|k%@lb+p500000NkvXXu0mjfYQG==