Add asbestos roof tiles

This commit is contained in:
Agatha Lovelace 2021-05-22 20:32:35 +03:00
parent 6de376b795
commit 5cc17eabd4
No known key found for this signature in database
GPG Key ID: 2DB18BA2E0A80BC3
11 changed files with 238 additions and 1 deletions

View File

@ -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<ConfiguredFeature<?, ?>> serpentiniteOverworld = RegistryKey.of(
Registry.CONFIGURED_FEATURE_WORLDGEN,

View File

@ -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<Block, BlockState> 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;
}
}

View File

@ -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;

View File

@ -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
}
}
}

View File

@ -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",

View File

@ -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]
}
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "asbestos:block/asbestos_roof_block"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "asbestos:asbestos_roof_block"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,23 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"WA ",
"WBA",
"WWW"
],
"key": {
"A": {
"item": "asbestos:asbestos_fibers"
},
"B": {
"item": "minecraft:stone_bricks"
},
"W": {
"tag": "minecraft:planks"
}
},
"result": {
"item": "asbestos:asbestos_roof_block",
"count": 4
}
}