Make planks survival friendly

This commit is contained in:
Andrew-71 2023-08-05 11:22:58 +03:00
parent 80427fa3a2
commit a118072923
4 changed files with 91 additions and 23 deletions

View file

@ -135,7 +135,7 @@ public class DataGeneration implements DataGeneratorEntrypoint {
addDrop(NSE_Blocks.CROSS_BIRCH_PLANKS);
addDrop(NSE_Blocks.HERRINGBONE_CRIMSON_PLANKS);
addDrop(NSE_Blocks.CROSS_CRIMSON_PLANKS);
addDrop(NSE_Blocks.HERRINGBONE_DARK_OAK_PLAKS);
addDrop(NSE_Blocks.HERRINGBONE_DARK_OAK_PLANKS);
addDrop(NSE_Blocks.CROSS_DARK_OAK_PLANKS);
addDrop(NSE_Blocks.HERRINGBONE_JUNGLE_PLANKS);
addDrop(NSE_Blocks.CROSS_JUNGLE_PLANKS);
@ -290,7 +290,7 @@ public class DataGeneration implements DataGeneratorEntrypoint {
.add(NSE_Blocks.CROSS_BIRCH_PLANKS)
.add(NSE_Blocks.HERRINGBONE_CRIMSON_PLANKS)
.add(NSE_Blocks.CROSS_CRIMSON_PLANKS)
.add(NSE_Blocks.HERRINGBONE_DARK_OAK_PLAKS)
.add(NSE_Blocks.HERRINGBONE_DARK_OAK_PLANKS)
.add(NSE_Blocks.CROSS_DARK_OAK_PLANKS)
.add(NSE_Blocks.HERRINGBONE_JUNGLE_PLANKS)
.add(NSE_Blocks.CROSS_JUNGLE_PLANKS)
@ -612,6 +612,47 @@ public class DataGeneration implements DataGeneratorEntrypoint {
list.add(Blocks.TUFF);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_ACACIA_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_ACACIA_PLANKS);
list.add(Blocks.ACACIA_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_OAK_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_OAK_PLANKS);
list.add(Blocks.OAK_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_BIRCH_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_BIRCH_PLANKS);
list.add(Blocks.BIRCH_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_CRIMSON_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_CRIMSON_PLANKS);
list.add(Blocks.CRIMSON_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_DARK_OAK_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_DARK_OAK_PLANKS);
list.add(Blocks.DARK_OAK_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_JUNGLE_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_JUNGLE_PLANKS);
list.add(Blocks.JUNGLE_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_MANGROVE_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_MANGROVE_PLANKS);
list.add(Blocks.MANGROVE_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
stoneCuttingCategory(exporter, Util.make(Lists.newArrayList(), list -> {
list.add(NSE_Blocks.CROSS_SPRUCE_PLANKS);
list.add(NSE_Blocks.HERRINGBONE_SPRUCE_PLANKS);
list.add(Blocks.SPRUCE_PLANKS);
}), RecipeCategory.BUILDING_BLOCKS);
diceRecipe(exporter, NSE_Items.DICE_D4);
diceRecipe(exporter, NSE_Items.DICE_D6);
diceRecipe(exporter, NSE_Items.DICE_D20);

View file

@ -5,3 +5,9 @@ TV: CC compatible peripheral which combines a speaker and an 8x8 monitor
Crate: Inventory, like a barrel but smaller
Air Raid Siren: when powered (?), plays chosen frequency in chosen way at chosen sound. CC Peripheral attached
Lamp: Both bedside and ceiling are one block, Lamp, that functions sort of like a lantern
Landmine:
попали -> кабум
тронули не лопатой -> кабум 80%
тронули лопатой(сломали) -> 25% кабум
обезвредили лопатой (ПКМ задержать) -> не кабум

View file

@ -22,11 +22,18 @@ import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.explosion.Explosion;
import org.jetbrains.annotations.Nullable;
import su.a71.new_soviet.NewSoviet;
import net.minecraft.block.BrushableBlock;
import net.minecraft.block.TorchBlock;
import net.minecraft.item.BrushItem;
public class LandMineBlock extends Block implements Waterloggable {
public static final BooleanProperty WATERLOGGED;
protected static final VoxelShape SHAPE;
@ -36,13 +43,20 @@ public class LandMineBlock extends Block implements Waterloggable {
this.setDefaultState(this.stateManager.getDefaultState().with(WATERLOGGED, false));
}
@Override
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
if (!world.isClient) {
if (sourcePos == pos.down() && !canPlaceAt(state, world, pos)) {
explode(world, pos);
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (direction == Direction.DOWN && !this.canPlaceAt(state, world, pos)) {
explode((World) world, pos);
return Blocks.AIR.getDefaultState();
}
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos);
}
@Override
public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
if (!world.isClient && entity.canModifyAt(world, pos)) {
explode(world, pos);
}
super.onLandedUpon(world, state, pos, entity, fallDistance);
}
@Override
@ -64,12 +78,15 @@ public class LandMineBlock extends Block implements Waterloggable {
}
// public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
// if (!world.isClient() && !player.isCreative() && player.getHandItems() instanceof ShovelItem) {
// explode(world, pos);
// }
// super.onBreak(world, pos, state, player);
// }
// With a shovel, 25% chance of explosion on break
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
if (!world.isClient() && !player.isCreative() && !(player.getHandItems().iterator().next().getItem() instanceof ShovelItem)) {
if (NewSoviet.RANDOM.nextBetween(1, 4) != 1) {
explode(world, pos);
}
}
super.onBreak(world, pos, state, player);
}
// Only explode every 2/3rd of times to prevent instant explosion chains
@Override
@ -83,16 +100,19 @@ public class LandMineBlock extends Block implements Waterloggable {
super.onDestroyedByExplosion(world, pos, explosion);
}
// Without a shovel, 80% chance of explosion on contact
@Override
public void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) {
if (!world.isClient() && !(player.getHandItems().iterator().next().getItem() instanceof ShovelItem)) {
explode(world, pos);
} else {
NewSoviet.LOG.info(player.getHandItems().toString());
if (!world.isClient() && !(player.getHandItems().iterator().next().getItem() instanceof ShovelItem))
{
if (NewSoviet.RANDOM.nextBetween(1, 10) < 2) {
explode(world, pos);
}
}
super.onBlockBreakStart(state, world, pos, player);
}
// On contact explode
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (!world.isClient) {
explode(world, pos);
@ -139,8 +159,9 @@ public class LandMineBlock extends Block implements Waterloggable {
}
static {
SHAPE = Block.createCuboidShape(4, 0, 4, 12, 4, 12); // VoxelShapes.cuboid(0.4, 0, 0.4, 0.6, 0.3, 0.6); //
SHAPE = Block.createCuboidShape(5, 0, 5, 11, 3, 11); // VoxelShapes.cuboid(0.4, 0, 0.4, 0.6, 0.3, 0.6); //
// SHAPE = Block.createCuboidShape(5, 0, 5, 11, 3, 11); // VoxelShapes.cuboid(0.4, 0, 0.4, 0.6, 0.3, 0.6); //
WATERLOGGED = Properties.WATERLOGGED;
}
}

View file

@ -141,7 +141,7 @@ public class NSE_Blocks {
public static final Block CROSS_BIRCH_PLANKS = new Block(FabricBlockSettings.copy(Blocks.BIRCH_PLANKS));
public static final Block HERRINGBONE_CRIMSON_PLANKS = new Block(FabricBlockSettings.copy(Blocks.CRIMSON_PLANKS));
public static final Block CROSS_CRIMSON_PLANKS = new Block(FabricBlockSettings.copy(Blocks.CRIMSON_PLANKS));
public static final Block HERRINGBONE_DARK_OAK_PLAKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS));
public static final Block HERRINGBONE_DARK_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS));
public static final Block CROSS_DARK_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS));
public static final Block HERRINGBONE_JUNGLE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.JUNGLE_PLANKS));
public static final Block CROSS_JUNGLE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.JUNGLE_PLANKS));
@ -304,7 +304,7 @@ public class NSE_Blocks {
register("cross_birch_planks", () -> CROSS_BIRCH_PLANKS, NSE_BUILDING_TAB);
register("herringbone_crimson_planks", () -> HERRINGBONE_CRIMSON_PLANKS, NSE_BUILDING_TAB);
register("cross_crimson_planks", () -> CROSS_CRIMSON_PLANKS, NSE_BUILDING_TAB);
register("herringbone_dark_oak_planks", () -> HERRINGBONE_DARK_OAK_PLAKS, NSE_BUILDING_TAB);
register("herringbone_dark_oak_planks", () -> HERRINGBONE_DARK_OAK_PLANKS, NSE_BUILDING_TAB);
register("cross_dark_oak_planks", () -> CROSS_DARK_OAK_PLANKS, NSE_BUILDING_TAB);
register("herringbone_jungle_planks", () -> HERRINGBONE_JUNGLE_PLANKS, NSE_BUILDING_TAB);
register("cross_jungle_planks", () -> CROSS_JUNGLE_PLANKS, NSE_BUILDING_TAB);
@ -355,7 +355,7 @@ public class NSE_Blocks {
flammableBlockRegistry.add(HERRINGBONE_BIRCH_PLANKS, 20, 5);
flammableBlockRegistry.add(CROSS_BIRCH_PLANKS, 20, 5);
// Crimson doesn't burn!
flammableBlockRegistry.add(HERRINGBONE_DARK_OAK_PLAKS, 20, 5);
flammableBlockRegistry.add(HERRINGBONE_DARK_OAK_PLANKS, 20, 5);
flammableBlockRegistry.add(CROSS_DARK_OAK_PLANKS, 20, 5);
flammableBlockRegistry.add(HERRINGBONE_JUNGLE_PLANKS, 20, 5);
flammableBlockRegistry.add(CROSS_JUNGLE_PLANKS, 20, 5);