Add barbed wire

This commit is contained in:
Andrew-71 2023-10-01 17:02:55 +03:00
parent 483f2730e3
commit f1bf483b87
12 changed files with 109 additions and 10 deletions

View file

@ -26,10 +26,10 @@ public class NewSovietClient implements ClientModInitializer {
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.MODERN_POST_LAMP, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.BIG_POST_LAMP, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.VINTAGE_POST_LAMP, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BLUE_IRON_BARS, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.RUSTY_BLUE_IRON_BARS, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.VINTAGE_IRON_BARS, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BARBED_WIRE, RenderLayer.getCutout());
// TODO: Needed?
BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.RED_CONCRETE_WITH_BARS, RenderLayer.getCutout());

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"new_soviet:barbed_wire"
]
}

View file

@ -0,0 +1,30 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
],
"entries": [
{
"type": "minecraft:item",
"name": "new_soviet:barbed_wire"
}
],
"rolls": 1.0
}
]
}

View file

@ -0,0 +1,32 @@
package su.a71.new_soviet.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
public class BarbedWireBlock extends Block {
public BarbedWireBlock(FabricBlockSettings settings) {
super(settings);
}
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) {
entity.slowMovement(state, new Vec3d(0.800000011920929, 0.75, 0.800000011920929));
if (!world.isClient && (entity.lastRenderX != entity.getX() || entity.lastRenderZ != entity.getZ())) {
double d = Math.abs(entity.getX() - entity.lastRenderX);
double e = Math.abs(entity.getZ() - entity.lastRenderZ);
if (d >= 0.003000000026077032 || e >= 0.003000000026077032) {
entity.damage(world.getDamageSources().generic(), 2.0F);
}
}
}
}
}

View file

@ -3,6 +3,7 @@ package su.a71.new_soviet.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.minecraft.item.Items;
import su.a71.new_soviet.registration.NSE_Blocks;
import su.a71.new_soviet.registration.NSE_Custom;
@ -428,7 +429,10 @@ public class BlockLootTables extends FabricBlockLootTableProvider {
addDrop(NSE_Blocks.CYAN_LINOLEUM_STAIRS);
addDrop(NSE_Blocks.METAL_PLATING_SLAB);
addDrop(NSE_Blocks.METAL_PLATING_STAIRS);
addDrop(NSE_Blocks.BARBED_WIRE, Items.IRON_NUGGET);
addDropWithSilkTouch(NSE_Custom.LIGHT_BULB_LAMP);
addDropWithSilkTouch(NSE_Blocks.BARBED_WIRE);
}
}

View file

@ -438,6 +438,8 @@ public class BlockTagGenerator extends FabricTagProvider.BlockTagProvider {
getOrCreateTagBuilder(BlockTags.WALLS).add(NSE_Blocks.CONCRETE_WALL);
getOrCreateTagBuilder(BlockTags.LEAVES).add(NSE_Blocks.BARBED_WIRE); // ...yeah :|
getOrCreateTagBuilder(BlockTags.PLANKS)
.add(NSE_Blocks.HERRINGBONE_ACACIA_PLANKS)
.add(NSE_Blocks.CROSS_ACACIA_PLANKS)

View file

@ -12,6 +12,7 @@ import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.text.Text;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import su.a71.new_soviet.blocks.BarbedWireBlock;
import su.a71.new_soviet.blocks.BoundaryMarkerBlock;
import su.a71.new_soviet.blocks.ConcreteWithBarsBlock;
import su.a71.new_soviet.blocks.HandrailBlock;
@ -441,6 +442,8 @@ 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 WallBlock CONCRETE_WALL = new WallBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.STONE).mapColor(MapColor.STONE_GRAY));
public static final BarbedWireBlock BARBED_WIRE = new BarbedWireBlock(FabricBlockSettings.create().requiresTool().noCollision().requiresTool().strength(4f, 1.5f).mapColor(MapColor.IRON_GRAY));
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 RUSTY_BLUE_IRON_BARS = new PaneBlock(FabricBlockSettings.copy(BLUE_IRON_BARS));
@ -886,6 +889,8 @@ public class NSE_Blocks extends NSE_BaseRegistration {
registerBlock("crate", () -> CRATE, NSE_BUILDING_TAB);
registerBlock("concrete_wall", () -> CONCRETE_WALL, NSE_BUILDING_TAB); // FIXME: 29.08.2023 This wall's top texture is a bit broken
registerBlock("barbed_wire", () -> BARBED_WIRE, NSE_BUILDING_TAB);
registerBlock("handrail", () -> HANDRAIL, NSE_BUILDING_TAB);
registerBlock("blue_iron_bars", () -> BLUE_IRON_BARS, NSE_BUILDING_TAB);
registerBlock("rusty_blue_iron_bars", () -> RUSTY_BLUE_IRON_BARS, NSE_BUILDING_TAB);

View file

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

View file

@ -69,9 +69,9 @@
"block.new_soviet.green_bricks": "Green Bricks",
"block.new_soviet.cracked_green_bricks": "Cracked Green Bricks",
"block.new_soviet.mossy_green_bricks": "Mossy Green Bricks",
"block.new_soviet.green_bricks_2": "Green Bricks (Mixed)",
"block.new_soviet.cracked_green_bricks_2": "Cracked Green Bricks (Mixed)",
"block.new_soviet.mossy_green_bricks_2": "Mossy Green Bricks (Mixed)",
"block.new_soviet.green_bricks_mixed": "Green Bricks (Mixed)",
"block.new_soviet.cracked_green_bricks_mixed": "Cracked Green Bricks (Mixed)",
"block.new_soviet.mossy_green_bricks_mixed": "Mossy Green Bricks (Mixed)",
"block.new_soviet.light_blue_tiles": "Light Blue Tiles",
"block.new_soviet.variated_light_blue_tiles": "Variated Light Blue Tiles",
"block.new_soviet.cracked_light_blue_tiles": "Cracked Light Blue Tiles",
@ -289,12 +289,12 @@
"block.new_soviet.cracked_green_bricks_stairs": "Cracked Green Brick Stairs",
"block.new_soviet.mossy_green_bricks_slab": "Mossy Green Brick Slab",
"block.new_soviet.mossy_green_bricks_stairs": "Mossy Green Brick Stairs",
"block.new_soviet.green_bricks_2_slab": "Mixed Green Brick Slab",
"block.new_soviet.green_bricks_2_stairs": "Mixed Green Brick Stairs",
"block.new_soviet.cracked_green_bricks_2_slab": "Mixed Cracked Green Brick Slab",
"block.new_soviet.cracked_green_bricks_2_stairs": "Mixed Cracked Green Brick Stairs",
"block.new_soviet.mossy_green_bricks_2_slab": "Mossy Mixed Green Brick Slab",
"block.new_soviet.mossy_green_bricks_2_stairs": "Mossy Mixed Green Brick Stairs",
"block.new_soviet.green_bricks_mixed_slab": "Mixed Green Brick Slab",
"block.new_soviet.green_bricks_mixed_stairs": "Mixed Green Brick Stairs",
"block.new_soviet.cracked_green_bricks_mixed_slab": "Mixed Cracked Green Brick Slab",
"block.new_soviet.cracked_green_bricks_mixed_stairs": "Mixed Cracked Green Brick Stairs",
"block.new_soviet.mossy_green_bricks_mixed_slab": "Mossy Mixed Green Brick Slab",
"block.new_soviet.mossy_green_bricks_mixed_stairs": "Mossy Mixed Green Brick Stairs",
"block.new_soviet.aquamarine_tiles_slab": "Aquamarine Tile Slab",
"block.new_soviet.aquamarine_tiles_stairs": "Aquamarine Tile Stairs",
"block.new_soviet.cracked_aquamarine_tiles_slab": "Cracked Aquamarine Tile Slab",
@ -466,6 +466,7 @@
"block.new_soviet.yellow_boundary_marker": "Yellow Boundary Marker",
"block.new_soviet.orange_boundary_marker": "Orange Boundary Marker",
"block.new_soviet.cyan_boundary_marker": "Cyan Boundary Marker",
"block.new_soviet.barbed_wire": "Barbed Wire",
"advancement.new_soviet.root.name": "A New Era",
"advancement.new_soviet.root.desc": "Time to create something great"

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "new_soviet:block/combat/barbed_wire"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "new_soviet:block/combat/barbed_wire"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB