Add (broken) blue boundary marker

This commit is contained in:
Andrew-71 2023-10-01 00:39:45 +03:00
parent c07961af31
commit dfaa80fc16
28 changed files with 199 additions and 5 deletions

View file

@ -3,7 +3,6 @@
* Add windows * Add windows
* Add (with functionality) present appliance/furniture/electronics textures * Add (with functionality) present appliance/furniture/electronics textures
* Cigarette and handrail are BROKEN and the code is a MESS sorry, but it needs CLEANUP * Cigarette and handrail are BROKEN and the code is a MESS sorry, but it needs CLEANUP
* Fix concrete with bars hitbox
* Fix post lamp hitboxes * Fix post lamp hitboxes
* Add credits in models * Add credits in models

View file

@ -5,10 +5,17 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.minecraft.block.TallPlantBlock;
import net.minecraft.block.enums.DoubleBlockHalf;
import net.minecraft.client.color.world.BiomeColors;
import net.minecraft.client.color.world.GrassColors;
import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayer;
import su.a71.new_soviet.registration.NSE_Blocks; import su.a71.new_soviet.registration.NSE_Blocks;
import su.a71.new_soviet.registration.NSE_Custom; import su.a71.new_soviet.registration.NSE_Custom;
import net.minecraft.client.color.block.BlockColors;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public class NewSovietClient implements ClientModInitializer { public class NewSovietClient implements ClientModInitializer {
@ -38,6 +45,8 @@ public class NewSovietClient implements ClientModInitializer {
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.YELLOW_CONCRETE_WITH_BARS, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.YELLOW_CONCRETE_WITH_BARS, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BLUE_CONCRETE_WITH_BARS, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BLUE_CONCRETE_WITH_BARS, RenderLayer.getCutout());
BlockEntityRendererRegistry.register(NSE_Custom.TV_BLOCK_ENTITY, TVBlockEntityRenderer::new); // BlockEntityRendererRegistry.register(NSE_Custom.TV_BLOCK_ENTITY, TVBlockEntityRenderer::new);
ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0xeb4034, NSE_Blocks.BLUE_BOUNDARY_MARKER);
} }
} }

View file

@ -269,6 +269,9 @@
"new_soviet:metal_plating_stairs", "new_soviet:metal_plating_stairs",
"new_soviet:metal_plating_slab", "new_soviet:metal_plating_slab",
"new_soviet:vintage_lamp", "new_soviet:vintage_lamp",
"new_soviet:light_bulb_lamp" "new_soviet:light_bulb_lamp",
"new_soviet:blue_iron_bars",
"new_soviet:rusty_blue_iron_bars",
"new_soviet:vintage_iron_bars"
] ]
} }

View file

@ -0,0 +1,81 @@
package su.a71.new_soviet.blocks;
import net.minecraft.block.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.DyeItem;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.IntProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
// TODO: BLOCKTAGS! LOOTABLES!
public class BoundaryMarkerBlock extends Block implements Waterloggable {
public static final BooleanProperty WATERLOGGED;
public static final IntProperty COLOUR;
public static final VoxelShape SHAPE;
public BoundaryMarkerBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState()
.with(WATERLOGGED, false)
.with(COLOUR, 0));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(WATERLOGGED, COLOUR);
}
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return SHAPE;
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (player.getInventory().getMainHandStack().getItem() instanceof DyeItem) {
if (!world.isClient()) {
if (!player.isCreative()) {
player.getInventory().getMainHandStack().decrement(1);
}
world.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_DYE_USE, SoundCategory.BLOCKS, 1.0F, 1.0F);
// world.setBlockState(pos, state.with(COLOUR, player.getInventory().getMainHandStack().getItem()))
}
return ActionResult.SUCCESS;
}
return super.onUse(state, world, pos, player, hand, hit);
}
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (state.get(WATERLOGGED)) {
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
}
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
}
public FluidState getFluidState(BlockState state) {
return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
}
static {
WATERLOGGED = Properties.WATERLOGGED;
SHAPE = Block.createCuboidShape(5, 0, 5, 11, 16, 11);
COLOUR = IntProperty.of("border_colour", 0, 16); // 0 - undyed, 1-16 = dyes
}
}

View file

@ -12,6 +12,8 @@ import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView; import net.minecraft.world.WorldView;
@ -20,6 +22,8 @@ import org.jetbrains.annotations.Nullable;
public class ConcreteWithBarsBlock extends HorizontalFacingBlock implements Waterloggable { public class ConcreteWithBarsBlock extends HorizontalFacingBlock implements Waterloggable {
public static final DirectionProperty VERTICAL_DIRECTION; public static final DirectionProperty VERTICAL_DIRECTION;
public static final BooleanProperty WATERLOGGED; public static final BooleanProperty WATERLOGGED;
public static final VoxelShape SHAPE_UP;
public static final VoxelShape SHAPE_DOWN;
public ConcreteWithBarsBlock(Settings settings) { public ConcreteWithBarsBlock(Settings settings) {
super(settings); super(settings);
@ -52,6 +56,13 @@ public class ConcreteWithBarsBlock extends HorizontalFacingBlock implements Wate
} }
} }
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
if (state.get(VERTICAL_DIRECTION) == Direction.DOWN) {
return SHAPE_UP;
}
return SHAPE_DOWN;
}
@Override @Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (state.get(WATERLOGGED)) { if (state.get(WATERLOGGED)) {
@ -67,5 +78,7 @@ public class ConcreteWithBarsBlock extends HorizontalFacingBlock implements Wate
static { static {
VERTICAL_DIRECTION = Properties.VERTICAL_DIRECTION; VERTICAL_DIRECTION = Properties.VERTICAL_DIRECTION;
WATERLOGGED = Properties.WATERLOGGED; WATERLOGGED = Properties.WATERLOGGED;
SHAPE_DOWN = Block.createCuboidShape(0, 0, 0, 16, 8, 16);
SHAPE_UP = Block.createCuboidShape(0, 8, 0, 16, 16, 16);
} }
} }

