From f8cf4bf64df1c55ae0ccff8db2cba1f205e7bf32 Mon Sep 17 00:00:00 2001 From: bazke Date: Sun, 13 Oct 2024 22:24:29 +0200 Subject: [PATCH] Add ceiling carpet blocks (moss, sand, green wool) --- .../green_wool_ceiling_carpet.json | 9 +++ .../moss_block_ceiling_carpet.json | 9 +++ .../blockstates/sand_ceiling_carpet.json | 9 +++ .../resources/assets/ltextras/lang/en_ud.json | 3 + .../resources/assets/ltextras/lang/en_us.json | 3 + .../block/green_wool_ceiling_carpet.json | 76 +++++++++++++++++++ .../block/moss_block_ceiling_carpet.json | 76 +++++++++++++++++++ .../models/block/sand_ceiling_carpet.json | 76 +++++++++++++++++++ .../item/green_wool_ceiling_carpet.json | 3 + .../item/moss_block_ceiling_carpet.json | 3 + .../models/item/sand_ceiling_carpet.json | 3 + .../blocks/green_wool_ceiling_carpet.json | 21 +++++ .../blocks/moss_block_ceiling_carpet.json | 21 +++++ .../blocks/sand_ceiling_carpet.json | 21 +++++ .../com/lovetropics/extras/ExtraBlocks.java | 33 +++++++- .../extras/block/CeilingCarpetBlock.java | 29 +++++++ 16 files changed, 393 insertions(+), 2 deletions(-) create mode 100644 src/generated/resources/assets/ltextras/blockstates/green_wool_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/blockstates/moss_block_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/blockstates/sand_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/models/block/green_wool_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/models/block/moss_block_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/models/block/sand_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/models/item/green_wool_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/models/item/moss_block_ceiling_carpet.json create mode 100644 src/generated/resources/assets/ltextras/models/item/sand_ceiling_carpet.json create mode 100644 src/generated/resources/data/ltextras/loot_table/blocks/green_wool_ceiling_carpet.json create mode 100644 src/generated/resources/data/ltextras/loot_table/blocks/moss_block_ceiling_carpet.json create mode 100644 src/generated/resources/data/ltextras/loot_table/blocks/sand_ceiling_carpet.json create mode 100644 src/main/java/com/lovetropics/extras/block/CeilingCarpetBlock.java diff --git a/src/generated/resources/assets/ltextras/blockstates/green_wool_ceiling_carpet.json b/src/generated/resources/assets/ltextras/blockstates/green_wool_ceiling_carpet.json new file mode 100644 index 00000000..f037511e --- /dev/null +++ b/src/generated/resources/assets/ltextras/blockstates/green_wool_ceiling_carpet.json @@ -0,0 +1,9 @@ +{ + "multipart": [ + { + "apply": { + "model": "ltextras:block/green_wool_ceiling_carpet" + } + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/blockstates/moss_block_ceiling_carpet.json b/src/generated/resources/assets/ltextras/blockstates/moss_block_ceiling_carpet.json new file mode 100644 index 00000000..e972ee96 --- /dev/null +++ b/src/generated/resources/assets/ltextras/blockstates/moss_block_ceiling_carpet.json @@ -0,0 +1,9 @@ +{ + "multipart": [ + { + "apply": { + "model": "ltextras:block/moss_block_ceiling_carpet" + } + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/blockstates/sand_ceiling_carpet.json b/src/generated/resources/assets/ltextras/blockstates/sand_ceiling_carpet.json new file mode 100644 index 00000000..22e1cc73 --- /dev/null +++ b/src/generated/resources/assets/ltextras/blockstates/sand_ceiling_carpet.json @@ -0,0 +1,9 @@ +{ + "multipart": [ + { + "apply": { + "model": "ltextras:block/sand_ceiling_carpet" + } + } + ] +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/lang/en_ud.json b/src/generated/resources/assets/ltextras/lang/en_ud.json index 72fb4dc4..ae95475b 100644 --- a/src/generated/resources/assets/ltextras/lang/en_ud.json +++ b/src/generated/resources/assets/ltextras/lang/en_ud.json @@ -46,6 +46,7 @@ "block.ltextras.green_concrete_powder_stairs": "sɹıɐʇS ɹǝpʍoԀ ǝʇǝɹɔuoƆ uǝǝɹ⅁", "block.ltextras.green_glow_sticks": "sʞɔıʇS ʍoן⅁ uǝǝɹ⅁", "block.ltextras.green_seat": "ʇɐǝS uǝǝɹ⅁", + "block.ltextras.green_wool_ceiling_carpet": "ʇǝdɹɐƆ buıןıǝƆ ןooM uǝǝɹ⅁", "block.ltextras.halodule_pinifolia": "ssɐɹbɐǝS", "block.ltextras.halodule_uninervis": "ssɐɹbɐǝS", "block.ltextras.halodule_uninervis_block": "ʞɔoןᗺ ssɐɹbɐǝS", @@ -103,6 +104,7 @@ "block.ltextras.metal_ladder": "ɹǝppɐꞀ ןɐʇǝW", "block.ltextras.metal_scaffolding": "buıpןoɟɟɐɔS ןɐʇǝW", "block.ltextras.mob_controller": "ɹǝןןoɹʇuoƆ qoW", + "block.ltextras.moss_block_ceiling_carpet": "ʇǝdɹɐƆ buıןıǝƆ ʞɔoןᗺ ssoW", "block.ltextras.moss_block_slab": "qɐןS ʞɔoןᗺ ssoW", "block.ltextras.moss_block_stairs": "sɹıɐʇS ʞɔoןᗺ ssoW", "block.ltextras.old_rope": "ǝdoᴚ pןO", @@ -142,6 +144,7 @@ "block.ltextras.rusty_painted_metal_slab": "qɐןS ןɐʇǝW pǝʇuıɐԀ ʎʇsnᴚ", "block.ltextras.rusty_painted_metal_stairs": "sɹıɐʇS ןɐʇǝW pǝʇuıɐԀ ʎʇsnᴚ", "block.ltextras.rusty_painted_metal_wall": "ןןɐM ןɐʇǝW pǝʇuıɐԀ ʎʇsnᴚ", + "block.ltextras.sand_ceiling_carpet": "ʇǝdɹɐƆ buıןıǝƆ puɐS", "block.ltextras.sliced_lime": "ǝɯıꞀ pǝɔıןS", "block.ltextras.smooth_light_gray_stained_glass": "ssɐן⅁ pǝuıɐʇS ʎɐɹ⅁ ʇɥbıꞀ ɥʇooɯS", "block.ltextras.speedy_black_concrete_powder": "ɹǝpʍoԀ ǝʇǝɹɔuoƆ ʞɔɐןᗺ ʎpǝǝdS", diff --git a/src/generated/resources/assets/ltextras/lang/en_us.json b/src/generated/resources/assets/ltextras/lang/en_us.json index b60a6801..8e05719b 100644 --- a/src/generated/resources/assets/ltextras/lang/en_us.json +++ b/src/generated/resources/assets/ltextras/lang/en_us.json @@ -46,6 +46,7 @@ "block.ltextras.green_concrete_powder_stairs": "Green Concrete Powder Stairs", "block.ltextras.green_glow_sticks": "Green Glow Sticks", "block.ltextras.green_seat": "Green Seat", + "block.ltextras.green_wool_ceiling_carpet": "Green Wool Ceiling Carpet", "block.ltextras.halodule_pinifolia": "Seagrass", "block.ltextras.halodule_uninervis": "Seagrass", "block.ltextras.halodule_uninervis_block": "Seagrass Block", @@ -103,6 +104,7 @@ "block.ltextras.metal_ladder": "Metal Ladder", "block.ltextras.metal_scaffolding": "Metal Scaffolding", "block.ltextras.mob_controller": "Mob Controller", + "block.ltextras.moss_block_ceiling_carpet": "Moss Block Ceiling Carpet", "block.ltextras.moss_block_slab": "Moss Block Slab", "block.ltextras.moss_block_stairs": "Moss Block Stairs", "block.ltextras.old_rope": "Old Rope", @@ -142,6 +144,7 @@ "block.ltextras.rusty_painted_metal_slab": "Rusty Painted Metal Slab", "block.ltextras.rusty_painted_metal_stairs": "Rusty Painted Metal Stairs", "block.ltextras.rusty_painted_metal_wall": "Rusty Painted Metal Wall", + "block.ltextras.sand_ceiling_carpet": "Sand Ceiling Carpet", "block.ltextras.sliced_lime": "Sliced Lime", "block.ltextras.smooth_light_gray_stained_glass": "Smooth Light Gray Stained Glass", "block.ltextras.speedy_black_concrete_powder": "Speedy Black Concrete Powder", diff --git a/src/generated/resources/assets/ltextras/models/block/green_wool_ceiling_carpet.json b/src/generated/resources/assets/ltextras/models/block/green_wool_ceiling_carpet.json new file mode 100644 index 00000000..8ecc82f7 --- /dev/null +++ b/src/generated/resources/assets/ltextras/models/block/green_wool_ceiling_carpet.json @@ -0,0 +1,76 @@ +{ + "parent": "minecraft:block/thin_block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#particle", + "tintindex": 0 + }, + "east": { + "cullface": "east", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "north": { + "cullface": "north", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "south": { + "cullface": "south", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "up": { + "cullface": "up", + "texture": "#particle", + "tintindex": 0 + }, + "west": { + "cullface": "west", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + } + }, + "from": [ + 0, + 15, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + } + ], + "textures": { + "particle": "minecraft:block/green_wool" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/models/block/moss_block_ceiling_carpet.json b/src/generated/resources/assets/ltextras/models/block/moss_block_ceiling_carpet.json new file mode 100644 index 00000000..4c2bbc2c --- /dev/null +++ b/src/generated/resources/assets/ltextras/models/block/moss_block_ceiling_carpet.json @@ -0,0 +1,76 @@ +{ + "parent": "minecraft:block/thin_block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#particle", + "tintindex": 0 + }, + "east": { + "cullface": "east", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "north": { + "cullface": "north", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "south": { + "cullface": "south", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "up": { + "cullface": "up", + "texture": "#particle", + "tintindex": 0 + }, + "west": { + "cullface": "west", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + } + }, + "from": [ + 0, + 15, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + } + ], + "textures": { + "particle": "minecraft:block/moss_block" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/models/block/sand_ceiling_carpet.json b/src/generated/resources/assets/ltextras/models/block/sand_ceiling_carpet.json new file mode 100644 index 00000000..a8d72082 --- /dev/null +++ b/src/generated/resources/assets/ltextras/models/block/sand_ceiling_carpet.json @@ -0,0 +1,76 @@ +{ + "parent": "minecraft:block/thin_block", + "elements": [ + { + "faces": { + "down": { + "cullface": "down", + "texture": "#particle", + "tintindex": 0 + }, + "east": { + "cullface": "east", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "north": { + "cullface": "north", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "south": { + "cullface": "south", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + }, + "up": { + "cullface": "up", + "texture": "#particle", + "tintindex": 0 + }, + "west": { + "cullface": "west", + "texture": "#particle", + "tintindex": 0, + "uv": [ + 0.0, + 15.0, + 16.0, + 16.0 + ] + } + }, + "from": [ + 0, + 15, + 0 + ], + "to": [ + 16, + 16, + 16 + ] + } + ], + "textures": { + "particle": "minecraft:block/sand" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/models/item/green_wool_ceiling_carpet.json b/src/generated/resources/assets/ltextras/models/item/green_wool_ceiling_carpet.json new file mode 100644 index 00000000..866f9344 --- /dev/null +++ b/src/generated/resources/assets/ltextras/models/item/green_wool_ceiling_carpet.json @@ -0,0 +1,3 @@ +{ + "parent": "ltextras:block/green_wool_ceiling_carpet" +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/models/item/moss_block_ceiling_carpet.json b/src/generated/resources/assets/ltextras/models/item/moss_block_ceiling_carpet.json new file mode 100644 index 00000000..a40d7572 --- /dev/null +++ b/src/generated/resources/assets/ltextras/models/item/moss_block_ceiling_carpet.json @@ -0,0 +1,3 @@ +{ + "parent": "ltextras:block/moss_block_ceiling_carpet" +} \ No newline at end of file diff --git a/src/generated/resources/assets/ltextras/models/item/sand_ceiling_carpet.json b/src/generated/resources/assets/ltextras/models/item/sand_ceiling_carpet.json new file mode 100644 index 00000000..daa1475e --- /dev/null +++ b/src/generated/resources/assets/ltextras/models/item/sand_ceiling_carpet.json @@ -0,0 +1,3 @@ +{ + "parent": "ltextras:block/sand_ceiling_carpet" +} \ No newline at end of file diff --git a/src/generated/resources/data/ltextras/loot_table/blocks/green_wool_ceiling_carpet.json b/src/generated/resources/data/ltextras/loot_table/blocks/green_wool_ceiling_carpet.json new file mode 100644 index 00000000..7348545c --- /dev/null +++ b/src/generated/resources/data/ltextras/loot_table/blocks/green_wool_ceiling_carpet.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "ltextras:green_wool_ceiling_carpet" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "ltextras:blocks/green_wool_ceiling_carpet" +} \ No newline at end of file diff --git a/src/generated/resources/data/ltextras/loot_table/blocks/moss_block_ceiling_carpet.json b/src/generated/resources/data/ltextras/loot_table/blocks/moss_block_ceiling_carpet.json new file mode 100644 index 00000000..10884d15 --- /dev/null +++ b/src/generated/resources/data/ltextras/loot_table/blocks/moss_block_ceiling_carpet.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "ltextras:moss_block_ceiling_carpet" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "ltextras:blocks/moss_block_ceiling_carpet" +} \ No newline at end of file diff --git a/src/generated/resources/data/ltextras/loot_table/blocks/sand_ceiling_carpet.json b/src/generated/resources/data/ltextras/loot_table/blocks/sand_ceiling_carpet.json new file mode 100644 index 00000000..119afeaa --- /dev/null +++ b/src/generated/resources/data/ltextras/loot_table/blocks/sand_ceiling_carpet.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "ltextras:sand_ceiling_carpet" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "ltextras:blocks/sand_ceiling_carpet" +} \ No newline at end of file diff --git a/src/main/java/com/lovetropics/extras/ExtraBlocks.java b/src/main/java/com/lovetropics/extras/ExtraBlocks.java index e7dbb8d6..c89179bb 100644 --- a/src/main/java/com/lovetropics/extras/ExtraBlocks.java +++ b/src/main/java/com/lovetropics/extras/ExtraBlocks.java @@ -16,9 +16,7 @@ import com.tterrag.registrate.util.entry.BlockEntityEntry; import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.nullness.NonNullSupplier; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; @@ -864,6 +862,37 @@ public InteractionResultHolder use(Level leve, Player player, Interac .build() .register(); + + private static final TemplateBuilder> CEILING_CARPET_TEMPLATES = new TemplateBuilder>() + .add(Blocks.SAND, CeilingCarpetBlock::new) + .add(Blocks.GREEN_WOOL, CeilingCarpetBlock::new) + .add(Blocks.MOSS_BLOCK, CeilingCarpetBlock::new); + + public static final Map, BlockEntry> CEILING_CARPET_BLOCKS = CEILING_CARPET_TEMPLATES + .build((object, factory) -> REGISTRATE.block(getName(object) + "_ceiling_carpet", CeilingCarpetBlock::new) + .initialProperties(() -> Blocks.WHITE_CARPET) + .blockstate((ctx, prov) -> { + final MultiPartBlockStateBuilder builder = prov.getMultipartBuilder(ctx.getEntry()); + final BlockModelBuilder end = prov.models().withExistingParent(ctx.getName(), prov.mcLoc("block/thin_block")) + .texture("particle", prov.blockTexture(object.value())) + .element() + .from(0, 15, 0) + .to(16, 16, 16) + .face(Direction.DOWN).texture("#particle").uvs(0, 0, 16, 16).cullface(Direction.DOWN).tintindex(0).end() + .face(Direction.UP).texture("#particle").uvs(0, 0, 16, 16).cullface(Direction.UP).tintindex(0).end() + .face(Direction.NORTH).texture("#particle").uvs(0, 15, 16, 16).cullface(Direction.NORTH).tintindex(0).end() + .face(Direction.SOUTH).texture("#particle").uvs(0, 15, 16, 16).cullface(Direction.SOUTH).tintindex(0).end() + .face(Direction.WEST).texture("#particle").uvs(0, 15, 16, 16).cullface(Direction.WEST).tintindex(0).end() + .face(Direction.EAST).texture("#particle").uvs(0, 15, 16, 16).cullface(Direction.EAST).tintindex(0).end() + .end(); + builder.part() + .modelFile(end).addModel() + .end(); + }) + .simpleItem() + .register() + ); + public static final Set> SEAT_BLOCKS = Stream.of(DyeColor.values()) .map(ExtraBlocks::seat) .collect(Collectors.toSet()); diff --git a/src/main/java/com/lovetropics/extras/block/CeilingCarpetBlock.java b/src/main/java/com/lovetropics/extras/block/CeilingCarpetBlock.java new file mode 100644 index 00000000..0a64a1a3 --- /dev/null +++ b/src/main/java/com/lovetropics/extras/block/CeilingCarpetBlock.java @@ -0,0 +1,29 @@ +package com.lovetropics.extras.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CarpetBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class CeilingCarpetBlock extends CarpetBlock { + + private static final VoxelShape SHAPE = Block.box(0.0D, 15.0D, 0.0D, 16.0D, 16.0D, 16.0D); + + public CeilingCarpetBlock(Properties props) { + super(props); + } + + @Override + protected VoxelShape getShape(final BlockState blockState, final BlockGetter blockGetter, final BlockPos blockPos, final CollisionContext collisionContext) { + return SHAPE; + } + + @Override + protected boolean canSurvive(final BlockState blockState, final LevelReader levelReader, final BlockPos blockPos) { + return !levelReader.isEmptyBlock(blockPos.above()); + } +}