From c32eaeedb72fb4b88989512a12d337ad2f21e8a7 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 29 Mar 2020 14:21:28 -0400 Subject: [PATCH] Add Grate model --- .../extrahoppers/ExtraHoppersClient.kt | 5 + .../extrahoppers/block/grate/GrateBlock.kt | 17 ++- .../extrahoppers/models/block/grate.json | 116 +++++++++++++++++- .../extrahoppers/textures/block/grate.png | Bin 0 -> 2098 bytes .../textures/block/grate_edge.png | Bin 0 -> 1797 bytes .../textures/block/grate_internal.png | Bin 0 -> 2006 bytes 6 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/assets/extrahoppers/textures/block/grate.png create mode 100644 src/main/resources/assets/extrahoppers/textures/block/grate_edge.png create mode 100644 src/main/resources/assets/extrahoppers/textures/block/grate_internal.png diff --git a/src/main/kotlin/net/shadowfacts/extrahoppers/ExtraHoppersClient.kt b/src/main/kotlin/net/shadowfacts/extrahoppers/ExtraHoppersClient.kt index 1002e28..0868b7c 100644 --- a/src/main/kotlin/net/shadowfacts/extrahoppers/ExtraHoppersClient.kt +++ b/src/main/kotlin/net/shadowfacts/extrahoppers/ExtraHoppersClient.kt @@ -1,18 +1,23 @@ package net.shadowfacts.extrahoppers import net.fabricmc.api.ClientModInitializer +import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap import net.fabricmc.fabric.api.client.screen.ContainerScreenFactory import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry +import net.minecraft.client.render.RenderLayer import net.shadowfacts.extrahoppers.block.gold.GoldHopperContainer import net.shadowfacts.extrahoppers.block.gold.GoldHopperScreen import net.shadowfacts.extrahoppers.block.wood.WoodHopperContainer import net.shadowfacts.extrahoppers.block.wood.WoodHopperScreen +import net.shadowfacts.extrahoppers.init.EHBlocks object ExtraHoppersClient: ClientModInitializer { override fun onInitializeClient() { ScreenProviderRegistry.INSTANCE.registerFactory(WoodHopperContainer.ID, ContainerScreenFactory(WoodHopperScreen.Companion::create)) ScreenProviderRegistry.INSTANCE.registerFactory(GoldHopperContainer.ID, ContainerScreenFactory(GoldHopperScreen.Companion::create)) + + BlockRenderLayerMap.INSTANCE.putBlock(EHBlocks.GRATE, RenderLayer.getCutout()) } } diff --git a/src/main/kotlin/net/shadowfacts/extrahoppers/block/grate/GrateBlock.kt b/src/main/kotlin/net/shadowfacts/extrahoppers/block/grate/GrateBlock.kt index 1c65188..9cb7b23 100644 --- a/src/main/kotlin/net/shadowfacts/extrahoppers/block/grate/GrateBlock.kt +++ b/src/main/kotlin/net/shadowfacts/extrahoppers/block/grate/GrateBlock.kt @@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.block.FabricBlockSettings import net.minecraft.block.* import net.minecraft.block.enums.BlockHalf import net.minecraft.entity.EntityContext +import net.minecraft.entity.EntityType import net.minecraft.fluid.Fluid import net.minecraft.fluid.FluidState import net.minecraft.fluid.Fluids @@ -37,8 +38,8 @@ class GrateBlock: BlockWithEntity( val HALF = Properties.BLOCK_HALF - val TOP_SHAPE = createCuboidShape(0.0, 15.0, 0.0, 16.0, 16.0, 16.0) - val BOTTOM_SHAPE = createCuboidShape(0.0, 0.0, 0.0, 16.0, 1.0, 16.0) + val TOP_SHAPE = createCuboidShape(0.0, 14.0, 0.0, 16.0, 16.0, 16.0) + val BOTTOM_SHAPE = createCuboidShape(0.0, 0.0, 0.0, 16.0, 2.0, 16.0) } init { @@ -75,6 +76,18 @@ class GrateBlock: BlockWithEntity( override fun createBlockEntity(world: BlockView) = GrateBlockEntity() + override fun isTranslucent(state: BlockState, world: BlockView, pos: BlockPos): Boolean { + return true + } + + override fun isSimpleFullBlock(state: BlockState, world: BlockView, pos: BlockPos): Boolean { + return false + } + + override fun allowsSpawning(state: BlockState, world: BlockView, pos: BlockPos, entityType: EntityType<*>): Boolean { + return false + } + override fun getFluidState(state: BlockState, world: BlockView, pos: BlockPos): FluidState { return getBlockEntity(world, pos)?.fluidState ?: Fluids.EMPTY.defaultState } diff --git a/src/main/resources/assets/extrahoppers/models/block/grate.json b/src/main/resources/assets/extrahoppers/models/block/grate.json index c1596c1..9862a7f 100644 --- a/src/main/resources/assets/extrahoppers/models/block/grate.json +++ b/src/main/resources/assets/extrahoppers/models/block/grate.json @@ -1,20 +1,124 @@ { "ambientocclusion": false, "textures": { - "face": "extrahoppers:block/grate/face", - "edge": "extrahoppers:block/grate/edge" + "face": "extrahoppers:block/grate", + "edge": "extrahoppers:block/grate_edge", + "internal": "extrahoppers:block/grate_internal", + "particle": "#face" }, "elements": [ { - "from": [0, 15, 0], + "from": [0, 14, 0], + "to": [1, 16, 16], + "faces": { + "down": {"texture": "#face"}, + "up": {"texture": "#face", "cullface": "up"}, + "west": {"texture": "#edge", "cullface": "west"}, + "east": {"texture": "#edge"}, + "north": {"texture": "#edge", "cullface": "north"}, + "south": {"texture": "#edge", "cullface": "south"} + } + }, + { + "from": [15, 14, 0], "to": [16, 16, 16], "faces": { "down": {"texture": "#face"}, "up": {"texture": "#face", "cullface": "up"}, + "west": {"texture": "#edge"}, + "east": {"texture": "#edge", "cullface": "east"}, "north": {"texture": "#edge", "cullface": "north"}, - "south": {"texture": "#edge", "cullface": "south"}, - "west": {"texture": "#edge", "cullface": "west"}, - "east": {"texture": "#edge", "cullface": "east"} + "south": {"texture": "#edge", "cullface": "south"} + } + }, + { + "from": [1, 14, 0], + "to": [15, 16, 1], + "faces": { + "down": {"texture": "#face", "uv": [1, 0, 15, 1]}, + "up": {"texture": "#face", "cullface": "up", "uv": [1, 0, 15, 1]}, + "north": {"texture": "#edge"}, + "south": {"texture": "#edge", "cullface": "south"} + } + }, + { + "from": [1, 14, 15], + "to": [15, 16, 16], + "faces": { + "down": {"texture": "#face", "uv": [1, 0, 15, 1]}, + "up": {"texture": "#face", "cullface": "up", "uv": [1, 0, 15, 1]}, + "north": {"texture": "#edge", "cullface": "north"}, + "south": {"texture": "#edge"} + } + }, + { + "from": [1, 14, 7], + "to": [2, 16, 9], + "faces": { + "down": {"texture": "#face", "uv": [1, 7, 2, 9]}, + "up": {"texture": "#face", "cullface": "up", "uv": [1, 7, 2, 9]}, + "north": {"texture": "#face", "uv": [1, 7, 2, 9]}, + "south": {"texture": "#face", "uv": [1, 7, 2, 9]} + } + }, + { + "from": [2, 14, 1], + "to": [4, 16, 15], + "faces": { + "down": {"texture": "#face", "uv": [2, 1, 4, 15]}, + "up": {"texture": "#face", "cullface": "up", "uv": [2, 1, 4, 15]}, + "west": {"texture": "#internal", "uv": [1, 2, 15, 4]}, + "east": {"texture": "#internal", "uv": [1, 2, 15, 4]} + } + }, + { + "from": [4, 14, 2], + "to": [7, 16, 4], + "faces": { + "down": {"texture": "#face", "uv": [4, 2, 7, 4]}, + "up": {"texture": "#face", "cullface": "up", "uv": [4, 2, 7, 4]}, + "north": {"texture": "#face", "uv": [4, 2, 7, 4]}, + "south": {"texture": "#face", "uv": [4, 2, 7, 4]} + } + }, + { + "from": [7, 14, 1], + "to": [9, 16, 15], + "faces": { + "down": {"texture": "#face", "uv": [7, 1, 9, 15]}, + "up": {"texture": "#face", "cullface": "up", "uv": [7, 1, 9, 15]}, + "west": {"texture": "#internal", "uv": [1, 7, 15, 9]}, + "east": {"texture": "#internal", "uv": [1, 7, 15, 9]} + } + }, + { + "from": [9, 14, 12], + "to": [12, 16, 14], + "faces": { + "down": {"texture": "#face", "uv": [9, 12, 12, 14]}, + "up": {"texture": "#face", "cullface": "up", "uv": [9, 12, 12, 14]}, + "north": {"texture": "#face", "uv": [9, 12, 12, 14]}, + "south": {"texture": "#face", "uv": [9, 12, 12, 14]} + } + }, + { + "from": [12, 14, 1], + "to": [14, 16, 15], + "faces": { + "down": {"texture": "#face", "uv": [12, 1, 14, 15]}, + "up": {"texture": "#face", "cullface": "up", "uv": [12, 1, 14, 15]}, + "west": {"texture": "#internal", "uv": [1, 12, 15, 14]}, + "east": {"texture": "#internal", "uv": [1, 12, 15, 14]} + } + }, + { + "from": [14, 14, 7], + "to": [15, 16, 9], + "faces": { + "down": {"texture": "#face", "uv": [14, 7, 15, 9]}, + "up": {"texture": "#face", "cullface": "up", "uv": [14, 7, 15, 9]}, + "north": {"texture": "#face", "uv": [14, 7, 15, 9]}, + "south": {"texture": "#face", "uv": [14, 7, 15, 9]} } } ], diff --git a/src/main/resources/assets/extrahoppers/textures/block/grate.png b/src/main/resources/assets/extrahoppers/textures/block/grate.png new file mode 100644 index 0000000000000000000000000000000000000000..4ac692645195732ff9e983e680699dce4457a0f6 GIT binary patch literal 2098 zcmV-22+jA2P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1Ywmg^`C{AU%j1SB4U zkRnHeGtfmJC59MdN~{tbCD=-spPc@%eoPja61jeN^fQ07GnGR$vcjh{0Ix>pFF+jS`jjGfc1BLb=c8xZ77jr-2O}X$R z-uOG_RHyE5FsDG>D{pUDtNorUgR!#;drY-K^);sx2bFs2TMp zp!ud(HwC@ey!YG3XMXH#UrK3ddyw`fNT?&f+S{8DB zUmk;kwY5WJLH@kpm9rD1dPV6sNZZ~dXPFEGFFqdpkgLvW<@A-?IBcdE@?PzZTSo58 z%ruOt582$(POnNUP3_(BM5yi%Ul9H<^y(p$o>#J!e2;U^o9GRtUct&K)7_nr}~`3#j@SjHmj3cdTDkpng*Z zpU!mk`!y{cYf7ps3Pr{C)9dTCyssl6diB+;6kn<{tlRDB)|ul<8@u-s+MX(YZ!2xS z;)m;4y+6(EORaIcJ_vlhOs|twJ!CQxqAbz#8<_Xo^>Lf(T@bJAc)a01U*PI%AI}$f z`Q}SYeKkNY>6!PZ*1LpI@3`NaZ1{GJ_^kU6<**G59L+MJ0004mX+uL$Nkc;*aB^>E zX>4Tx0C=2zkv&MmKpe$iTcsi`3U&~wkfAzR5EXIMDionYs1;guFuC*#nlvOSE{=k0 z!NHHks)LKOt`4q(Aou~|}?mh0_0scmXsb<$WplX(pP9}tG zZdC}rB7kA^BZ{!ZOnpuiQ}7&L_we!cF3z*O&;2>VO5S9EPavLUx?vG-5KnJfI_G`j z2rEen@j3CBK^G)`h+~SXQNBOxvch?b zvs$UK);;+PLwRjwnd>y8NMaF75FtQD4P{hdAx^7CiitGsCp`Q^j$b5~Os+B*ITlcb z3d!+<|H1EW&BEk_n-od_-7mKNF#-g4fo9#dzmILZc>)BUfh(=;uQq_0PtxmcEp`O- zZ37qAZB5<-E_Z;zCtWfmM+(sN7Ye}p8GTa@7`O#`*WBJ(`#607GSpS-1~@nbMvIia z?(y!P&ffk#)9UXBNYZkajsXme00006VoOIv00000008+zyMF)x010qNS#tmY3ljhU z3ljkVnw%H_000McNliru&V~eP2@vPtRl7bWv4hS{Awr#z|DNS8*BZIGx&FR}!X^*)P4Ssw%p7-I@g5ab1KE zjits()Tn*X^9X`KmJ&AGHR&PcKS&QLaT1l2(DN+g;r>y(#&iw7?`x%mYkHe}P(^JD zO&#y|`>jm`evI^2!>SJ|qMDJ~8m2D9NmO&EX;~Oe9>4TK)ty1$)kdzV-`ME&qWESq c&2oK-FOGkzQ+o)4*#H0l07*qoM6N<$g3Wp1BLDyZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/extrahoppers/textures/block/grate_edge.png b/src/main/resources/assets/extrahoppers/textures/block/grate_edge.png new file mode 100644 index 0000000000000000000000000000000000000000..36f24cb8b4fc376d178e265bb21c447042fd4bd4 GIT binary patch literal 1797 zcmV+g2m1JlP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O1bxlIti8{bv=k1SBCI%i&?F?ha=8bHI;I9H*V! z8q>C9A%r+b;Ivu({nO1qxY)8YPDAv`dyC5@mpDU-cD>Skl6CXBz1UrOvYVrWVG>AL zUqjyfGwk{^V4s7^v)#n4hvOEAj==MhG4s&dW0J7*YA3e^O3SMF6vJbxWeZd{$C=7@ zyCbbtjCb>72tcVRCKBdFNbG#NH3M1ij9c(zN${ghw+4b_Un>B4THXPmeFW$UKIhFYCoKJj5tPdg(vw||Y4~wsIWpqsjzW8=SCD&evG-+NU3MOb`mLfS*tCa% zV*%tchk3MsTcL;95?Zv`R#4t-wFRwGA_gnnkfTPKIxSOHs-xg};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