View file

@ -289,7 +289,10 @@ public class BlockTagGenerator extends FabricTagProvider.BlockTagProvider {
.add(NSE_Blocks.METAL_PLATING_STAIRS) .add(NSE_Blocks.METAL_PLATING_STAIRS)
.add(NSE_Blocks.METAL_PLATING_SLAB) .add(NSE_Blocks.METAL_PLATING_SLAB)
.add(NSE_Custom.VINTAGE_LAMP) .add(NSE_Custom.VINTAGE_LAMP)
.add(NSE_Custom.LIGHT_BULB_LAMP); .add(NSE_Custom.LIGHT_BULB_LAMP)
.add(NSE_Blocks.BLUE_IRON_BARS)
.add(NSE_Blocks.RUSTY_BLUE_IRON_BARS)
.add(NSE_Blocks.VINTAGE_IRON_BARS);
// Blocks mined with an axe // Blocks mined with an axe
getOrCreateTagBuilder(BlockTags.AXE_MINEABLE) getOrCreateTagBuilder(BlockTags.AXE_MINEABLE)

View file

@ -12,6 +12,7 @@ import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.DyeColor; import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import su.a71.new_soviet.blocks.BoundaryMarkerBlock;
import su.a71.new_soviet.blocks.ConcreteWithBarsBlock; import su.a71.new_soviet.blocks.ConcreteWithBarsBlock;
import su.a71.new_soviet.blocks.HandrailBlock; import su.a71.new_soviet.blocks.HandrailBlock;
@ -403,6 +404,8 @@ public class NSE_Blocks extends NSE_BaseRegistration {
public static final StairsBlock NII_FLOOR_STAIRS = new StairsBlock(NII_FLOOR.getDefaultState(), FabricBlockSettings.copy(NII_FLOOR)); public static final StairsBlock NII_FLOOR_STAIRS = new StairsBlock(NII_FLOOR.getDefaultState(), FabricBlockSettings.copy(NII_FLOOR));
public static final SlabBlock NII_FLOOR_SLAB = new SlabBlock(FabricBlockSettings.copy(NII_FLOOR)); public static final SlabBlock NII_FLOOR_SLAB = new SlabBlock(FabricBlockSettings.copy(NII_FLOOR));
public static final Block BLUE_BOUNDARY_MARKER = new BoundaryMarkerBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.STONE).hardness(1.5f).resistance(4f).requiresTool().mapColor(MapColor.TERRACOTTA_BLUE));
// Industrial ========== // Industrial ==========
public static final Block INDUSTRIAL_WARNING = new Block(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).hardness(4f).resistance(6f).requiresTool().mapColor(MapColor.BLACK)); public static final Block INDUSTRIAL_WARNING = new Block(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).hardness(4f).resistance(6f).requiresTool().mapColor(MapColor.BLACK));
public static final Block RED_WARNING = new Block(FabricBlockSettings.copy(INDUSTRIAL_WARNING).mapColor(MapColor.RED)); public static final Block RED_WARNING = new Block(FabricBlockSettings.copy(INDUSTRIAL_WARNING).mapColor(MapColor.RED));
@ -423,7 +426,7 @@ public class NSE_Blocks extends NSE_BaseRegistration {
public static final BarrelBlock CRATE = new BarrelBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.CHISELED_BOOKSHELF).nonOpaque().mapColor(MapColor.OAK_TAN).hardness(1.8f)); public static final BarrelBlock CRATE = new BarrelBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.CHISELED_BOOKSHELF).nonOpaque().mapColor(MapColor.OAK_TAN).hardness(1.8f));
public static final WallBlock CONCRETE_WALL = new WallBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.STONE).mapColor(MapColor.STONE_GRAY)); public static final WallBlock CONCRETE_WALL = new WallBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.STONE).mapColor(MapColor.STONE_GRAY));
public static final HandrailBlock HANDRAIL = new HandrailBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.COPPER).hardness(4f).nonOpaque()); public static final HandrailBlock HANDRAIL = new HandrailBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.COPPER).requiresTool().hardness(4f).nonOpaque());
public static final PaneBlock BLUE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(Blocks.IRON_BARS)); public static final PaneBlock BLUE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(Blocks.IRON_BARS));
public static final PaneBlock RUSTY_BLUE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(BLUE_IRON_BARS)); public static final PaneBlock RUSTY_BLUE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(BLUE_IRON_BARS));
public static final PaneBlock VINTAGE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(Blocks.IRON_BARS)); public static final PaneBlock VINTAGE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(Blocks.IRON_BARS));
@ -831,6 +834,8 @@ public class NSE_Blocks extends NSE_BaseRegistration {
registerBlock("chiseled_spruce_door", () -> CHISELED_SPRUCE_DOOR, NSE_BUILDING_TAB); registerBlock("chiseled_spruce_door", () -> CHISELED_SPRUCE_DOOR, NSE_BUILDING_TAB);
registerBlock("chiseled_birch_door", () -> CHISELED_BIRCH_DOOR, NSE_BUILDING_TAB); registerBlock("chiseled_birch_door", () -> CHISELED_BIRCH_DOOR, NSE_BUILDING_TAB);
registerBlock("blue_boundary_marker", () -> BLUE_BOUNDARY_MARKER, NSE_BUILDING_TAB);
registerBlock("industrial_warning", () -> INDUSTRIAL_WARNING, NSE_BUILDING_TAB); registerBlock("industrial_warning", () -> INDUSTRIAL_WARNING, NSE_BUILDING_TAB);
registerBlock("gray_warning", () -> GRAY_WARNING, NSE_BUILDING_TAB); registerBlock("gray_warning", () -> GRAY_WARNING, NSE_BUILDING_TAB);
registerBlock("red_warning", () -> RED_WARNING, NSE_BUILDING_TAB); registerBlock("red_warning", () -> RED_WARNING, NSE_BUILDING_TAB);

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "new_soviet:block/boundary/blue_boundary_marker"
}
}
}

View file

@ -450,6 +450,8 @@
"block.new_soviet.blue_iron_bars": "Blue Iron Bars", "block.new_soviet.blue_iron_bars": "Blue Iron Bars",
"block.new_soviet.rusty_blue_iron_bars": "Rusty Blue Iron Bars", "block.new_soviet.rusty_blue_iron_bars": "Rusty Blue Iron Bars",
"block.new_soviet.vintage_iron_bars": "Vintage Iron Bars", "block.new_soviet.vintage_iron_bars": "Vintage Iron Bars",
"block.new_soviet.blue_boundary_marker": "Blue Boundary Marker",
"advancement.new_soviet.root.name": "A New Era", "advancement.new_soviet.root.name": "A New Era",
"advancement.new_soviet.root.desc": "Time to create something great" "advancement.new_soviet.root.desc": "Time to create something great"

View file

@ -0,0 +1,69 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "new_soviet:block/boundary_marker/boundary_blue",
"1": "new_soviet:block/boundary_marker/boundary_overlay",
"particle": "new_soviet:block/boundary_marker/boundary_blue"
},
"elements": [
{
"name": "overlay_cube",
"from": [5, 0, 5],
"to": [11, 16, 11],
"faces": {
"north": {"uv": [0, 0, 6, 16], "texture": "#1", "tintindex": 0},
"east": {"uv": [0, 0, 6, 16], "texture": "#1", "tintindex": 0},
"south": {"uv": [0, 0, 6, 16], "texture": "#1", "tintindex": 0},
"west": {"uv": [0, 0, 6, 16], "texture": "#1", "tintindex": 0},
"up": {"uv": [6, 0, 12, 6], "texture": "#1", "tintindex": 0},
"down": {"uv": [6, 6, 12, 12], "texture": "#1", "tintindex": 0}
}
},
{
"from": [5, 0, 5],
"to": [11, 16, 11],
"faces": {
"north": {"uv": [0, 0, 6, 16], "texture": "#0"},
"east": {"uv": [0, 0, 6, 16], "texture": "#0"},
"south": {"uv": [0, 0, 6, 16], "texture": "#0"},
"west": {"uv": [0, 0, 6, 16], "texture": "#0"},
"up": {"uv": [6, 0, 12, 6], "texture": "#0"},
"down": {"uv": [6, 6, 12, 12], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [0, 3, 1],
"scale": [0.55, 0.55, 0.55]
},
"thirdperson_lefthand": {
"translation": [0, 3, 1],
"scale": [0.55, 0.55, 0.55]
},
"firstperson_righthand": {
"rotation": [0, -90, 25],
"translation": [1.13, 3.2, 1.13],
"scale": [0.68, 0.68, 0.68]
},
"firstperson_lefthand": {
"rotation": [0, -90, 25],
"translation": [1.13, 3.2, 1.13],
"scale": [0.68, 0.68, 0.68]
},
"ground": {
"translation": [0, 2, 0],
"scale": [0.5, 0.5, 0.5]
},
"gui": {
"rotation": [30, 225, 0],
"scale": [0.8, 0.8, 0.8]
},
"head": {
"translation": [0, 6.5, 0]
},
"fixed": {
"rotation": [0, 180, 0]
}
}
}

View file

@ -0,0 +1,3 @@
{
"parent": "new_soviet:block/boundary/blue_boundary_marker"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B