Add dice statistic, begin re-adding stairs and slabs

This commit is contained in:
Andrew-71 2023-09-25 22:19:40 +03:00
parent 2a695c6029
commit 7ac09095e5
7 changed files with 45 additions and 24 deletions

View file

@ -3,15 +3,14 @@
* Make good README.md stuff
=== STUFF TO ADD/FIX ===
* Add slab and stair variations
* Add fences
* Add windows
* Add (with functionality) present appliance/furniture/electronics textures
* Add achievement criterion for dice and advancements
* PO2 wall (fix)
* Add advancements (with datagen)
* What's switch type 2?
* All the lamps (lamp posts too!)
* Cigarette and handrail are BROKEN and the code is a MESS sorry, but it needs CLEANUP
* Concrete with bars should have proper hitbox, placeable upside down, and act like dripstone
* Fix post lamp hitboxes
=== ACHIEVEMENTS ===
Kolkhoz warrior - kill a zombie, skeleton, creeper and spider with a sickle

View file

@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import su.a71.new_soviet.registration.NSE_Blocks;
import su.a71.new_soviet.registration.NSE_Custom;
import su.a71.new_soviet.registration.NSE_Items;
import su.a71.new_soviet.registration.NSE_Stats;
public class NewSoviet implements ModInitializer {
public static final String MOD_ID = "new_soviet";
@ -31,5 +32,6 @@ public class NewSoviet implements ModInitializer {
NSE_Blocks.init();
NSE_Items.init();
NSE_Custom.init();
NSE_Stats.init();
}
}

View file

@ -42,21 +42,20 @@ public class ModelGenerator extends FabricModelProvider {
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(block, model_id));
}
public void registerSlabStairs(BlockStateModelGenerator blockStateModelGenerator, Block parent, StairsBlock stairs, SlabBlock slab, String texturePath) {
public void registerCubeWithSlabStairs(BlockStateModelGenerator blockStateModelGenerator, Block parent, StairsBlock stairs, SlabBlock slab, String texturePath) {
TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(parent).withPath((path) -> "block/" + texturePath + "/" + path));
Identifier cube_model = Models.CUBE_ALL.upload(parent, textureMap, blockStateModelGenerator.modelCollector);
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(parent, cube_model));
// Identifier slab_model = Models.SLAB.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
// Identifier slab_model_top = Models.SLAB_TOP.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
// Identifier slab_model_full = Models.CUBE_ALL.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
Identifier slab_model = Models.SLAB.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
Identifier slab_model_top = Models.SLAB_TOP.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
Identifier stairs_model = Models.STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
Identifier stairs_model_outer = Models.OUTER_STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
Identifier stairs_model_inner = Models.INNER_STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
// blockStateModelGenerator.registerItemModel(doorBlock.asItem());
// BlockStateModelGenerator.createSlabBlockState(slab)
// blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSlabBlockState(slab, slab_model, slab_model_top, slab_model_full));
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createStairsBlockState(slab, stairs_model_inner, stairs_model, stairs_model_outer));
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSlabBlockState(slab, slab_model, slab_model_top, cube_model));
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createStairsBlockState(stairs, stairs_model_inner, stairs_model, stairs_model_outer));
}
@Override
@ -66,18 +65,18 @@ public class ModelGenerator extends FabricModelProvider {
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_OAK_DOOR);
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_MANGROVE_DOOR);
registerCube(blockStateModelGenerator, NSE_Blocks.SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_SAND_TILES, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.SAND_TILES, NSE_Blocks.SAND_TILES_STAIRS, NSE_Blocks.SAND_TILES_SLAB, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.CRACKED_SAND_TILES, NSE_Blocks.CRACKED_SAND_TILES_STAIRS, NSE_Blocks.CRACKED_SAND_TILES_SLAB, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.MOSSY_SAND_TILES, NSE_Blocks.MOSSY_SAND_TILES_STAIRS, NSE_Blocks.MOSSY_SAND_TILES_SLAB, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_SAND_TILES, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_SAND_TILES, NSE_Blocks.HERRINGBONE_SAND_TILES_STAIRS, NSE_Blocks.HERRINGBONE_SAND_TILES_SLAB, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.CROSS_SAND_TILES, NSE_Blocks.CROSS_SAND_TILES_STAIRS, NSE_Blocks.CROSS_SAND_TILES_SLAB, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_SAND_BRICKS, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.SAND_BRICKS, NSE_Blocks.SAND_BRICKS_STAIRS, NSE_Blocks.SAND_BRICKS_SLAB, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.CRACKED_SAND_BRICKS, NSE_Blocks.CRACKED_SAND_BRICKS_STAIRS, NSE_Blocks.CRACKED_SAND_BRICKS_SLAB, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.MOSSY_SAND_BRICKS, NSE_Blocks.MOSSY_SAND_BRICKS_STAIRS, NSE_Blocks.MOSSY_SAND_BRICKS_SLAB, "sand");
registerCubeWithSlabStairs(blockStateModelGenerator, NSE_Blocks.BIG_SAND_BRICKS, NSE_Blocks.BIG_SAND_BRICKS_STAIRS, NSE_Blocks.BIG_SAND_BRICKS_SLAB, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_BRICK_TILES, "brick");
@ -229,8 +228,6 @@ public class ModelGenerator extends FabricModelProvider {
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_WALLPAPER, "wallpapers");
registerCube(blockStateModelGenerator, NSE_Blocks.BROWN_WALLPAPER, "wallpapers");
registerCube(blockStateModelGenerator, NSE_Blocks.BEIGE_WALLPAPER, "wallpapers");
// registerSlabStairs(blockStateModelGenerator, NSE_Blocks.SAND_TILES, NSE_Blocks.SAND_TILES_STAIRS, NSE_Blocks.SAND_TILES_SLAB, "sand");
}
@Override

View file

@ -17,6 +17,7 @@ import java.util.List;
import su.a71.new_soviet.Config;
import su.a71.new_soviet.NewSoviet;
import su.a71.new_soviet.registration.NSE_Sounds;
import su.a71.new_soviet.registration.NSE_Stats;
public class DiceItem extends Item {
private final int sides;
@ -34,8 +35,12 @@ public class DiceItem extends Item {
if (!world.isClient) {
StringBuilder output = new StringBuilder();
for (var i = 0; i < itemStack.getCount(); i++) {
int result = NewSoviet.RANDOM.nextBetween(1, this.getSides());
if (result == this.getSides()) {
user.incrementStat(NSE_Stats.ROLL_PERFECT_DICE);
}
world.playSound(null, user.getX(), user.getY(), user.getZ(), NSE_Sounds.DICE_SOUND, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
output.append(NewSoviet.RANDOM.nextBetween(1, this.getSides())).append(", ");
output.append(result).append(", ");
}
if (Config.INSTANCE.shouldAnnounceDice()) {
world.getPlayers().forEach(player -> player.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown_announce" : "item.new_soviet.dice.thrown_multiple_announce", user.getDisplayName()).append(" " + output.subSequence(0, output.length() - 2)), false));

View file

@ -0,0 +1,17 @@
package su.a71.new_soviet.registration;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.stat.StatFormatter;
import net.minecraft.stat.Stats;
import net.minecraft.util.Identifier;
import su.a71.new_soviet.NewSoviet;
public class NSE_Stats extends NSE_BaseRegistration {
public static final Identifier ROLL_PERFECT_DICE = new Identifier(NewSoviet.MOD_ID, "roll_perfect_dice");
public static void init() {
Registry.register(Registries.CUSTOM_STAT, "roll_perfect_dice", ROLL_PERFECT_DICE);
Stats.CUSTOM.getOrCreateStat(ROLL_PERFECT_DICE, StatFormatter.DEFAULT);
}
}

View file

@ -161,6 +161,7 @@
"item.new_soviet.dice.thrown_announce": "Dice 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",
"block.new_soviet.landmine": "AP Landmine",
"block.new_soviet.chiseled_mangrove_door": "Chiseled Mangrove Door",
"block.new_soviet.chiseled_oak_door": "Chiseled Oak Door",

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B