Add advancements, siren sounds, fix bugs
This commit is contained in:
parent
5e60100eca
commit
cabbed33cf
23 changed files with 366 additions and 23 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
67
src/main/java/su/a71/new_soviet/blocks/meat/MeatBlock.java
Normal file
67
src/main/java/su/a71/new_soviet/blocks/meat/MeatBlock.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
101
src/main/java/su/a71/new_soviet/datagen/Advancements.java
Normal file
101
src/main/java/su/a71/new_soviet/datagen/Advancements.java
Normal 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");
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue