From 24b7896151c598a51c000e1a2799c84802ed35e9 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 24 Feb 2021 18:58:22 -0500 Subject: [PATCH] Add actual Redstone Controller model --- .../block/redstone/RedstoneControllerBlock.kt | 26 +++------ .../blockstates/redstone_controller.json | 48 ++++++++++++----- .../phycon/models/block/cable_center.json | 5 +- .../block/redstone_controller_side_off.json | 33 ++++++++++++ .../block/redstone_controller_side_on.json | 33 ++++++++++++ .../models/item/redstone_controller.json | 51 ++++++++++++++++++ .../block/redstone_controller_back.png | Bin 0 -> 831 bytes .../block/redstone_controller_front_off.png | Bin 0 -> 986 bytes .../block/redstone_controller_front_on.png | Bin 0 -> 1053 bytes 9 files changed, 164 insertions(+), 32 deletions(-) create mode 100644 src/main/resources/assets/phycon/models/block/redstone_controller_side_off.json create mode 100644 src/main/resources/assets/phycon/models/block/redstone_controller_side_on.json create mode 100644 src/main/resources/assets/phycon/models/item/redstone_controller.json create mode 100644 src/main/resources/assets/phycon/textures/block/redstone_controller_back.png create mode 100644 src/main/resources/assets/phycon/textures/block/redstone_controller_front_off.png create mode 100644 src/main/resources/assets/phycon/textures/block/redstone_controller_front_on.png diff --git a/src/main/kotlin/net/shadowfacts/phycon/network/block/redstone/RedstoneControllerBlock.kt b/src/main/kotlin/net/shadowfacts/phycon/network/block/redstone/RedstoneControllerBlock.kt index 5a9cb6e..5df0957 100644 --- a/src/main/kotlin/net/shadowfacts/phycon/network/block/redstone/RedstoneControllerBlock.kt +++ b/src/main/kotlin/net/shadowfacts/phycon/network/block/redstone/RedstoneControllerBlock.kt @@ -27,14 +27,14 @@ class RedstoneControllerBlock: FaceDeviceBlock(Se } // todo: don't just copy this from the Interface block - override val faceThickness = 2.0 + override val faceThickness = 3.0 override val faceShapes = mapOf( - Direction.DOWN to createCuboidShape(0.0, 0.0, 0.0, 16.0, 2.0, 16.0), - Direction.UP to createCuboidShape(0.0, 14.0, 0.0, 16.0, 16.0, 16.0), - Direction.NORTH to createCuboidShape(0.0, 0.0, 0.0, 16.0, 16.0, 2.0), - Direction.SOUTH to createCuboidShape(0.0, 0.0, 14.0, 16.0, 16.0, 16.0), - Direction.WEST to createCuboidShape(0.0, 0.0, 0.0, 2.0, 16.0, 16.0), - Direction.EAST to createCuboidShape(14.0, 0.0, 0.0, 16.0, 16.0, 16.0) + Direction.DOWN to createCuboidShape(0.0, 0.0, 0.0, 16.0, 3.0, 16.0), + Direction.UP to createCuboidShape(0.0, 13.0, 0.0, 16.0, 16.0, 16.0), + Direction.NORTH to createCuboidShape(0.0, 0.0, 0.0, 16.0, 16.0, 3.0), + Direction.SOUTH to createCuboidShape(0.0, 0.0, 13.0, 16.0, 16.0, 16.0), + Direction.WEST to createCuboidShape(0.0, 0.0, 0.0, 3.0, 16.0, 16.0), + Direction.EAST to createCuboidShape(13.0, 0.0, 0.0, 16.0, 16.0, 16.0) ) override fun appendProperties(builder: StateManager.Builder) { @@ -55,21 +55,11 @@ class RedstoneControllerBlock: FaceDeviceBlock(Se val wasLit = state[LIT] val isLit = isPowered(world, pos, state[FACING]) if (wasLit != isLit) { - if (wasLit) { - world.blockTickScheduler.schedule(pos, this, 4) - } else { - toggleLit(state, world, pos) - } + toggleLit(state, world, pos) } } } - override fun scheduledTick(state: BlockState, world: ServerWorld, pos: BlockPos, random: Random) { - if (state[LIT] && !isPowered(world, pos, state[FACING])) { - toggleLit(state, world, pos) - } - } - private fun isPowered(world: World, pos: BlockPos, facing: Direction): Boolean { val offset = pos.offset(facing) return world.getEmittedRedstonePower(offset, facing) > 0 diff --git a/src/main/resources/assets/phycon/blockstates/redstone_controller.json b/src/main/resources/assets/phycon/blockstates/redstone_controller.json index 32abdb2..196adf8 100644 --- a/src/main/resources/assets/phycon/blockstates/redstone_controller.json +++ b/src/main/resources/assets/phycon/blockstates/redstone_controller.json @@ -4,28 +4,52 @@ "apply": { "model": "phycon:block/cable_center" } }, { - "when": { "facing": "down", "lit": "true|false" }, - "apply": { "model": "phycon:block/interface_side" } + "when": { "facing": "down", "lit": "false" }, + "apply": { "model": "phycon:block/redstone_controller_side_off" } }, { - "when": { "facing": "up", "lit": "true|false" }, - "apply": { "model": "phycon:block/interface_side", "x": 180 } + "when": { "facing": "up", "lit": "false" }, + "apply": { "model": "phycon:block/redstone_controller_side_off", "x": 180 } }, { - "when": { "facing": "north", "lit": "true|false" }, - "apply": { "model": "phycon:block/interface_side", "x": 270 } + "when": { "facing": "north", "lit": "false" }, + "apply": { "model": "phycon:block/redstone_controller_side_off", "x": 270 } }, { - "when": { "facing": "south", "lit": "true|false" }, - "apply": { "model": "phycon:block/interface_side", "x": 90 } + "when": { "facing": "south", "lit": "false" }, + "apply": { "model": "phycon:block/redstone_controller_side_off", "x": 90 } }, { - "when": { "facing": "west", "lit": "true|false" }, - "apply": { "model": "phycon:block/interface_side", "x": 90, "y": 90 } + "when": { "facing": "west", "lit": "false" }, + "apply": { "model": "phycon:block/redstone_controller_side_off", "x": 90, "y": 90 } }, { - "when": { "facing": "east", "lit": "true|false" }, - "apply": { "model": "phycon:block/interface_side", "x": 90, "y": 270 } + "when": { "facing": "east", "lit": "false" }, + "apply": { "model": "phycon:block/redstone_controller_side_off", "x": 90, "y": 270 } + }, + { + "when": { "facing": "down", "lit": "true" }, + "apply": { "model": "phycon:block/redstone_controller_side_on" } + }, + { + "when": { "facing": "up", "lit": "true" }, + "apply": { "model": "phycon:block/redstone_controller_side_on", "x": 180 } + }, + { + "when": { "facing": "north", "lit": "true" }, + "apply": { "model": "phycon:block/redstone_controller_side_on", "x": 270 } + }, + { + "when": { "facing": "south", "lit": "true" }, + "apply": { "model": "phycon:block/redstone_controller_side_on", "x": 90 } + }, + { + "when": { "facing": "west", "lit": "true" }, + "apply": { "model": "phycon:block/redstone_controller_side_on", "x": 90, "y": 90 } + }, + { + "when": { "facing": "east", "lit": "true" }, + "apply": { "model": "phycon:block/redstone_controller_side_on", "x": 90, "y": 270 } }, { diff --git a/src/main/resources/assets/phycon/models/block/cable_center.json b/src/main/resources/assets/phycon/models/block/cable_center.json index 05ecfd8..cfda031 100644 --- a/src/main/resources/assets/phycon/models/block/cable_center.json +++ b/src/main/resources/assets/phycon/models/block/cable_center.json @@ -1,6 +1,7 @@ { "textures": { - "center": "phycon:block/cable_cap_end" + "center": "phycon:block/cable_cap_end", + "particle": "#center" }, "elements": [ { @@ -39,4 +40,4 @@ } } ] -} \ No newline at end of file +} diff --git a/src/main/resources/assets/phycon/models/block/redstone_controller_side_off.json b/src/main/resources/assets/phycon/models/block/redstone_controller_side_off.json new file mode 100644 index 0000000..acf943a --- /dev/null +++ b/src/main/resources/assets/phycon/models/block/redstone_controller_side_off.json @@ -0,0 +1,33 @@ +{ + "parent": "block/block", + "textures": { + "cable": "phycon:block/cable_straight", + "front": "phycon:block/redstone_controller_front_off", + "back": "phycon:block/redstone_controller_back", + "side": "phycon:block/redstone_controller_back", + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 3, 16], + "faces": { + "down": { "texture": "#front" }, + "up": { "texture": "#back" }, + "north": { "texture": "#side" }, + "south": { "texture": "#side" }, + "west": { "texture": "#side" }, + "east": { "texture": "#side" } + } + }, + { + "from": [6, 3, 6], + "to": [10, 6, 10], + "faces": { + "north": { "texture": "#cable" }, + "south": { "texture": "#cable" }, + "west": { "texture": "#cable" }, + "east": { "texture": "#cable" } + } + } + ] +} diff --git a/src/main/resources/assets/phycon/models/block/redstone_controller_side_on.json b/src/main/resources/assets/phycon/models/block/redstone_controller_side_on.json new file mode 100644 index 0000000..65b44a4 --- /dev/null +++ b/src/main/resources/assets/phycon/models/block/redstone_controller_side_on.json @@ -0,0 +1,33 @@ +{ + "parent": "block/block", + "textures": { + "cable": "phycon:block/cable_straight", + "front": "phycon:block/redstone_controller_front_on", + "back": "phycon:block/redstone_controller_back", + "side": "phycon:block/redstone_controller_back" + }, + "elements": [ + { + "from": [0, 0, 0], + "to": [16, 3, 16], + "faces": { + "down": { "texture": "#front" }, + "up": { "texture": "#back" }, + "north": { "texture": "#side" }, + "south": { "texture": "#side" }, + "west": { "texture": "#side" }, + "east": { "texture": "#side" } + } + }, + { + "from": [6, 3, 6], + "to": [10, 6, 10], + "faces": { + "north": { "texture": "#cable" }, + "south": { "texture": "#cable" }, + "west": { "texture": "#cable" }, + "east": { "texture": "#cable" } + } + } + ] +} diff --git a/src/main/resources/assets/phycon/models/item/redstone_controller.json b/src/main/resources/assets/phycon/models/item/redstone_controller.json new file mode 100644 index 0000000..e4bd117 --- /dev/null +++ b/src/main/resources/assets/phycon/models/item/redstone_controller.json @@ -0,0 +1,51 @@ +{ + "parent": "block/block", + "textures": { + "front": "phycon:block/redstone_controller_front_off", + "back": "phycon:block/redstone_controller_back", + "side": "phycon:block/redstone_controller_back", + "cable_end": "phycon:block/cable_cap_end", + "cable_side": "phycon:block/cable_straight" + }, + "elements": [ + { + "_comment": "cable center", + "from": [6, 6, 3], + "to": [10, 10, 16], + "faces": { + "down": { "texture": "#cable_side" }, + "up": { "texture": "#cable_side" }, + "south": { "texture": "#cable_end" }, + "west": { "texture": "#cable_side", "rotation": 90, "uv": [6, 0, 10, 16] }, + "east": { "texture": "#cable_side", "rotation": 90, "uv": [6, 0, 10, 16] } + } + }, + { + "_comment": "redstone controller side", + "from": [0, 0, 0], + "to": [16, 16, 3], + "faces": { + "down": { "texture": "#side" }, + "up": { "texture": "#side" }, + "north": { "texture": "#front" }, + "south": { "texture": "#back" }, + "west": { "texture": "#side" }, + "east": { "texture": "#side" } + } + } + ], + "_test": [ + { + "_comment": "cable center", + "from": [6, 6, 3], + "to": [10, 10, 16], + "faces": { + "down": { "texture": "#cable_side", "rotation": 270, "uv": [4, 6, 10, 10] }, + "up": { "texture": "#cable_side", "rotation": 90, "uv": [4, 6, 10, 10] }, + "south": { "texture": "#cable_end" }, + "west": { "texture": "#cable_side", "uv": [4, 6, 10, 10] }, + "east": { "texture": "#cable_side", "rotation": 180, "uv": [4, 6, 10, 10] } + } + } + ] +} diff --git a/src/main/resources/assets/phycon/textures/block/redstone_controller_back.png b/src/main/resources/assets/phycon/textures/block/redstone_controller_back.png new file mode 100644 index 0000000000000000000000000000000000000000..14643d158138fceaa6407fe2e6e2aab6a055c3fb GIT binary patch literal 831 zcmV-F1Hk-=P)EX>4Tx04R}tkv&MmKpe$iQ>7vm5sMUY$WWauh>D1lR-p(LLaorMgUR(1nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|=H{g6A|?JWDYS_3;J6>}?mh0_0YbgZRI_6YP&La) z#$#eSvnmE&As~za%%D$ZramW033!gLd-(Wz7v)*r=l&c$*__D$pGZ8*bi*RvAfDQ^ zbk6(4Ay$;L#OK7L23?T&k?V@fZ=4Gb3p_Jqq>}T*A!4!6#!4HrqM;H`5=XMCM)^Y8 zu?swklh3sG7%QcNUiKjz^dbo>&z6mpfo z$gzM5RLG7W{11M2Yvw1$-K1a)=zOv5k6|FN3p8rB{e5iPjT6BC3|wg~f29sgf0ABn zX^|tKcN@64ZfVLMaJd77pLE%f9m!8q$mfCgGy0|s(0>bbuerT7_i_3Fq^PUJ4RCM> zj1(w)-Q(R|?Y;ebrrF;QpdoU(C6l;200006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNlirucW`GZ_6eD8(Wfvetv$E1W6>pHc6N@=dXj_pIpC_Br&N;Zn7i*D(OA2)&l4P zf3N5its)6kg(UV`1PJgv&$qxEq9sxdPZE+E>RLRhxj-zc&fYe*FHEb0oNs{7=fm*Z zd*ieo7s0?B*Z`@*HlOFgQlo<|ezfy+U3-&*W}uIFnt}&ij+m)pOJdv9^K@s6sI|Dd z*uT2YI0ZP#RrCfc_rg2#Cb4*TZ;Hq>AMQ`t8uCs=GJT?}SK` zZCeVfVJcq=?Tzt)*?S)$i#_VvJq?W}^GeU-qS{0p*H#r?i$92X{K431)qem0002ov JPDHLkV1j;xdv^c; literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/phycon/textures/block/redstone_controller_front_off.png b/src/main/resources/assets/phycon/textures/block/redstone_controller_front_off.png new file mode 100644 index 0000000000000000000000000000000000000000..7099eb9148db90a07acda57f12c2e94a61206544 GIT binary patch literal 986 zcmV<0110>4P)EX>4Tx04R}tkv&MmKpe$iQ>7vm5sMUY$WWauh>D1lR-p(LLaorMgUR(1nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|=H{g6A|?JWDYS_3;J6>}?mh0_0YbgZRI_6YP&La) z#$#eSvnmE&As~za%%D$ZramW033!gLd-(Wz7v)*r=l&c$*__D$pGZ8*bi*RvAfDQ^ zbk6(4Ay$;L#OK7L23?T&k?V@fZ=4Gb3p_Jqq>}T*A!4!6#!4HrqM;H`5=XMCM)^Y8 zu?swklh3sG7%QcNUiKjz^dbo>&z6mpfo z$gzM5RLG7W{11M2Yvw1$-K1a)=zOv5k6|FN3p8rB{e5iPjT6BC3|wg~f29sgf0ABn zX^|tKcN@64ZfVLMaJd77pLE%f9m!8q$mfCgGy0|s(0>bbuerT7_i_3Fq^PUJ4RCM> zj1(w)-Q(R|?Y;ebrrF;QpdoU(C6l;200006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru$dl!dJ-mB1YhhXSzzvqI<^HP6EMVQIziQ?`<1N*d`*d&8bfFH-oj` zu<;foi4)ZJ87v8avezESOaK~h>fzUKmcB4a3>yciV45eYFH{ADdA!>(#&}g=n}_dz zsJ?J9Yn8Ibg{``SMRMn~=BB&g+De36$^umBN3qYpkrVMzAVOb5e@qB zbrVezEmp}4F#+1IQVkfBHv@MFAS%giodUu(V+*}SC-g7z`-lkoy#rav7hI?hBIFdDpc#^wPwk(o$h{xDJdg{2C&q{o5z-Ar8? z##kSv;|qwk8YqbEX>4Tx04R}tkv&MmKpe$iQ>7vm5sMUY$WWauh>D1lR-p(LLaorMgUR(1nlvOS zE{=k0!NHHks)LKOt`4q(Aou~|=H{g6A|?JWDYS_3;J6>}?mh0_0YbgZRI_6YP&La) z#$#eSvnmE&As~za%%D$ZramW033!gLd-(Wz7v)*r=l&c$*__D$pGZ8*bi*RvAfDQ^ zbk6(4Ay$;L#OK7L23?T&k?V@fZ=4Gb3p_Jqq>}T*A!4!6#!4HrqM;H`5=XMCM)^Y8 zu?swklh3sG7%QcNUiKjz^dbo>&z6mpfo z$gzM5RLG7W{11M2Yvw1$-K1a)=zOv5k6|FN3p8rB{e5iPjT6BC3|wg~f29sgf0ABn zX^|tKcN@64ZfVLMaJd77pLE%f9m!8q$mfCgGy0|s(0>bbuerT7_i_3Fq^PUJ4RCM> zj1(w)-Q(R|?Y;ebrrF;QpdoU(C6l;200006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru>C!MbZ%GxEwEh8 z$!$w65kleWVoNFIKLdB?-N$Q&eZ!MYjhr}9VIBgDXG-2VxhO`)iu2*~CtL+H8yTo7 zr5>0qD)zs6AfQ#jQlR_UBVLDbgdiJ(57XOzt36 z5m6yVJqjF;;t-MVN<&WyJ7NWL4)rcjtin$Qx*wUCpnK4x6H!Ens%TYU5SD=4j8q*M zaO&qBxgEDvxh73^3ZU*zDFus;JsCi1IuxA+>N5x!_IpmcA8n&RM@3M@0TmGtAxR=> zg=~7}LFxB}a<2qt$ZF3pcLEh&Wt0bOx(78gRD`bS=>LN6z}A^rgs?H{GsTKQ>u4o# z8W3ujt~2^{T~1)}s-}E%taX$%-Pb!ZEnd~A^e{x^wr4+SfIAvOKtx!*T$BGav^nD` z(S2X5dAjx><1b z=7Ixr*>1O^8qP6HI)%v0P}M1g;O2-bL3MP_jp#6L(9sQ