Skip to content

Commit

Permalink
Add curtains
Browse files Browse the repository at this point in the history
  • Loading branch information
bazke committed Oct 3, 2023
1 parent 5852caf commit 424e6c9
Show file tree
Hide file tree
Showing 14 changed files with 188 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/generated/resources/assets/ltextras/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"block.ltextras.cracked_stone_bricks_slab": "qɐןS sʞɔıɹᗺ ǝuoʇS pǝʞɔɐɹƆ",
"block.ltextras.cracked_stone_bricks_stairs": "sɹıɐʇS sʞɔıɹᗺ ǝuoʇS pǝʞɔɐɹƆ",
"block.ltextras.cracked_stone_bricks_wall": "ןןɐM sʞɔıɹᗺ ǝuoʇS pǝʞɔɐɹƆ",
"block.ltextras.curtain": "uıɐʇɹnƆ",
"block.ltextras.cyan_glow_sticks": "sʞɔıʇS ʍoן⅁ uɐʎƆ",
"block.ltextras.cymodocea_rotundata": "ssɐɹbɐǝS",
"block.ltextras.cymodocea_serrulata": "ssɐɹbɐǝS",
Expand Down
1 change: 1 addition & 0 deletions src/generated/resources/assets/ltextras/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"block.ltextras.cracked_stone_bricks_slab": "Cracked Stone Bricks Slab",
"block.ltextras.cracked_stone_bricks_stairs": "Cracked Stone Bricks Stairs",
"block.ltextras.cracked_stone_bricks_wall": "Cracked Stone Bricks Wall",
"block.ltextras.curtain": "Curtain",
"block.ltextras.cyan_glow_sticks": "Cyan Glow Sticks",
"block.ltextras.cymodocea_rotundata": "Seagrass",
"block.ltextras.cymodocea_serrulata": "Seagrass",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "ltextras:block/curtain"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "ltextras:curtain"
}
],
"rolls": 1.0
}
],
"random_sequence": "ltextras:blocks/curtain"
}
15 changes: 12 additions & 3 deletions src/main/java/com/lovetropics/extras/ExtraBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.lovetropics.extras.block.entity.ParticleEmitterBlockEntity;
import com.lovetropics.extras.data.ImposterBlockTemplate;
import com.lovetropics.extras.data.ModelGenUtil;
import com.lovetropics.extras.item.EntityWandItem;
import com.lovetropics.extras.mixin.BlockPropertiesMixin;
import com.lovetropics.lib.block.CustomShapeBlock;
import com.tterrag.registrate.Registrate;
Expand All @@ -14,7 +13,6 @@
import com.tterrag.registrate.providers.loot.RegistrateBlockLootTables;
import com.tterrag.registrate.util.entry.BlockEntityEntry;
import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.entry.ItemEntry;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import net.minecraft.client.renderer.BiomeColors;
Expand All @@ -27,7 +25,6 @@
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.PlaceOnWaterBlockItem;
import net.minecraft.world.item.ScaffoldingBlockItem;
import net.minecraft.world.level.FoliageColor;
Expand Down Expand Up @@ -625,6 +622,18 @@ private static BlockEntry<CustomSeagrassBlock> seagrass(final String blockName,
public static final BlockEntry<Block> MATTED_THALASSODENDRON_CILIATUM = mattedSeagrassBlock("thalassodendron_ciliatum");
public static final BlockEntry<Block> THALASSODENDRON_CILIATUM_BLOCk = seagrassBlock("thalassodendron_ciliatum");

public static final BlockEntry<CurtainBlock> CURTAIN = REGISTRATE.block("curtain", p -> (CurtainBlock) new CurtainBlock(p) {
})
.initialProperties(() -> Blocks.GLASS_PANE)
.properties(p -> p.sound(SoundType.WOOL))
.blockstate((ctx, prov) -> {
}) // NO-OP, it's easier to just copy the file out of vanilla...
.addLayer(() -> RenderType::solid)
.item()
.model((ctx, prov) -> prov.blockSprite(ctx))
.build()
.register();

private static BlockEntry<Block> seagrassBlock(String name) {
String scientificName = RegistrateLangProvider.toEnglishName(name);
return REGISTRATE.<Block>block(name + "_block", properties -> new ScientificNameBlock(properties, scientificName))
Expand Down
31 changes: 31 additions & 0 deletions src/main/java/com/lovetropics/extras/block/CurtainBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.lovetropics.extras.block;

import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.StainedGlassPaneBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class CurtainBlock extends StainedGlassPaneBlock {
public CurtainBlock(final Properties props) {
super(DyeColor.BLACK, props);
}

@Override
public VoxelShape getCollisionShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
return Shapes.empty();
}

@Override
public int getLightBlock(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
return pLevel.getMaxLightLevel();
}
}
77 changes: 77 additions & 0 deletions src/main/resources/assets/ltextras/blockstates/curtain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"multipart": [
{
"apply": {
"model": "ltextras:block/curtain_post"
}
},
{
"apply": {
"model": "ltextras:block/curtain_side"
},
"when": {
"north": "true"
}
},
{
"apply": {
"model": "ltextras:block/curtain_side",
"y": 90
},
"when": {
"east": "true"
}
},
{
"apply": {
"model": "ltextras:block/curtain_side_alt"
},
"when": {
"south": "true"
}
},
{
"apply": {
"model": "ltextras:block/curtain_side_alt",
"y": 90
},
"when": {
"west": "true"
}
},
{
"apply": {
"model": "ltextras:block/curtain_noside"
},
"when": {
"north": "false"
}
},
{
"apply": {
"model": "ltextras:block/curtain_noside_alt"
},
"when": {
"east": "false"
}
},
{
"apply": {
"model": "ltextras:block/curtain_noside_alt",
"y": 90
},
"when": {
"south": "false"
}
},
{
"apply": {
"model": "ltextras:block/curtain_noside",
"y": 270
},
"when": {
"west": "false"
}
}
]
}
6 changes: 6 additions & 0 deletions src/main/resources/assets/ltextras/models/block/curtain.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "ltextras:block/curtain"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_glass_pane_noside",
"textures": {
"pane": "ltextras:block/curtain"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_glass_pane_noside_alt",
"textures": {
"pane": "ltextras:block/curtain"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_glass_pane_post",
"textures": {
"edge": "minecraft:block/black_stained_glass_pane_top",
"pane": "ltextras:block/curtain"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_glass_pane_side",
"textures": {
"edge": "minecraft:block/black_stained_glass_pane_top",
"pane": "ltextras:block/curtain"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parent": "minecraft:block/template_glass_pane_side_alt",
"textures": {
"edge": "minecraft:block/black_stained_glass_pane_top",
"pane": "ltextras:block/curtain"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 424e6c9

Please sign in to comment.