Add barbed wire
This commit is contained in:
parent
483f2730e3
commit
f1bf483b87
12 changed files with 109 additions and 10 deletions
32
src/main/java/su/a71/new_soviet/blocks/BarbedWireBlock.java
Normal file
32
src/main/java/su/a71/new_soviet/blocks/BarbedWireBlock.java
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue