From 5cc17eabd4fc47e7d19f895d690f2d5297981781 Mon Sep 17 00:00:00 2001 From: Agatha Rose Date: Sat, 22 May 2021 20:32:35 +0300 Subject: [PATCH] Add asbestos roof tiles --- .../agatharose/asbestos/AsbestosRegistry.java | 11 ++ .../asbestos/block/AsbestosRoofBlock.java | 63 ++++++++++++ .../{ => block}/CarcinogenicBlock.java | 3 +- .../blockstates/asbestos_roof_block.json | 19 ++++ .../resources/assets/asbestos/lang/en_us.json | 1 + .../models/block/asbestos_roof_block.json | 97 ++++++++++++++++++ .../models/item/asbestos_roof_block.json | 3 + .../textures/block/asbestos_roof_side.png | Bin 0 -> 314 bytes .../textures/block/asbestos_roof_top.png | Bin 0 -> 500 bytes .../blocks/asbestos_roof_block.json | 19 ++++ .../asbestos/recipes/asbestos_roof_block.json | 23 +++++ 11 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 src/main/java/dev/agatharose/asbestos/block/AsbestosRoofBlock.java rename src/main/java/dev/agatharose/asbestos/{ => block}/CarcinogenicBlock.java (94%) create mode 100644 src/main/resources/assets/asbestos/blockstates/asbestos_roof_block.json create mode 100644 src/main/resources/assets/asbestos/models/block/asbestos_roof_block.json create mode 100644 src/main/resources/assets/asbestos/models/item/asbestos_roof_block.json create mode 100644 src/main/resources/assets/asbestos/textures/block/asbestos_roof_side.png create mode 100644 src/main/resources/assets/asbestos/textures/block/asbestos_roof_top.png create mode 100644 src/main/resources/data/asbestos/loot_tables/blocks/asbestos_roof_block.json create mode 100644 src/main/resources/data/asbestos/recipes/asbestos_roof_block.json diff --git a/src/main/java/dev/agatharose/asbestos/AsbestosRegistry.java b/src/main/java/dev/agatharose/asbestos/AsbestosRegistry.java index ebe88b1..3da9df4 100644 --- a/src/main/java/dev/agatharose/asbestos/AsbestosRegistry.java +++ b/src/main/java/dev/agatharose/asbestos/AsbestosRegistry.java @@ -1,5 +1,7 @@ package dev.agatharose.asbestos; +import dev.agatharose.asbestos.block.AsbestosRoofBlock; +import dev.agatharose.asbestos.block.CarcinogenicBlock; import dev.agatharose.asbestos.item.PpeArmorMaterial; import dev.agatharose.asbestos.item.ScraperItem; import dev.agatharose.asbestos.item.ScraperToolMaterial; @@ -54,6 +56,9 @@ public class AsbestosRegistry { FabricBlockSettings.of(Material.STONE).hardness(3.0f).sounds(BlockSoundGroup.NETHER_BRICKS), 20); + public static final AsbestosRoofBlock ASBESTOS_ROOF_BLOCK = new AsbestosRoofBlock(FabricBlockSettings + .of(Material.STONE).hardness(3.0f).sounds(BlockSoundGroup.NETHER_BRICKS).nonOpaque(), 20); + public static ToolItem IRON_SCRAPER = new ScraperItem(ScraperToolMaterial.INSTANCE, 0.0f, -3.0f, new Item.Settings().group(ItemGroup.TOOLS)); @@ -104,6 +109,12 @@ public class AsbestosRegistry { Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_tile_block"), new BlockItem( ASBESTOS_TILE_BLOCK, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS))); + // asbestos roof tile block + Registry.register(Registry.BLOCK, new Identifier("asbestos", "asbestos_roof_block"), + ASBESTOS_ROOF_BLOCK); + Registry.register(Registry.ITEM, new Identifier("asbestos", "asbestos_roof_block"), new BlockItem( + ASBESTOS_ROOF_BLOCK, new Item.Settings().group(ItemGroup.BUILDING_BLOCKS))); + // serpentinite worldgen RegistryKey> serpentiniteOverworld = RegistryKey.of( Registry.CONFIGURED_FEATURE_WORLDGEN, diff --git a/src/main/java/dev/agatharose/asbestos/block/AsbestosRoofBlock.java b/src/main/java/dev/agatharose/asbestos/block/AsbestosRoofBlock.java new file mode 100644 index 0000000..b8009e4 --- /dev/null +++ b/src/main/java/dev/agatharose/asbestos/block/AsbestosRoofBlock.java @@ -0,0 +1,63 @@ +package dev.agatharose.asbestos.block; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.Properties; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; + +public class AsbestosRoofBlock extends CarcinogenicBlock { + public AsbestosRoofBlock(Settings settings, int dangerousness) { + super(settings, dangerousness); + + setDefaultState(this.getStateManager().getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH)); + + if (FabricLoader.getInstance().getEnvironmentType() != EnvType.SERVER) { + BlockRenderLayerMap.INSTANCE.putBlock(this, RenderLayer.getCutout()); + } + } + + @Override + protected void appendProperties(StateManager.Builder stateManager) { + stateManager.add(Properties.HORIZONTAL_FACING); + } + + @Override + public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { + Direction dir = state.get(Properties.HORIZONTAL_FACING); + switch (dir) { + case NORTH: + return VoxelShapes.union(VoxelShapes.cuboid(0, 0, 0, 1, 0.5, 1), VoxelShapes.cuboid(1, 0.5, 1, 0, 1, 0.5)); + case SOUTH: + return VoxelShapes.union(VoxelShapes.cuboid(0, 0, 0, 1, 0.5, 1), VoxelShapes.cuboid(0, 0.5, 0, 1, 1, 0.5)); + case EAST: + return VoxelShapes.union(VoxelShapes.cuboid(0, 0, 0, 1, 0.5, 1), VoxelShapes.cuboid(0, 0.5, 0, 0.5, 1, 1)); + case WEST: + return VoxelShapes.union(VoxelShapes.cuboid(0, 0, 0, 1, 0.5, 1), VoxelShapes.cuboid(1, 0.5, 0, 0.5, 1, 1)); + default: + return VoxelShapes.fullCube(); + } + } + + public BlockState getPlacementState(ItemPlacementContext ctx) { + return (BlockState) this.getDefaultState().with(Properties.HORIZONTAL_FACING, + ctx.getPlayerFacing().getOpposite()); + } + + @Environment(EnvType.CLIENT) + @Override + public float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) { + return 1.0F; + } +} diff --git a/src/main/java/dev/agatharose/asbestos/CarcinogenicBlock.java b/src/main/java/dev/agatharose/asbestos/block/CarcinogenicBlock.java similarity index 94% rename from src/main/java/dev/agatharose/asbestos/CarcinogenicBlock.java rename to src/main/java/dev/agatharose/asbestos/block/CarcinogenicBlock.java index d486b40..92aa214 100644 --- a/src/main/java/dev/agatharose/asbestos/CarcinogenicBlock.java +++ b/src/main/java/dev/agatharose/asbestos/block/CarcinogenicBlock.java @@ -1,5 +1,6 @@ -package dev.agatharose.asbestos; +package dev.agatharose.asbestos.block; +import dev.agatharose.asbestos.Asbestos; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/resources/assets/asbestos/blockstates/asbestos_roof_block.json b/src/main/resources/assets/asbestos/blockstates/asbestos_roof_block.json new file mode 100644 index 0000000..dbb024d --- /dev/null +++ b/src/main/resources/assets/asbestos/blockstates/asbestos_roof_block.json @@ -0,0 +1,19 @@ +{ + "variants": { + "facing=north": { + "model": "asbestos:block/asbestos_roof_block" + }, + "facing=east": { + "model": "asbestos:block/asbestos_roof_block", + "y": 90 + }, + "facing=south": { + "model": "asbestos:block/asbestos_roof_block", + "y": 180 + }, + "facing=west": { + "model": "asbestos:block/asbestos_roof_block", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/lang/en_us.json b/src/main/resources/assets/asbestos/lang/en_us.json index 7120511..9d7f17a 100644 --- a/src/main/resources/assets/asbestos/lang/en_us.json +++ b/src/main/resources/assets/asbestos/lang/en_us.json @@ -3,6 +3,7 @@ "block.asbestos.serpentinite_block": "Serpentinite", "block.asbestos.popcorn_ceiling_block": "Popcorn Ceiling", "block.asbestos.asbestos_tile_block": "Asbestos Tiles", + "block.asbestos.asbestos_roof_block": "Asbestos Roof Tiles", "item.asbestos.asbestos_fibers": "Asbests Fibers", "item.asbestos.iron_scraper": "Asbestos Scraper", "item.asbestos.ppe_helmet": "Asbestos Removal PPE Helmet", diff --git a/src/main/resources/assets/asbestos/models/block/asbestos_roof_block.json b/src/main/resources/assets/asbestos/models/block/asbestos_roof_block.json new file mode 100644 index 0000000..53f3271 --- /dev/null +++ b/src/main/resources/assets/asbestos/models/block/asbestos_roof_block.json @@ -0,0 +1,97 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "0": "asbestos:block/asbestos_roof_top", + "1": "asbestos:block/asbestos_roof_side", + "particle": "asbestos:block/asbestos_roof_top" + }, + "elements": [ + { + "from": [0.001, 0, 1], + "to": [2, 2, 16], + "faces": { + "north": {"uv": [8, 7, 10, 9], "texture": "#1"}, + "east": {"uv": [1, 0, 16, 16], "texture": "#1"}, + "south": {"uv": [14, 7, 16, 9], "texture": "#1", "cullface": "south"}, + "west": {"uv": [0, 0, 15, 16], "rotation": 180, "texture": "#1"}, + "up": {"uv": [0, 0, 15, 16], "rotation": 90, "texture": "#1"}, + "down": {"uv": [1, 0, 16, 16], "rotation": 270, "texture": "#1", "cullface": "down"} + } + }, + { + "from": [14, 0, 1], + "to": [15.999, 2, 16], + "faces": { + "north": {"uv": [9, 7, 11, 9], "texture": "#1"}, + "east": {"uv": [1, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "south": {"uv": [11, 7, 13, 9], "texture": "#1", "cullface": "south"}, + "west": {"uv": [1, 0, 16, 16], "texture": "#1"}, + "up": {"uv": [0, 0, 15, 16], "rotation": 270, "texture": "#1"}, + "down": {"uv": [0, 0, 15, 16], "rotation": 90, "texture": "#1", "cullface": "down"} + } + }, + { + "from": [14, 2, 14], + "to": [15.999, 15, 16], + "faces": { + "north": {"uv": [0, 0, 13, 16], "rotation": 90, "texture": "#1"}, + "east": {"uv": [0, 0, 13, 16], "rotation": 270, "texture": "#1"}, + "south": {"uv": [0, 0, 13, 16], "rotation": 90, "texture": "#1", "cullface": "south"}, + "west": {"uv": [0, 0, 13, 16], "rotation": 270, "texture": "#1"}, + "up": {"uv": [2, 0, 4, 2], "rotation": 270, "texture": "#1"} + } + }, + { + "from": [0.001, 2, 14], + "to": [2, 15, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [1, 8, 15]}, + "faces": { + "north": {"uv": [0, 0, 13, 16], "rotation": 270, "texture": "#1"}, + "east": {"uv": [0, 0, 13, 16], "rotation": 90, "texture": "#1"}, + "south": {"uv": [0, 0, 13, 16], "rotation": 270, "texture": "#1", "cullface": "south"}, + "west": {"uv": [0, 0, 13, 16], "rotation": 90, "texture": "#1"}, + "up": {"uv": [5, 12, 7, 14], "texture": "#1"} + } + }, + { + "from": [2, 0, 14], + "to": [14, 2, 16], + "faces": { + "north": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "south": {"uv": [0, 0, 12, 16], "rotation": 180, "texture": "#1", "cullface": "south"}, + "up": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 12, 16], "texture": "#1", "cullface": "down"} + } + }, + { + "from": [2.001, 13, 14], + "to": [14, 15, 16], + "faces": { + "north": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "south": {"uv": [0, 0, 12, 16], "rotation": 180, "texture": "#1", "cullface": "south"}, + "up": {"uv": [0, 0, 12, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 12, 16], "texture": "#1"} + } + }, + { + "from": [0, 0.70711, -0.70711], + "to": [16, 23.35711, 0.29289], + "rotation": {"angle": 45, "axis": "x", "origin": [0, 0.70711, -0.70711]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 1, 16], "texture": "#0", "cullface": "east"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [7, 0, 8, 16], "texture": "#0", "cullface": "west"}, + "up": {"uv": [0, 8, 16, 8], "rotation": 180, "texture": "#0", "cullface": "up"}, + "down": {"uv": [0, 8, 16, 8], "rotation": 180, "texture": "#0", "cullface": "north"} + } + } + ], + "display": { + "fixed": { + "rotation": [0, 90, 0], + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/models/item/asbestos_roof_block.json b/src/main/resources/assets/asbestos/models/item/asbestos_roof_block.json new file mode 100644 index 0000000..c9f6a58 --- /dev/null +++ b/src/main/resources/assets/asbestos/models/item/asbestos_roof_block.json @@ -0,0 +1,3 @@ +{ + "parent": "asbestos:block/asbestos_roof_block" +} \ No newline at end of file diff --git a/src/main/resources/assets/asbestos/textures/block/asbestos_roof_side.png b/src/main/resources/assets/asbestos/textures/block/asbestos_roof_side.png new file mode 100644 index 0000000000000000000000000000000000000000..e9fc9625865798a3dfa07575ee386415886de74c GIT binary patch literal 314 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~f!3-qRjMp3nQjEnx?oJHr&dIz4a=HS1LR`fa zEL5%HY~s58`*#)ZyS(J?ZAoKY)i6D`CZp2j&MQtuT(~vSSKFw{!*OkS_<Eal|F*8|U(gcA=f{&gG3O#!G@afZu2@@C$8T~e0iXv R)f%Xt!PC{xWt~$(698FTi?RR! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/asbestos/textures/block/asbestos_roof_top.png b/src/main/resources/assets/asbestos/textures/block/asbestos_roof_top.png new file mode 100644 index 0000000000000000000000000000000000000000..4bbb8e898da2633936f029f1ff44371f2274fae1 GIT binary patch literal 500 zcmVPx$u1Q2eR5*=|lf6m($LS`2dNF{_|j2h91Xs3k_pok*)47MT`BE&+wSPB** zSSUV|B1SQ4j4XjvfV-|V@m`K7fl0HqWXE9=VuEKFB9JUT`x zh1S~K5xrV2kr5G~P#MSfJlv3ESI=j2q-{~+_TeQ`z)iOGv^{}bn3)^};QjL>R@~Lo zT5C$xDFAw580nDD=1h`3x~-?}%1QqJ`fe# z$@rJ*)pCj2ejU-1y4UvWWP;Z>(?yD$pPU0wu8a}11EY)0%d;zV*rQw-BPAquJ6&|x zLwP>MQW1cIy=_BctN9EN(Ra2se@PrF48>3d493NgVRIHepUsi686Sl5#M~^cyGEjJ zI7mYI{qqB@bu2lCvV@CrKASVs4dTRb;Co&SWdX_lL$L{Dk=!o-39}1sq74f`yK$dr z0e;@#@%rY^PO`0T7?gn+%0L9=B-D3z56N^p-B=eJRU2g+b>;belowYwz5s%DfDU^= qe+QtC>dEN^0IlXT%JWTO(Z2z{!QZH*(%0Ys0000