From 9f2a67599f53725d77dabda61a172fc91fc461ce Mon Sep 17 00:00:00 2001 From: woodiertexas Date: Sun, 21 Jul 2024 20:07:01 -0700 Subject: [PATCH 1/5] hash out very rough draft for orientable blocks --- static/blocks/blackwood_log_top.png | Bin 0 -> 254 bytes static/blocks/glowing_blackwood_log.png | Bin 0 -> 468 bytes wiki/blocks/oriented-block/en.md | 39 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 static/blocks/blackwood_log_top.png create mode 100644 static/blocks/glowing_blackwood_log.png create mode 100644 wiki/blocks/oriented-block/en.md diff --git a/static/blocks/blackwood_log_top.png b/static/blocks/blackwood_log_top.png new file mode 100644 index 0000000000000000000000000000000000000000..4d409bebd1b79115b673bf0a98c247e2fbea61cd GIT binary patch literal 254 zcmeAS@N?(olHy`uVBq!ia0vp^0wBx*Bp9q_EZ7UA*h@TpUD==V@QX?D9{kyo1Qg;d z@Q5sCV30cq!iVEa{HEjtmSN`?>!lvI6i=Zhw<_xBQ+eseMNZ&Oy? x@_iu?`{$_1+-rO9++FAEyw+Yp>74ozd6nDRtzo=BBY_TM@O1TaS?83{1OVK7Uqb)@ literal 0 HcmV?d00001 diff --git a/static/blocks/glowing_blackwood_log.png b/static/blocks/glowing_blackwood_log.png new file mode 100644 index 0000000000000000000000000000000000000000..d888d8621af8d8099673e2f312b35aa075b094b5 GIT binary patch literal 468 zcmV;_0W1EAP)WdK)YWFRp$AVg(jATlsAF(5HCIx;vqH8~(HFgP$U!rEIY00007bV*G` z2jvV879|&CMOP#M000SaNLh0L01FZT01FZU(%pXi00004XF*Lt006O%3;baP0003i zNkllMg7p#(v`iYsdAJSPwOyPdo?3ytCQ5{LS!J}IZ-3w|Kj+|Ha_ z#zFLBGvfhtk=JUWad+FSzn090#*2g0iW0000< KMNUMnLSTZ~qPg<` literal 0 HcmV?d00001 diff --git a/wiki/blocks/oriented-block/en.md b/wiki/blocks/oriented-block/en.md new file mode 100644 index 00000000..c670c797 --- /dev/null +++ b/wiki/blocks/oriented-block/en.md @@ -0,0 +1,39 @@ +--- +title: Creating an Oriented Block +index: 0 +--- + +# Creating an Oriented Block +Blocks such as Oak, Spruce and Birch logs are an example of an oriented block. The following example will show you how to make your own oriented block +with "Glowing Blackwood Log" being the example block. + + +First off, you will want to make a blockstate json like the following: +The X, Y, and Z are your blockstate's axis. + +`src/main/resources/assets/yeefpineapple/blockstates/glowing_blackwood.json`: +```json +{ + "variants": { + "axis=x": { + "model": "yeefpineapple:block/glowing_blackwood_horizontal", + "x": 90, + "y": 90 + }, + "axis=y": { + "model": "yeefpineapple:block/glowing_blackwood" + }, + "axis=z": { + "model": "yeefpineapple:block/glowing_blackwood_horizontal", + "x": 90 + } + } +} +``` + +Then you will need to create a class file for the block you're adding. In this example, the file will be called "GlowingBlackwood.java". + +`src/main/com/example/yeefpineapple/blocks/YeefPineapple.java`: +```java + public static final PillarBlock GLOWING_BLACKWOOD = new PillarBlock(QuiltBlockSettings.create()); +``` From 971e9e1c71583fd16fe8acb4a5ef316bd0168627 Mon Sep 17 00:00:00 2001 From: woodiertexas Date: Sun, 21 Jul 2024 20:21:53 -0700 Subject: [PATCH 2/5] update lol --- wiki/blocks/oriented-block/en.md | 33 +++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/wiki/blocks/oriented-block/en.md b/wiki/blocks/oriented-block/en.md index c670c797..f73a0c30 100644 --- a/wiki/blocks/oriented-block/en.md +++ b/wiki/blocks/oriented-block/en.md @@ -8,7 +8,7 @@ Blocks such as Oak, Spruce and Birch logs are an example of an oriented block. T with "Glowing Blackwood Log" being the example block. -First off, you will want to make a blockstate json like the following: +First off, you will want to make two block model json like the following: The X, Y, and Z are your blockstate's axis. `src/main/resources/assets/yeefpineapple/blockstates/glowing_blackwood.json`: @@ -16,7 +16,7 @@ The X, Y, and Z are your blockstate's axis. { "variants": { "axis=x": { - "model": "yeefpineapple:block/glowing_blackwood_horizontal", + "model": "yeefpineapple:block/glowing_blackwood", "x": 90, "y": 90 }, @@ -24,7 +24,7 @@ The X, Y, and Z are your blockstate's axis. "model": "yeefpineapple:block/glowing_blackwood" }, "axis=z": { - "model": "yeefpineapple:block/glowing_blackwood_horizontal", + "model": "yeefpineapple:block/glowing_blackwood", "x": 90 } } @@ -33,7 +33,30 @@ The X, Y, and Z are your blockstate's axis. Then you will need to create a class file for the block you're adding. In this example, the file will be called "GlowingBlackwood.java". -`src/main/com/example/yeefpineapple/blocks/YeefPineapple.java`: +`src/main/com/example/yeefpineapple/blocks/GlowingBlackwood.java`: ```java - public static final PillarBlock GLOWING_BLACKWOOD = new PillarBlock(QuiltBlockSettings.create()); +public class BeamBlock extends PillarBlock { + // The following deals with block rotation + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + return changeRotation(state, rotation); + } + + public static BlockState changeRotation(BlockState state, BlockRotation rotation) { + return switch (rotation) { + case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> switch (state.get(AXIS)) { + case X -> state.with(AXIS, Direction.Axis.Z); + case Z -> state.with(AXIS, Direction.Axis.X); + default -> state; + }; + default -> state; + }; + } + + // Deals with placing the block properly in accordance to direction. + @Override + public BlockState getPlacementState(ItemPlacementContext context) { + return this.getDefaultState().with(AXIS, context.getSide().getAxis()); + } +} ``` From cb39f1ae3b9af3a543a1f854d0fa72b68d6b9759 Mon Sep 17 00:00:00 2001 From: woodiertexas Date: Mon, 2 Sep 2024 20:46:03 -0700 Subject: [PATCH 3/5] describe what an orientable block is --- wiki/blocks/oriented-block/en.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wiki/blocks/oriented-block/en.md b/wiki/blocks/oriented-block/en.md index f73a0c30..4624124b 100644 --- a/wiki/blocks/oriented-block/en.md +++ b/wiki/blocks/oriented-block/en.md @@ -4,6 +4,8 @@ index: 0 --- # Creating an Oriented Block +Orientable blocks are blocks that are placed in different directions based on where you click to place said block and which direction you're facing when placing said block. + Blocks such as Oak, Spruce and Birch logs are an example of an oriented block. The following example will show you how to make your own oriented block with "Glowing Blackwood Log" being the example block. From 7ecd6e5b6d34ec4f73ce4e7a010f94a3a50cc182 Mon Sep 17 00:00:00 2001 From: woodiertexas Date: Mon, 2 Sep 2024 20:46:22 -0700 Subject: [PATCH 4/5] make namespace consistent with other tutorials --- wiki/blocks/oriented-block/en.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wiki/blocks/oriented-block/en.md b/wiki/blocks/oriented-block/en.md index 4624124b..9aa65699 100644 --- a/wiki/blocks/oriented-block/en.md +++ b/wiki/blocks/oriented-block/en.md @@ -13,20 +13,20 @@ with "Glowing Blackwood Log" being the example block. First off, you will want to make two block model json like the following: The X, Y, and Z are your blockstate's axis. -`src/main/resources/assets/yeefpineapple/blockstates/glowing_blackwood.json`: +`src/main/resources/assets/example_mod/blockstates/glowing_blackwood.json`: ```json { "variants": { "axis=x": { - "model": "yeefpineapple:block/glowing_blackwood", + "model": "example_mod:block/glowing_blackwood", "x": 90, "y": 90 }, "axis=y": { - "model": "yeefpineapple:block/glowing_blackwood" + "model": "example_mod:block/glowing_blackwood" }, "axis=z": { - "model": "yeefpineapple:block/glowing_blackwood", + "model": "example_mod:block/glowing_blackwood", "x": 90 } } @@ -35,7 +35,7 @@ The X, Y, and Z are your blockstate's axis. Then you will need to create a class file for the block you're adding. In this example, the file will be called "GlowingBlackwood.java". -`src/main/com/example/yeefpineapple/blocks/GlowingBlackwood.java`: +`src/main/com/example/example_mod/blocks/GlowingBlackwood.java`: ```java public class BeamBlock extends PillarBlock { // The following deals with block rotation From b463da642025c8fe78d02bf684b915ac82242787 Mon Sep 17 00:00:00 2001 From: woodiertexas Date: Mon, 14 Oct 2024 23:18:23 -0700 Subject: [PATCH 5/5] Update wiki/blocks/oriented-block/en.md Co-authored-by: ix0rai --- wiki/blocks/oriented-block/en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki/blocks/oriented-block/en.md b/wiki/blocks/oriented-block/en.md index 9aa65699..92ef2555 100644 --- a/wiki/blocks/oriented-block/en.md +++ b/wiki/blocks/oriented-block/en.md @@ -7,7 +7,7 @@ index: 0 Orientable blocks are blocks that are placed in different directions based on where you click to place said block and which direction you're facing when placing said block. Blocks such as Oak, Spruce and Birch logs are an example of an oriented block. The following example will show you how to make your own oriented block -with "Glowing Blackwood Log" being the example block. +with the "Glowing Blackwood Log" as an example block. First off, you will want to make two block model json like the following: