Add Grate model

This commit is contained in:
Shadowfacts 2020-03-29 14:21:28 -04:00
parent dd92515c2f
commit c32eaeedb7
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
6 changed files with 130 additions and 8 deletions

View File

@ -1,18 +1,23 @@
package net.shadowfacts.extrahoppers package net.shadowfacts.extrahoppers
import net.fabricmc.api.ClientModInitializer 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.ContainerScreenFactory
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry 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.GoldHopperContainer
import net.shadowfacts.extrahoppers.block.gold.GoldHopperScreen import net.shadowfacts.extrahoppers.block.gold.GoldHopperScreen
import net.shadowfacts.extrahoppers.block.wood.WoodHopperContainer import net.shadowfacts.extrahoppers.block.wood.WoodHopperContainer
import net.shadowfacts.extrahoppers.block.wood.WoodHopperScreen import net.shadowfacts.extrahoppers.block.wood.WoodHopperScreen
import net.shadowfacts.extrahoppers.init.EHBlocks
object ExtraHoppersClient: ClientModInitializer { object ExtraHoppersClient: ClientModInitializer {
override fun onInitializeClient() { override fun onInitializeClient() {
ScreenProviderRegistry.INSTANCE.registerFactory(WoodHopperContainer.ID, ContainerScreenFactory(WoodHopperScreen.Companion::create)) ScreenProviderRegistry.INSTANCE.registerFactory(WoodHopperContainer.ID, ContainerScreenFactory(WoodHopperScreen.Companion::create))
ScreenProviderRegistry.INSTANCE.registerFactory(GoldHopperContainer.ID, ContainerScreenFactory(GoldHopperScreen.Companion::create)) ScreenProviderRegistry.INSTANCE.registerFactory(GoldHopperContainer.ID, ContainerScreenFactory(GoldHopperScreen.Companion::create))
BlockRenderLayerMap.INSTANCE.putBlock(EHBlocks.GRATE, RenderLayer.getCutout())
} }
} }

View File

@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.block.FabricBlockSettings
import net.minecraft.block.* import net.minecraft.block.*
import net.minecraft.block.enums.BlockHalf import net.minecraft.block.enums.BlockHalf
import net.minecraft.entity.EntityContext import net.minecraft.entity.EntityContext
import net.minecraft.entity.EntityType
import net.minecraft.fluid.Fluid import net.minecraft.fluid.Fluid
import net.minecraft.fluid.FluidState import net.minecraft.fluid.FluidState
import net.minecraft.fluid.Fluids import net.minecraft.fluid.Fluids
@ -37,8 +38,8 @@ class GrateBlock: BlockWithEntity<GrateBlockEntity>(
val HALF = Properties.BLOCK_HALF val HALF = Properties.BLOCK_HALF
val TOP_SHAPE = createCuboidShape(0.0, 15.0, 0.0, 16.0, 16.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, 1.0, 16.0) val BOTTOM_SHAPE = createCuboidShape(0.0, 0.0, 0.0, 16.0, 2.0, 16.0)
} }
init { init {
@ -75,6 +76,18 @@ class GrateBlock: BlockWithEntity<GrateBlockEntity>(
override fun createBlockEntity(world: BlockView) = GrateBlockEntity() 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 { override fun getFluidState(state: BlockState, world: BlockView, pos: BlockPos): FluidState {
return getBlockEntity(world, pos)?.fluidState ?: Fluids.EMPTY.defaultState return getBlockEntity(world, pos)?.fluidState ?: Fluids.EMPTY.defaultState
} }

View File

@ -1,20 +1,124 @@
{ {
"ambientocclusion": false, "ambientocclusion": false,
"textures": { "textures": {
"face": "extrahoppers:block/grate/face", "face": "extrahoppers:block/grate",
"edge": "extrahoppers:block/grate/edge" "edge": "extrahoppers:block/grate_edge",
"internal": "extrahoppers:block/grate_internal",
"particle": "#face"
}, },
"elements": [ "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], "to": [16, 16, 16],
"faces": { "faces": {
"down": {"texture": "#face"}, "down": {"texture": "#face"},
"up": {"texture": "#face", "cullface": "up"}, "up": {"texture": "#face", "cullface": "up"},
"west": {"texture": "#edge"},
"east": {"texture": "#edge", "cullface": "east"},
"north": {"texture": "#edge", "cullface": "north"}, "north": {"texture": "#edge", "cullface": "north"},
"south": {"texture": "#edge", "cullface": "south"}, "south": {"texture": "#edge", "cullface": "south"}
"west": {"texture": "#edge", "cullface": "west"}, }
"east": {"texture": "#edge", "cullface": "east"} },
{
"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]}
} }
} }
], ],

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB