Add advancements, siren sounds, fix bugs

This commit is contained in:
Andrew-71 2023-09-28 17:59:23 +03:00
parent 5e60100eca
commit cabbed33cf
23 changed files with 366 additions and 23 deletions

View file

@ -2,6 +2,8 @@ The following directory, it's subdirectories, and any files inside said director
the license below.
/src/main/resources/
The only exceptions are some files in /src/main/resources/assets/new_soviet/sounds, see relevant LICENSE file there
All Rights Reserved
Copyright (c) 2023 Andrey Nikitin and Рюжин Юрий.

View file

@ -10,4 +10,8 @@
* Add credits in models
=== ACHIEVEMENTS ===
Kolkhoz warrior - kill a zombie, skeleton, creeper and spider with a sickle
Kolkhoz warrior - kill someone with a sickle
Gambler - throw dice 100 times
One In 64 Million - roll perfect d20 x 6
Serious Addiction - throw a dice 1000 times, and then reevaluate your life choices
What the- - ??? meat ??? rake

View file

@ -0,0 +1,39 @@
{
"criteria": {
"got_dirt": {
"conditions": {
"items": [
{
"items": [
"minecraft:dirt"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"display": {
"announce_to_chat": false,
"background": "minecraft:textures/gui/advancements/backgrounds/adventure.png",
"description": {
"translate": "advancement.new_soviet.root.desc"
},
"frame": "task",
"hidden": false,
"icon": {
"item": "new_soviet:sickle",
"nbt": "{Damage:0}"
},
"show_toast": false,
"title": {
"translate": "advancement.new_soviet.root.name"
}
},
"requirements": [
[
"got_dirt"
]
],
"sends_telemetry_event": true
}

View file

@ -0,0 +1,40 @@
{
"parent": "minecraft:new_soviet/root",
"criteria": {
"got_sickle": {
"conditions": {
"items": [
{
"items": [
"new_soviet:sickle"
]
}
]
},
"trigger": "minecraft:inventory_changed"
}
},
"display": {
"announce_to_chat": true,
"background": "minecraft:textures/gui/advancements/backgrounds/adventure.png",
"description": {
"translate": "advancement.new_soviet.sickle.desc"
},
"frame": "task",
"hidden": false,
"icon": {
"item": "new_soviet:sickle",
"nbt": "{Damage:0}"
},
"show_toast": true,
"title": {
"translate": "advancement.new_soviet.sickle.name"
}
},
"requirements": [
[
"got_sickle"
]
],
"sends_telemetry_event": true
}

View file

@ -0,0 +1,51 @@
{
"parent": "minecraft:new_soviet/sickle",
"criteria": {
"kill": {
"conditions": {
"entity": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {}
}
],
"killing_blow": {
"source_entity": {
"equipment": {
"mainhand": {
"items": [
"new_soviet:sickle"
]
}
}
}
}
},
"trigger": "minecraft:player_killed_entity"
}
},
"display": {
"announce_to_chat": true,
"background": "minecraft:textures/gui/advancements/backgrounds/adventure.png",
"description": {
"translate": "advancement.new_soviet.sickle_kill.desc"
},
"frame": "task",
"hidden": false,
"icon": {
"item": "new_soviet:sickle",
"nbt": "{Damage:0}"
},
"show_toast": true,
"title": {
"translate": "advancement.new_soviet.sickle_kill.name"
}
},
"requirements": [
[
"kill"
]
],
"sends_telemetry_event": true
}

View file

@ -23,7 +23,7 @@ public class Config {
File file = new File("config/new_soviet.json");
if(!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
NewSoviet.LOG.error("Error making dir, using default config");
INSTANCE = new Config(); // Something went wrong with mkdir
INSTANCE = new Config();
return;
}
try {

View file

@ -3,11 +3,7 @@ package su.a71.new_soviet;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import su.a71.new_soviet.datagen.BlockLootTables;
import su.a71.new_soviet.datagen.BlockTagGenerator;
import su.a71.new_soviet.datagen.RecipeGenerator;
import su.a71.new_soviet.datagen.ModelGenerator;
import su.a71.new_soviet.datagen.ItemTagGenerator;
import su.a71.new_soviet.datagen.*;
public class DataGeneration implements DataGeneratorEntrypoint {
@Override
@ -18,5 +14,6 @@ public class DataGeneration implements DataGeneratorEntrypoint {
NSEPack.addProvider(BlockTagGenerator::new);
NSEPack.addProvider(ModelGenerator::new);
NSEPack.addProvider(ItemTagGenerator::new);
NSEPack.addProvider(AdvancementGenerator::new);
}
}

View file

@ -46,6 +46,8 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable {
setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH).with(ON, false).with(WATERLOGGED, false).with(SOUND_INDEX, 0));
SIREN_SOUNDS.add(new SirenSound("Air raid", NSE_Sounds.SIREN_SOUND, 140));
SIREN_SOUNDS.add(new SirenSound("Bell", NSE_Sounds.BELL_SIREN_SOUND, 100));
SIREN_SOUNDS.add(new SirenSound("Woop", NSE_Sounds.WOOP_SIREN_SOUND, 40));
}
@Override

View file

@ -3,10 +3,8 @@ package su.a71.new_soviet.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.enums.WallMountLocation;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.particle.DustParticleEffect;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
@ -38,7 +36,7 @@ public class SwitchBlock extends LeverBlock {
protected static final VoxelShape CEILING_X_AXIS_SHAPE = Block.createCuboidShape(5.5, 15.0, 5.5, 10.5, 16.0, 10.5);
public SwitchBlock(FabricBlockSettings fabricBlockSettings) {
super(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).notSolid().pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f).mapColor(MapColor.TERRACOTTA_WHITE).noCollision());
super(fabricBlockSettings.noCollision());
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(POWERED, false).with(FACE, WallMountLocation.WALL));
}

View file

@ -101,7 +101,7 @@ public class LightBulbLampBlock extends LampBlock {
}
static {
SHAPE = VoxelShapes.union(Block.createCuboidShape(7, 15, 7, 9, 16, 9), Block.createCuboidShape(7, 6, 7, 9, 8, 9)); //VoxelShapes.union(Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 7.0, 12.0), Block.createCuboidShape(7.0, 7.0, 7.0, 9.0, 13.0, 9.0), Block.createCuboidShape(6.0, 13.0, 6.0, 10.0, 16.0, 10.0));
SHAPE = VoxelShapes.union(Block.createCuboidShape(7, 15.5, 7, 9, 16, 9), Block.createCuboidShape(7, 6, 7, 9, 8, 9)); //VoxelShapes.union(Block.createCuboidShape(4.0, 2.0, 4.0, 12.0, 7.0, 12.0), Block.createCuboidShape(7.0, 7.0, 7.0, 9.0, 13.0, 9.0), Block.createCuboidShape(6.0, 13.0, 6.0, 10.0, 16.0, 10.0));
BROKEN = Properties.CRACKED;
}
}

View file

@ -0,0 +1,67 @@
package su.a71.new_soviet.blocks.meat;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.*;
import net.minecraft.block.entity.SculkSpreadManager;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.WorldAccess;
import org.jetbrains.annotations.Nullable;
public class MeatBlock extends Block implements SculkSpreadable {
public static final IntProperty AGE;
public final float MeatChance;
public MeatBlock(FabricBlockSettings settings, float meatChance) {
super(settings.ticksRandomly());
setDefaultState(getDefaultState().with(AGE, 0));
this.MeatChance = meatChance;
}
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
if (world.isAir(pos.up())) {
int i;
for(i = 1; world.getBlockState(pos.down(i)).isOf(this); ++i) {
}
if (i < 3) {
int j = state.get(AGE);
if (j == 25) {
world.setBlockState(pos.up(), this.getDefaultState());
world.setBlockState(pos, state.with(AGE, 0), 4);
} else {
world.setBlockState(pos, state.with(AGE, j + 1), 4);
}
}
} super.randomTick(state, world, pos, random);
}
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(AGE);
}
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
return super.getPlacementState(ctx).with(AGE, 0);
}
static {
AGE = Properties.AGE_25;
}
@Override
public int spread(SculkSpreadManager.Cursor cursor, WorldAccess world, BlockPos catalystPos, Random random, SculkSpreadManager spreadManager, boolean shouldConvertToBlock) {
return 0;
}
}

View file

@ -0,0 +1,9 @@
package su.a71.new_soviet.blocks.meat;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
public class MeatEyeBlock extends MeatBlock {
public MeatEyeBlock(FabricBlockSettings settings) {
super(settings, 10);
}
}

View file

@ -0,0 +1,9 @@
package su.a71.new_soviet.blocks.meat;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
public class MeatTeethBlock extends MeatBlock {
public MeatTeethBlock(FabricBlockSettings settings) {
super(settings, 10);
}
}

View file

@ -1,4 +1,5 @@
package su.a71.new_soviet.datagen;
// === ABANDON HOPE, YE WHO ENTER HERE ===
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricAdvancementProvider;
@ -8,12 +9,12 @@ import java.util.function.Consumer;
public class AdvancementGenerator extends FabricAdvancementProvider {
protected AdvancementGenerator(FabricDataOutput output) {
public AdvancementGenerator(FabricDataOutput output) {
super(output);
}
@Override
public void generateAdvancement(Consumer<Advancement> consumer) {
new Advancements().accept(consumer);
}
}

View file

@ -0,0 +1,101 @@
package su.a71.new_soviet.datagen;
import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementFrame;
import net.minecraft.advancement.criterion.InventoryChangedCriterion;
import net.minecraft.advancement.criterion.ItemCriterion;
import net.minecraft.advancement.criterion.OnKilledCriterion;
import net.minecraft.advancement.criterion.PlayerHurtEntityCriterion;
import net.minecraft.item.Items;
import net.minecraft.predicate.entity.DamageSourcePredicate;
import net.minecraft.predicate.entity.EntityEquipmentPredicate;
import net.minecraft.predicate.entity.EntityPredicate;
import net.minecraft.predicate.item.ItemPredicate;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import su.a71.new_soviet.NewSoviet;
import su.a71.new_soviet.registration.NSE_Items;
import java.util.function.Consumer;
public class Advancements implements Consumer<Consumer<Advancement>> {
@Override
public void accept(Consumer<Advancement> consumer) {
Advancement root = Advancement.Builder.create()
.display(
NSE_Items.SICKLE,
Text.translatable("advancement.new_soviet.root.name"),
Text.translatable("advancement.new_soviet.root.desc"),
new Identifier("textures/gui/advancements/backgrounds/adventure.png"),
AdvancementFrame.TASK,
false, // Toast
false, // Announcement
false // Hidden
)
.criterion("got_dirt", InventoryChangedCriterion.Conditions.items(Items.DIRT))
.build(consumer, NewSoviet.MOD_ID + "/root");
// Make a sickle
Advancement sickle = Advancement.Builder.create()
.display(
NSE_Items.SICKLE,
Text.translatable("advancement.new_soviet.sickle.name"),
Text.translatable("advancement.new_soviet.sickle.desc"),
new Identifier("textures/gui/advancements/backgrounds/adventure.png"),
AdvancementFrame.TASK,
true, // Toast
true, // Announcement
false // Hidden
)
.parent(root)
.criterion("got_sickle", InventoryChangedCriterion.Conditions.items(NSE_Items.SICKLE))
.build(consumer, NewSoviet.MOD_ID + "/sickle");
// Kill someone with a sickle
Advancement sickle_kill = Advancement.Builder.create()
.display(
NSE_Items.SICKLE,
Text.translatable("advancement.new_soviet.sickle_kill.name"),
Text.translatable("advancement.new_soviet.sickle_kill.desc"),
new Identifier("textures/gui/advancements/backgrounds/adventure.png"),
AdvancementFrame.TASK,
true, // Toast
true, // Announcement
false // Hidden
)
.parent(sickle)
// .criterion("holding_sickle", ItemCriterion.Conditions.)
.criterion("kill", OnKilledCriterion.Conditions.createPlayerKilledEntity(EntityPredicate.Builder.create(), DamageSourcePredicate.Builder.create().sourceEntity(EntityPredicate.Builder.create().equipment(EntityEquipmentPredicate.Builder.create().mainhand(ItemPredicate.Builder.create().items(NSE_Items.SICKLE).build()).build()))))
.build(consumer, NewSoviet.MOD_ID + "/sickle_kill");
// // Throw a die 100 times
// Advancement gambler = Advancement.Builder.create()
// .display(
// NSE_Items.DICE_D6,
// Text.translatable("advancement.new_soviet.gambler.name"),
// Text.translatable("advancement.new_soviet.gambler.desc"),
// new Identifier("textures/gui/advancements/backgrounds/adventure.png"),
// AdvancementFrame.CHALLENGE,
// true, // Toast
// true, // Announcement
// false // Hidden
// )
// .criterion("threw_dice", InventoryChangedCriterion.Conditions.items(Items.DIRT))
// .build(consumer, NewSoviet.MOD_ID + "/gambler");
// Throw a die 1000 times
// Advancement serious_addiction = Advancement.Builder.create()
// .display(
// NSE_Items.DICE_D20,
// Text.translatable("advancement.new_soviet.serious_addiction.name"),
// Text.translatable("advancement.new_soviet.serious_addiction.desc"),
// new Identifier("textures/gui/advancements/backgrounds/adventure.png"),
// AdvancementFrame.CHALLENGE,
// true, // Toast
// true, // Announcement
// false // Hidden
// )
// .criterion("threw_dice", InventoryChangedCriterion.Conditions.items(Items.DIRT))
// .parent(gambler)
// .build(consumer, NewSoviet.MOD_ID + "/serious_addiction");
}
}

View file

@ -18,7 +18,6 @@ import su.a71.new_soviet.blocks.HandrailBlock;
public class NSE_Blocks extends NSE_BaseRegistration {
// BUILDING BRICKS/TILES ====================
// TODO: TOOLS FOR SLABS AND STAIRS !!!!
public static final Block SAND_TILES = new Block(FabricBlockSettings.create().sounds(NSE_Sounds.SAND_TILES_SOUNDS).hardness(1.5f).requiresTool().resistance(6f).mapColor(MapColor.TERRACOTTA_BROWN));
public static final StairsBlock SAND_TILES_STAIRS = new StairsBlock(SAND_TILES.getDefaultState(), FabricBlockSettings.copy(SAND_TILES));
public static final SlabBlock SAND_TILES_SLAB = new SlabBlock(FabricBlockSettings.copy(SAND_TILES));

View file

@ -40,8 +40,8 @@ public class NSE_Custom extends NSE_BaseRegistration {
public static final SwitchBlock SWITCH = new SwitchBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).notSolid().pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f).mapColor(MapColor.TERRACOTTA_WHITE));
public static final TableLampBlock TABLE_LAMP = new TableLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.WOOD).strength(0.9f, 1.5f).mapColor(MapColor.WHITE));
public static final GoldenTableLampBlock GOLDEN_LAMP = new GoldenTableLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(0.9f, 1.5f).mapColor(MapColor.GOLD));
public static final TableLampBlock VINTAGE_LAMP = new VintageLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(0.9f, 1.5f).mapColor(MapColor.TERRACOTTA_BROWN));
public static final GoldenTableLampBlock GOLDEN_LAMP = new GoldenTableLampBlock(FabricBlockSettings.copy(TABLE_LAMP).sounds(BlockSoundGroup.METAL).mapColor(MapColor.GOLD));
public static final TableLampBlock VINTAGE_LAMP = new VintageLampBlock(FabricBlockSettings.copy(TABLE_LAMP).sounds(BlockSoundGroup.METAL).mapColor(MapColor.TERRACOTTA_BROWN));
public static final LightBulbLampBlock LIGHT_BULB_LAMP = new LightBulbLampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.GLASS).strength(0.9f, 1.5f).mapColor(MapColor.WHITE).requiresTool());
public static final LampPostBaseBlock LAMP_POST_BASE = new LampPostBaseBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.IRON_GRAY));

View file

@ -37,6 +37,9 @@ public class NSE_Sounds extends NSE_BaseRegistration {
public static SoundEvent CIGARETTE_PAUSE = registerSoundEvent("cigarette_pause");
public static final SoundEvent SIREN_SOUND = registerSoundEvent("siren_sound");
public static final SoundEvent BELL_SIREN_SOUND = registerSoundEvent("bell_siren_sound");
public static final SoundEvent WOOP_SIREN_SOUND = registerSoundEvent("woop_siren_sound");
public static final SoundEvent ELECTRIC_HIT = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "electric_hit"));
public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = registerSoundEvent("light_bulb_broken_sound");

View file

@ -150,16 +150,16 @@
"block.new_soviet.table_lamp": "Table Lamp",
"block.new_soviet.ceiling_fan": "Ceiling Fan",
"block.new_soviet.siren": "Siren",
"block.new_soviet.siren.set": "Siren sounds set to: %s",
"item.new_soviet.dice_d6": "Dice",
"item.new_soviet.dice_d4": "Dice",
"item.new_soviet.dice_d20": "Dice",
"block.new_soviet.siren.set": "Siren sound set to: %s",
"item.new_soviet.dice_d6": "Die",
"item.new_soviet.dice_d4": "Die",
"item.new_soviet.dice_d20": "Die",
"item.new_soviet.dice_d6.tooltip": "Six sides",
"item.new_soviet.dice_d4.tooltip": "Four sides",
"item.new_soviet.dice_d20.tooltip": "Twenty sides",
"item.new_soviet.dice.thrown": "Dice was thrown with result:",
"item.new_soviet.dice.thrown": "Die was thrown with result:",
"item.new_soviet.dice.thrown_multiple": "Dice were thrown with result:",
"item.new_soviet.dice.thrown_announce": "Dice was thrown by %s with result:",
"item.new_soviet.dice.thrown_announce": "Die was thrown by %s with result:",
"item.new_soviet.dice.thrown_multiple_announce": "Dice were thrown by %s with result:",
"subtitles.new_soviet.dice_throw": "Dice thrown",
"stat.new_soviet.roll_perfect_dice": "Perfect Dice Throws",
@ -196,6 +196,7 @@
"block.new_soviet.meat_eye": "Meat block with eye",
"block.new_soviet.meat_teeth": "Meat block with teeth",
"item.new_soviet.rake": "Rake",
"subtitles.new_soviet.item_rake_till": "Rake tills",
"item.new_soviet.concentrate": "Nutrient Block",
"block.new_soviet.switch": "Switch",
"block.new_soviet.nii_wall_1": "Diorite RI Wall",
@ -443,5 +444,8 @@
"block.new_soviet.caged_post_lamp": "Caged Post Lamp",
"block.new_soviet.modern_post_lamp": "Modern Post Lamp",
"block.new_soviet.big_post_lamp": "Big Post Lamp",
"block.new_soviet.vintage_post_lamp": "Vintage Post Lamp"
"block.new_soviet.vintage_post_lamp": "Vintage Post Lamp",
"advancement.new_soviet.root.name": "A New Era",
"advancement.new_soviet.root.desc": "Time to create something great"
}

View file

@ -11,6 +11,18 @@
"new_soviet:siren"
]
},
"bell_siren_sound": {
"subtitle": "subtitles.new_soviet.siren",
"sounds": [
"new_soviet:bell_siren"
]
},
"woop_siren_sound": {
"subtitle": "subtitles.new_soviet.siren",
"sounds": [
"new_soviet:woop_siren"
]
},
"electric_hit": {
"subtitle": "subtitles.new_soviet.electric_hit",
"sounds": [

View file

@ -0,0 +1,5 @@
The following files in this directory are licensed under CC BY 3.0 (https://creativecommons.org/licenses/by/3.0/):
1. .ogg versions of files made by Mike Koenig:
* bell_siren.ogg - https://soundbible.com/1531-Temple-Bell.html
* woop_siren.ogg - https://soundbible.com/1377-Woop-Woop.html