diff --git a/src/client/java/su/a71/new_soviet/NewSovietClient.java b/src/client/java/su/a71/new_soviet/NewSovietClient.java index b985c71..467c460 100644 --- a/src/client/java/su/a71/new_soviet/NewSovietClient.java +++ b/src/client/java/su/a71/new_soviet/NewSovietClient.java @@ -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()); diff --git a/src/main/generated/data/minecraft/tags/blocks/leaves.json b/src/main/generated/data/minecraft/tags/blocks/leaves.json new file mode 100644 index 0000000..8b16f50 --- /dev/null +++ b/src/main/generated/data/minecraft/tags/blocks/leaves.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "new_soviet:barbed_wire" + ] +} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/barbed_wire.json b/src/main/generated/data/new_soviet/loot_tables/blocks/barbed_wire.json new file mode 100644 index 0000000..54b86d4 --- /dev/null +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/barbed_wire.json @@ -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 + } + ] +} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/BarbedWireBlock.java b/src/main/java/su/a71/new_soviet/blocks/BarbedWireBlock.java new file mode 100644 index 0000000..3284b6c --- /dev/null +++ b/src/main/java/su/a71/new_soviet/blocks/BarbedWireBlock.java @@ -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); + } + } + + } + } + +} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java b/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java index 21cbf62..59936e6 100644 --- a/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java +++ b/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java @@ -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); + } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/datagen/BlockTagGenerator.java b/src/main/java/su/a71/new_soviet/datagen/BlockTagGenerator.java index 0f8630e..c2050c7 100644 --- a/src/main/java/su/a71/new_soviet/datagen/BlockTagGenerator.java +++ b/src/main/java/su/a71/new_soviet/datagen/BlockTagGenerator.java @@ -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) diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java b/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java index 6032996..31e5589 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java @@ -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); diff --git a/src/main/resources/assets/new_soviet/blockstates/barbed_wire.json b/src/main/resources/assets/new_soviet/blockstates/barbed_wire.json new file mode 100644 index 0000000..06cdd1c --- /dev/null +++ b/src/main/resources/assets/new_soviet/blockstates/barbed_wire.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "new_soviet:block/barbed_wire" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/lang/en_us.json b/src/main/resources/assets/new_soviet/lang/en_us.json index cdc2093..443b837 100644 --- a/src/main/resources/assets/new_soviet/lang/en_us.json +++ b/src/main/resources/assets/new_soviet/lang/en_us.json @@ -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" diff --git a/src/main/resources/assets/new_soviet/models/block/barbed_wire.json b/src/main/resources/assets/new_soviet/models/block/barbed_wire.json new file mode 100644 index 0000000..eebe1ac --- /dev/null +++ b/src/main/resources/assets/new_soviet/models/block/barbed_wire.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cross", + "textures": { + "cross": "new_soviet:block/combat/barbed_wire" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/models/item/barbed_wire.json b/src/main/resources/assets/new_soviet/models/item/barbed_wire.json new file mode 100644 index 0000000..217ae70 --- /dev/null +++ b/src/main/resources/assets/new_soviet/models/item/barbed_wire.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "new_soviet:block/combat/barbed_wire" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/textures/block/combat/barbed_wire.png b/src/main/resources/assets/new_soviet/textures/block/combat/barbed_wire.png new file mode 100644 index 0000000..14cb810 Binary files /dev/null and b/src/main/resources/assets/new_soviet/textures/block/combat/barbed_wire.png differ