diff --git a/CHANGELOG b/CHANGELOG index e675da4..33e7aac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,12 +31,5 @@ This version focuses on QOL and bug fixes * Added Russian translation (ru_ru) -* Added button to open config file when using Mod Menu -* Added several new achievements and challenges -* Minor bug fixes - * Fixed issue with some blocks being non opaque - * Switches no longer emit redstone particle - * Slightly improved cigarette's GUI model -* Technical changes - * Simplified recipe data generation - * Deleted various unused files - code, textures and models \ No newline at end of file +* Fixed some issues with blocks being non opaque +* Deleted some unused textures and models \ No newline at end of file diff --git a/build.gradle b/build.gradle index f63e1fa..d9ef57a 100644 --- a/build.gradle +++ b/build.gradle @@ -101,7 +101,6 @@ publishing { modrinth { token = System.getenv(modrinth_token) // DO NOT REVEAL THE TOKEN!!! projectId = mod_id - versionName = mod_name + " " + mod_version versionNumber = mod_version versionType = "beta" // release/beta/alpha uploadFile = remapJar diff --git a/gradle.properties b/gradle.properties index 5faee0e..c17c378 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,6 @@ yarn_mappings=1.20.1+build.10 loader_version=0.14.23 # Mod Properties -mod_name=New Soviet Era mod_version=0.2 maven_group=su.a71 mod_id=new_soviet diff --git a/src/client/java/su/a71/new_soviet/NewSovietClient.java b/src/client/java/su/a71/new_soviet/NewSovietClient.java index 8199a9a..a9b27a7 100644 --- a/src/client/java/su/a71/new_soviet/NewSovietClient.java +++ b/src/client/java/su/a71/new_soviet/NewSovietClient.java @@ -31,6 +31,15 @@ public class NewSovietClient implements ClientModInitializer { BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.VINTAGE_IRON_BARS, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BARBED_WIRE, RenderLayer.getCutout()); + // TODO: Needed? + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.RED_CONCRETE_WITH_BARS, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.GREEN_CONCRETE_WITH_BARS, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.WHITE_CONCRETE_WITH_BARS, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BEIGE_CONCRETE_WITH_BARS, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.YELLOW_CONCRETE_WITH_BARS, RenderLayer.getCutout()); + BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.BLUE_CONCRETE_WITH_BARS, RenderLayer.getCutout()); + +// BlockEntityRendererRegistry.register(NSE_Custom.TV_BLOCK_ENTITY, TVBlockEntityRenderer::new); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.TV, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.RED_TV, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.BROWN_TV, RenderLayer.getCutout()); diff --git a/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java b/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java new file mode 100644 index 0000000..0c58eeb --- /dev/null +++ b/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java @@ -0,0 +1,58 @@ +package su.a71.new_soviet; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.block.BlockState; +import net.minecraft.block.SignBlock; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.RotationAxis; +import net.minecraft.util.math.Vec3d; +import su.a71.new_soviet.entities.TVBlockEntity; + +@Environment(EnvType.CLIENT) +public class TVBlockEntityRenderer implements BlockEntityRenderer { +// private static TextRenderer textRenderer; + private static final Vec3d TEXT_OFFSET = new Vec3d(0.0, 0.3333333432674408, 0.046666666865348816); + + + public TVBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { +// textRenderer = ctx.getTextRenderer(); + } + + @Override + public void render(TVBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + matrices.push(); +// Rendering stuff here +// this.setTextAngles(matrices, true, TEXT_OFFSET); +// textRenderer.draw("Test amogus", 0, 0, 999999, false, matrices.peek().getPositionMatrix(), vertexConsumers, TextRenderer.TextLayerType.POLYGON_OFFSET, 19999, light); + matrices.pop(); + + } + + public float getScale() { + return 0.6666667F; + } + + + void setAngles(MatrixStack matrices, float rotationDegrees, BlockState state) { + matrices.translate(0.5F, 0.75F * this.getScale(), 0.5F); + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationDegrees)); + if (!(state.getBlock() instanceof SignBlock)) { + matrices.translate(0.0F, -0.3125F, -0.4375F); + } + } + + private void setTextAngles(MatrixStack matrices, boolean front, Vec3d translation) { + if (!front) { + matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F)); + } + + float f = 0.015625F * this.getScale(); + matrices.translate(translation.x, translation.y, translation.z); + matrices.scale(f, -f, f); + } +} \ No newline at end of file diff --git a/src/main/generated/data/minecraft/advancements/new_soviet/gambler.json b/src/main/generated/data/minecraft/advancements/new_soviet/gambler.json deleted file mode 100644 index 0eb618f..0000000 --- a/src/main/generated/data/minecraft/advancements/new_soviet/gambler.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "parent": "minecraft:new_soviet/root", - "criteria": { - "rolled_100": { - "conditions": { - "item": { - "tag": "new_soviet:dice" - }, - "player": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "type": "minecraft:player", - "type_specific": { - "type": "player", - "stats": [ - { - "type": "minecraft:custom", - "stat": "minecraft:roll_dice", - "value": { - "min": 100 - } - } - ] - } - } - } - ] - }, - "trigger": "minecraft:using_item" - } - }, - "display": { - "announce_to_chat": true, - "background": "minecraft:textures/gui/advancements/backgrounds/adventure.png", - "description": { - "translate": "advancement.new_soviet.gambler.desc" - }, - "frame": "task", - "hidden": false, - "icon": { - "item": "new_soviet:dice_d6" - }, - "show_toast": true, - "title": { - "translate": "advancement.new_soviet.gambler.name" - } - }, - "requirements": [ - [ - "rolled_100" - ] - ], - "sends_telemetry_event": true -} \ No newline at end of file diff --git a/src/main/generated/data/minecraft/advancements/new_soviet/lucky_throw.json b/src/main/generated/data/minecraft/advancements/new_soviet/lucky_throw.json deleted file mode 100644 index c0e4868..0000000 --- a/src/main/generated/data/minecraft/advancements/new_soviet/lucky_throw.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "parent": "minecraft:new_soviet/gambler", - "criteria": { - "rolled_100_perfect": { - "conditions": { - "item": { - "tag": "new_soviet:dice" - }, - "player": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "type": "minecraft:player", - "type_specific": { - "type": "player", - "stats": [ - { - "type": "minecraft:custom", - "stat": "minecraft:roll_perfect_dice", - "value": { - "min": 100 - } - } - ] - } - } - } - ] - }, - "trigger": "minecraft:using_item" - } - }, - "display": { - "announce_to_chat": true, - "background": "minecraft:textures/gui/advancements/backgrounds/adventure.png", - "description": { - "translate": "advancement.new_soviet.lucky_throw.desc" - }, - "frame": "challenge", - "hidden": false, - "icon": { - "item": "new_soviet:dice_d4" - }, - "show_toast": true, - "title": { - "translate": "advancement.new_soviet.lucky_throw.name" - } - }, - "requirements": [ - [ - "rolled_100_perfect" - ] - ], - "sends_telemetry_event": true -} \ No newline at end of file diff --git a/src/main/generated/data/minecraft/advancements/new_soviet/serious_addiction.json b/src/main/generated/data/minecraft/advancements/new_soviet/serious_addiction.json deleted file mode 100644 index 3294031..0000000 --- a/src/main/generated/data/minecraft/advancements/new_soviet/serious_addiction.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "parent": "minecraft:new_soviet/gambler", - "criteria": { - "rolled_1000": { - "conditions": { - "item": { - "tag": "new_soviet:dice" - }, - "player": [ - { - "condition": "minecraft:entity_properties", - "entity": "this", - "predicate": { - "type": "minecraft:player", - "type_specific": { - "type": "player", - "stats": [ - { - "type": "minecraft:custom", - "stat": "minecraft:roll_dice", - "value": { - "min": 1000 - } - } - ] - } - } - } - ] - }, - "trigger": "minecraft:using_item" - } - }, - "display": { - "announce_to_chat": true, - "background": "minecraft:textures/gui/advancements/backgrounds/adventure.png", - "description": { - "translate": "advancement.new_soviet.serious_addiction.desc" - }, - "frame": "challenge", - "hidden": false, - "icon": { - "item": "new_soviet:dice_d20" - }, - "show_toast": true, - "title": { - "translate": "advancement.new_soviet.serious_addiction.name" - } - }, - "requirements": [ - [ - "rolled_1000" - ] - ], - "sends_telemetry_event": true -} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/BoundaryMarkerBlock.java b/src/main/java/su/a71/new_soviet/blocks/BoundaryMarkerBlock.java index 087d3e0..b8ccd18 100644 --- a/src/main/java/su/a71/new_soviet/blocks/BoundaryMarkerBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/BoundaryMarkerBlock.java @@ -4,6 +4,7 @@ import net.minecraft.block.*; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; +import net.minecraft.item.BucketItem; import net.minecraft.item.DyeItem; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; @@ -12,6 +13,7 @@ import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; import net.minecraft.util.ActionResult; +import net.minecraft.util.DyeColor; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; @@ -54,7 +56,7 @@ public class BoundaryMarkerBlock extends Block implements Waterloggable { player.getInventory().getMainHandStack().decrement(1); } world.setBlockState(pos, state.with(COLOUR, id)); - world.playSound(null, pos, SoundEvents.ITEM_DYE_USE, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_DYE_USE, SoundCategory.BLOCKS, 1.0F, 1.0F); } return ActionResult.SUCCESS; } diff --git a/src/main/java/su/a71/new_soviet/blocks/ConcreteWithBarsBlock.java b/src/main/java/su/a71/new_soviet/blocks/ConcreteWithBarsBlock.java index 6c1ced7..f9c7a98 100644 --- a/src/main/java/su/a71/new_soviet/blocks/ConcreteWithBarsBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/ConcreteWithBarsBlock.java @@ -1,6 +1,7 @@ package su.a71.new_soviet.blocks; import net.minecraft.block.*; +import net.minecraft.block.enums.Thickness; import net.minecraft.entity.Entity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; @@ -15,6 +16,8 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; +import net.minecraft.world.WorldView; +import org.jetbrains.annotations.Nullable; public class ConcreteWithBarsBlock extends HorizontalFacingBlock implements Waterloggable { public static final DirectionProperty VERTICAL_DIRECTION; diff --git a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java index 01a42e7..a95bebf 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java @@ -1,5 +1,6 @@ package su.a71.new_soviet.blocks; +import com.mojang.authlib.minecraft.client.MinecraftClient; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.piston.PistonBehavior; @@ -66,9 +67,9 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { if (bl) { world.scheduleBlockTick(pos, this, 4); } else { - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).sound(), SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).getSound(), SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); world.setBlockState(pos, state.cycle(ON), 2); - world.scheduleBlockTick(pos, this, SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).duration()); + world.scheduleBlockTick(pos, this, SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).getDuration()); } } } @@ -80,7 +81,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { if (!world.isClient) { incrementSoundIndex(world, pos); } - player.sendMessage(Text.translatable("block.new_soviet.siren.set", SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).name()), true); + player.sendMessage(Text.translatable("block.new_soviet.siren.set", SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).getName()), true); return ActionResult.SUCCESS; } return super.onUse(state, world, pos, player, hand, hit); @@ -118,8 +119,8 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { if (state.get(ON) && !world.isReceivingRedstonePower(pos)) { world.setBlockState(pos, state.cycle(ON), 2); } else { - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).sound(), SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); - world.scheduleBlockTick(pos, this, SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).duration()); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).getSound(), SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); + world.scheduleBlockTick(pos, this, SIREN_SOUNDS.get(world.getBlockState(pos).get(SOUND_INDEX)).getDuration()); } } @@ -165,6 +166,27 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { WATERLOGGED = Properties.WATERLOGGED; } - public record SirenSound(String name, SoundEvent sound, int duration) { + public class SirenSound { + private final SoundEvent sound; + private final int duration; + private final String name; + + public SirenSound( String name, SoundEvent sound, int duration) { + this.sound = sound; + this.duration = duration; + this.name = name; + } + + public SoundEvent getSound() { + return sound; + } + + public int getDuration() { + return duration; + } + + public String getName() { + return name; + } } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java b/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java index ede6d7f..399080c 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java @@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.enums.WallMountLocation; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.particle.DustParticleEffect; import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; @@ -13,10 +14,10 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import net.minecraft.world.World; +import net.minecraft.world.WorldAccess; import net.minecraft.world.event.GameEvent; import su.a71.new_soviet.registration.NSE_Sounds; @@ -76,8 +77,14 @@ public class SwitchBlock extends LeverBlock { return ActionResult.CONSUME; } - // Remove those annoying redstone particles - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {} + private static void spawnParticles(BlockState state, WorldAccess world, BlockPos pos, float alpha) { + Direction direction = state.get(FACING).getOpposite(); + Direction direction2 = SwitchBlock.getDirection(state).getOpposite(); + double d = (double)pos.getX() + 0.5 + 0.1 * (double)direction.getOffsetX() + 0.2 * (double)direction2.getOffsetX(); + double e = (double)pos.getY() + 0.5 + 0.1 * (double)direction.getOffsetY() + 0.2 * (double)direction2.getOffsetY(); + double f = (double)pos.getZ() + 0.5 + 0.1 * (double)direction.getOffsetZ() + 0.2 * (double)direction2.getOffsetZ(); + world.addParticle(new DustParticleEffect(DustParticleEffect.RED, alpha), d, e, f, 0.0, 0.0, 0.0); + } @Override protected void appendProperties(StateManager.Builder builder) { diff --git a/src/main/java/su/a71/new_soviet/datagen/Advancements.java b/src/main/java/su/a71/new_soviet/datagen/Advancements.java index f8b1c8a..4819446 100644 --- a/src/main/java/su/a71/new_soviet/datagen/Advancements.java +++ b/src/main/java/su/a71/new_soviet/datagen/Advancements.java @@ -3,24 +3,19 @@ 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.UsingItemCriterion; -import net.minecraft.entity.EntityType; +import net.minecraft.advancement.criterion.PlayerHurtEntityCriterion; import net.minecraft.item.Items; -import net.minecraft.predicate.NumberRange; import net.minecraft.predicate.entity.DamageSourcePredicate; import net.minecraft.predicate.entity.EntityEquipmentPredicate; import net.minecraft.predicate.entity.EntityPredicate; -import net.minecraft.predicate.entity.PlayerPredicate; import net.minecraft.predicate.item.ItemPredicate; -import net.minecraft.stat.Stats; +import net.minecraft.registry.tag.ItemTags; import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.UseAction; import su.a71.new_soviet.NewSoviet; -import su.a71.new_soviet.items.DiceItem; import su.a71.new_soviet.registration.NSE_Items; -import su.a71.new_soviet.registration.NSE_Stats; import su.a71.new_soviet.registration.NSE_Tags; import java.util.function.Consumer; @@ -76,54 +71,34 @@ public class Advancements implements Consumer> { .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.TASK, - true, // Toast - true, // Announcement - false // Hidden - ) - .parent(root) - .criterion("rolled_100", UsingItemCriterion.Conditions.create( - EntityPredicate.Builder.create().type(EntityType.PLAYER).typeSpecific(PlayerPredicate.Builder.create().stat(Stats.CUSTOM.getOrCreateStat(NSE_Stats.ROLL_ANY_DICE), NumberRange.IntRange.atLeast(100)).build()), - ItemPredicate.Builder.create().tag(NSE_Tags.Items.DICE))) - .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("rolled_1000", UsingItemCriterion.Conditions.create(EntityPredicate.Builder.create().type(EntityType.PLAYER).typeSpecific(PlayerPredicate.Builder.create().stat(Stats.CUSTOM.getOrCreateStat(NSE_Stats.ROLL_ANY_DICE), NumberRange.IntRange.atLeast(1000)).build()), ItemPredicate.Builder.create().tag(NSE_Tags.Items.DICE))) - .parent(gambler) - .build(consumer, NewSoviet.MOD_ID + "/serious_addiction"); - - // Roll perfect die 100 times - Advancement lucky_throw = Advancement.Builder.create() - .display( - NSE_Items.DICE_D4, - Text.translatable("advancement.new_soviet.lucky_throw.name"), - Text.translatable("advancement.new_soviet.lucky_throw.desc"), - new Identifier("textures/gui/advancements/backgrounds/adventure.png"), - AdvancementFrame.CHALLENGE, - true, // Toast - true, // Announcement - false // Hidden - ) - .parent(gambler) - .criterion("rolled_100_perfect", UsingItemCriterion.Conditions.create(EntityPredicate.Builder.create().type(EntityType.PLAYER).typeSpecific(PlayerPredicate.Builder.create().stat(Stats.CUSTOM.getOrCreateStat(NSE_Stats.ROLL_PERFECT_DICE), NumberRange.IntRange.atLeast(100)).build()), ItemPredicate.Builder.create().tag(NSE_Tags.Items.DICE))) - .build(consumer, NewSoviet.MOD_ID + "/lucky_throw"); +// // 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"); } } diff --git a/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java b/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java index f976212..8973ed4 100644 --- a/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java +++ b/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java @@ -4,10 +4,13 @@ package su.a71.new_soviet.datagen; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; import net.minecraft.block.Block; +import net.minecraft.block.PaneBlock; import net.minecraft.block.SlabBlock; import net.minecraft.block.StairsBlock; import net.minecraft.data.client.*; +import net.minecraft.item.Item; import net.minecraft.registry.Registries; +import net.minecraft.state.property.Properties; import net.minecraft.util.Identifier; import su.a71.new_soviet.registration.NSE_Blocks; @@ -58,6 +61,18 @@ public class ModelGenerator extends FabricModelProvider { blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createStairsBlockState(stairs, stairs_model_inner, stairs_model, stairs_model_outer)); } +// public final void registerPaneFence(BlockStateModelGenerator blockStateModelGenerator, PaneBlock block, String texturePath) { +// TextureMap textureMap = (new TextureMap()).put(TextureKey.PANE, getId(block)).put(TextureKey.EDGE, getSubId(top, "_top")); +// Identifier identifier = Models.TEMPLATE_GLASS_PANE_POST.upload(glassPane, textureMap, this.modelCollector); +// Identifier identifier2 = Models.TEMPLATE_GLASS_PANE_SIDE.upload(glassPane, textureMap, this.modelCollector); +// Identifier identifier3 = Models.TEMPLATE_GLASS_PANE_SIDE_ALT.upload(glassPane, textureMap, this.modelCollector); +// Identifier identifier4 = Models.TEMPLATE_GLASS_PANE_NOSIDE.upload(glassPane, textureMap, this.modelCollector); +// Identifier identifier5 = Models.TEMPLATE_GLASS_PANE_NOSIDE_ALT.upload(glassPane, textureMap, this.modelCollector); +// Item item = glassPane.asItem(); +// Models.GENERATED.upload(ModelIds.getItemModelId(item), TextureMap.layer0(glass), this.modelCollector); +// this.blockStateCollector.accept(MultipartBlockStateSupplier.create(glassPane).with(BlockStateVariant.create().put(VariantSettings.MODEL, identifier)).with(When.create().set(Properties.NORTH, true), BlockStateVariant.create().put(VariantSettings.MODEL, identifier2)).with(When.create().set(Properties.EAST, true), BlockStateVariant.create().put(VariantSettings.MODEL, identifier2).put(VariantSettings.Y, VariantSettings.Rotation.R90)).with(When.create().set(Properties.SOUTH, true), BlockStateVariant.create().put(VariantSettings.MODEL, identifier3)).with(When.create().set(Properties.WEST, true), BlockStateVariant.create().put(VariantSettings.MODEL, identifier3).put(VariantSettings.Y, VariantSettings.Rotation.R90)).with(When.create().set(Properties.NORTH, false), BlockStateVariant.create().put(VariantSettings.MODEL, identifier4)).with(When.create().set(Properties.EAST, false), BlockStateVariant.create().put(VariantSettings.MODEL, identifier5)).with(When.create().set(Properties.SOUTH, false), BlockStateVariant.create().put(VariantSettings.MODEL, identifier5).put(VariantSettings.Y, VariantSettings.Rotation.R90)).with(When.create().set(Properties.WEST, false), BlockStateVariant.create().put(VariantSettings.MODEL, identifier4).put(VariantSettings.Y, VariantSettings.Rotation.R270))); +// } + @Override public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_BIRCH_DOOR); diff --git a/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java b/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java index 560f925..6a72392 100644 --- a/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java +++ b/src/main/java/su/a71/new_soviet/datagen/RecipeGenerator.java @@ -9,10 +9,12 @@ import net.minecraft.data.server.recipe.RecipeJsonProvider; import net.minecraft.data.server.recipe.RecipeProvider; import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; +import net.minecraft.item.DyeItem; import net.minecraft.item.ItemConvertible; import net.minecraft.item.Items; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.book.RecipeCategory; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.registry.tag.ItemTags; import net.minecraft.util.Util; import su.a71.new_soviet.registration.NSE_Blocks; @@ -154,6 +156,102 @@ public class RecipeGenerator extends FabricRecipeProvider { .offerTo(exporter); } + private void radioRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 1) + .pattern(" N") + .pattern("MMM") + .pattern("III") + .input('M', Blocks.NOTE_BLOCK) + .input('N', Items.IRON_NUGGET) + .input('I', Items.IRON_INGOT) + .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), + RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) + .criterion(RecipeProvider.hasItem(Items.NOTE_BLOCK), + RecipeProvider.conditionsFromItem(Items.NOTE_BLOCK)) + .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), + RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) + .offerTo(exporter); + } + + private void ceilingFanRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 1) + .pattern(" I ") + .pattern("NNN") + .input('I', Items.IRON_INGOT) + .input('N', Items.IRON_NUGGET) + .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), + RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) + .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), + RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) + .offerTo(exporter); + } + + private void tableLampRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 3) + .pattern("WWW") + .pattern("WTW") + .pattern(" S ") + + .input('S', Items.STICK) + .input('T', Items.TORCH) + .input('W', ItemTags.WOOL) + .criterion(RecipeProvider.hasItem(Items.TORCH), + RecipeProvider.conditionsFromItem(Items.TORCH)) + .criterion(RecipeProvider.hasItem(Items.STICK), + RecipeProvider.conditionsFromItem(Items.STICK)) + .criterion("has_wool", RecipeProvider.conditionsFromTag(ItemTags.WOOL)) + .offerTo(exporter); + } + + private void vintageLampRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 3) + .pattern("NNN") + .pattern("GTG") + .pattern(" N ") + + .input('N', Items.IRON_NUGGET) + .input('T', Items.TORCH) + .input('G', Items.GREEN_STAINED_GLASS) + .criterion(RecipeProvider.hasItem(Items.TORCH), + RecipeProvider.conditionsFromItem(Items.TORCH)) + .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), + RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) + .criterion(RecipeProvider.hasItem(Items.GREEN_STAINED_GLASS), + RecipeProvider.conditionsFromItem(Items.GREEN_STAINED_GLASS)) + .offerTo(exporter); + } + + private void sickleRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 1) + .pattern(" I ") + .pattern(" I") + .pattern(" S ") + .input('S', Items.STICK) + .input('I', Items.IRON_INGOT) + .criterion(RecipeProvider.hasItem(Items.STICK), + RecipeProvider.conditionsFromItem(Items.STICK)) + .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), + RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) + .offerTo(exporter); + } + + private void rakeRecipe(Consumer exporter, ItemConvertible output) { + ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, output, 1) + .pattern("III") + .pattern(" N ") + .pattern(" S ") + .input('S', Items.STICK) + .input('I', Items.IRON_INGOT) + .input('N', Items.IRON_NUGGET) + .criterion(RecipeProvider.hasItem(Items.STICK), + RecipeProvider.conditionsFromItem(Items.STICK)) + .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), + RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) + .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), + RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) + .offerTo(exporter); + } + private void offerStairsAndSlab(Consumer exporter, ItemConvertible output_stairs, ItemConvertible output_slab, ItemConvertible input) { createStairsRecipe(output_stairs, Ingredient.ofItems(input)) .criterion(hasItem(input), conditionsFromItem(input)).offerTo(exporter); @@ -174,6 +272,12 @@ public class RecipeGenerator extends FabricRecipeProvider { tvRecipe(exporter, NSE_Custom.TV, Items.ORANGE_DYE); tvRecipe(exporter, NSE_Custom.BROWN_TV, Items.BROWN_DYE); tvRecipe(exporter, NSE_Custom.RED_TV, Items.RED_DYE); + radioRecipe(exporter, NSE_Custom.RADIO_RECEIVER); + ceilingFanRecipe(exporter, NSE_Custom.CEILING_FAN); + tableLampRecipe(exporter, NSE_Custom.TABLE_LAMP); + vintageLampRecipe(exporter, NSE_Custom.VINTAGE_LAMP); + sickleRecipe(exporter, NSE_Items.SICKLE); + rakeRecipe(exporter, NSE_Items.RAKE); // Cracked blocks offerCrackingRecipe(exporter, NSE_Blocks.CRACKED_BRICK_TILES, NSE_Blocks.BRICK_TILES); @@ -436,90 +540,6 @@ public class RecipeGenerator extends FabricRecipeProvider { offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, NSE_Blocks.CHISELED_SPRUCE_DOOR, Blocks.SPRUCE_DOOR); offerStonecuttingRecipe(exporter, RecipeCategory.BUILDING_BLOCKS, NSE_Blocks.CHISELED_BIRCH_DOOR, Blocks.BIRCH_DOOR); - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Custom.RADIO_RECEIVER, 1) - .pattern(" N") - .pattern("MMM") - .pattern("III") - .input('M', Blocks.NOTE_BLOCK) - .input('N', Items.IRON_NUGGET) - .input('I', Items.IRON_INGOT) - .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), - RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) - .criterion(RecipeProvider.hasItem(Items.NOTE_BLOCK), - RecipeProvider.conditionsFromItem(Items.NOTE_BLOCK)) - .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), - RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Custom.CEILING_FAN, 1) - .pattern(" I ") - .pattern("NNN") - .input('I', Items.IRON_INGOT) - .input('N', Items.IRON_NUGGET) - .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), - RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) - .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), - RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Custom.TABLE_LAMP, 3) - .pattern("WWW") - .pattern("WTW") - .pattern(" S ") - - .input('S', Items.STICK) - .input('T', Items.TORCH) - .input('W', ItemTags.WOOL) - .criterion(RecipeProvider.hasItem(Items.TORCH), - RecipeProvider.conditionsFromItem(Items.TORCH)) - .criterion(RecipeProvider.hasItem(Items.STICK), - RecipeProvider.conditionsFromItem(Items.STICK)) - .criterion("has_wool", RecipeProvider.conditionsFromTag(ItemTags.WOOL)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Custom.VINTAGE_LAMP, 3) - .pattern("NNN") - .pattern("GTG") - .pattern(" N ") - - .input('N', Items.IRON_NUGGET) - .input('T', Items.TORCH) - .input('G', Items.GREEN_STAINED_GLASS) - .criterion(RecipeProvider.hasItem(Items.TORCH), - RecipeProvider.conditionsFromItem(Items.TORCH)) - .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), - RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) - .criterion(RecipeProvider.hasItem(Items.GREEN_STAINED_GLASS), - RecipeProvider.conditionsFromItem(Items.GREEN_STAINED_GLASS)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Items.SICKLE, 1) - .pattern(" I ") - .pattern(" I") - .pattern(" S ") - .input('S', Items.STICK) - .input('I', Items.IRON_INGOT) - .criterion(RecipeProvider.hasItem(Items.STICK), - RecipeProvider.conditionsFromItem(Items.STICK)) - .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), - RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(RecipeCategory.DECORATIONS, NSE_Items.RAKE, 1) - .pattern("III") - .pattern(" N ") - .pattern(" S ") - .input('S', Items.STICK) - .input('I', Items.IRON_INGOT) - .input('N', Items.IRON_NUGGET) - .criterion(RecipeProvider.hasItem(Items.STICK), - RecipeProvider.conditionsFromItem(Items.STICK)) - .criterion(RecipeProvider.hasItem(Items.IRON_INGOT), - RecipeProvider.conditionsFromItem(Items.IRON_INGOT)) - .criterion(RecipeProvider.hasItem(Items.IRON_NUGGET), - RecipeProvider.conditionsFromItem(Items.IRON_NUGGET)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(RecipeCategory.MISC, NSE_Items.LIGHT_BULB, 1) .input('B', Items.GLASS_BOTTLE).input('N', Items.IRON_NUGGET).input('D', Items.GLOWSTONE_DUST) .pattern(" D ").pattern(" B ").pattern(" N ") diff --git a/src/main/java/su/a71/new_soviet/items/CigaretteItem.java b/src/main/java/su/a71/new_soviet/items/CigaretteItem.java index 35a7cf3..8b01af2 100644 --- a/src/main/java/su/a71/new_soviet/items/CigaretteItem.java +++ b/src/main/java/su/a71/new_soviet/items/CigaretteItem.java @@ -13,6 +13,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.entity.LivingEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; import org.jetbrains.annotations.Nullable; import su.a71.new_soviet.NewSoviet; import su.a71.new_soviet.registration.NSE_Sounds; diff --git a/src/main/java/su/a71/new_soviet/items/DiceItem.java b/src/main/java/su/a71/new_soviet/items/DiceItem.java index 12302e7..c7ac541 100644 --- a/src/main/java/su/a71/new_soviet/items/DiceItem.java +++ b/src/main/java/su/a71/new_soviet/items/DiceItem.java @@ -48,7 +48,7 @@ public class DiceItem extends Item { user.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown" : "item.new_soviet.dice.thrown_multiple").append(" " + output.subSequence(0, output.length() - 2)), true); } } - user.increaseStat(Stats.CUSTOM.getOrCreateStat(NSE_Stats.ROLL_ANY_DICE), itemStack.getCount()); + user.increaseStat(Stats.USED.getOrCreateStat(this), itemStack.getCount()); return TypedActionResult.success(itemStack, world.isClient()); } diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Stats.java b/src/main/java/su/a71/new_soviet/registration/NSE_Stats.java index a27c993..446958b 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Stats.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Stats.java @@ -8,14 +8,10 @@ import net.minecraft.util.Identifier; import su.a71.new_soviet.NewSoviet; public class NSE_Stats extends NSE_BaseRegistration { - public static final Identifier ROLL_ANY_DICE = new Identifier(NewSoviet.MOD_ID, "roll_dice"); 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); - - Registry.register(Registries.CUSTOM_STAT, "roll_dice", ROLL_ANY_DICE); - Stats.CUSTOM.getOrCreateStat(ROLL_ANY_DICE, StatFormatter.DEFAULT); } } \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/lang/en_us.json b/src/main/resources/assets/new_soviet/lang/en_us.json index 2a8ca21..525ef0f 100644 --- a/src/main/resources/assets/new_soviet/lang/en_us.json +++ b/src/main/resources/assets/new_soviet/lang/en_us.json @@ -474,11 +474,5 @@ "advancement.new_soviet.sickle.name": "Tool of a worker", "advancement.new_soviet.sickle.desc": "Acquire a sickle", "advancement.new_soviet.sickle_kill.name": "Kolkhoz Warrior", - "advancement.new_soviet.sickle_kill.desc": "Kill someone with a sickle", - "advancement.new_soviet.gambler.name": "Gambler", - "advancement.new_soviet.gambler.desc": "Roll dice 100 times", - "advancement.new_soviet.serious_addiction.name": "Serious addiction", - "advancement.new_soviet.serious_addiction.desc": "Throw a die 1000 times, and then reevaluate your life choices", - "advancement.new_soviet.lucky_throw.name": "Lucky throw", - "advancement.new_soviet.lucky_throw.desc": "Roll a perfect die 100 times" + "advancement.new_soviet.sickle_kill.desc": "Kill someone with a sickle" } \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/models/item/cigarette.json b/src/main/resources/assets/new_soviet/models/item/cigarette.json index ff9bc99..a25de1c 100644 --- a/src/main/resources/assets/new_soviet/models/item/cigarette.json +++ b/src/main/resources/assets/new_soviet/models/item/cigarette.json @@ -33,8 +33,8 @@ "rotation": [90, 0, 0] }, "gui": { - "rotation": [-155, 225, 0], - "scale": [2.5, 2.5, 2.5] + "rotation": [-157, 0, 0], + "scale": [3.5, 3.5, 3.5] }, "head": { "rotation": [90, 0, 0],