Add non working achievements

This commit is contained in:
Andrew-71 2023-10-21 17:19:40 +03:00
parent 78f9b80861
commit 24e5854d8c
11 changed files with 249 additions and 101 deletions

View file

@ -31,5 +31,12 @@
This version focuses on QOL and bug fixes
* Added Russian translation (ru_ru)
* Fixed some issues with blocks being non opaque
* Deleted some unused textures and models
* 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

View file

@ -31,15 +31,6 @@ 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());

View file

@ -1,57 +0,0 @@
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.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<TVBlockEntity> {
// 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);
}
}

View file

@ -0,0 +1,56 @@
{
"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
}

View file

@ -0,0 +1,56 @@
{
"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
}

View file

@ -0,0 +1,56 @@
{
"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
}

View file

@ -4,15 +4,24 @@ import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementFrame;
import net.minecraft.advancement.criterion.InventoryChangedCriterion;
import net.minecraft.advancement.criterion.OnKilledCriterion;
import net.minecraft.advancement.criterion.UsingItemCriterion;
import net.minecraft.entity.EntityType;
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.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;
@ -67,34 +76,54 @@ public class Advancements implements Consumer<Consumer<Advancement>> {
.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");
// 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");
}
}

View file

@ -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());
}

View file

@ -8,10 +8,14 @@ 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);
}
}

View file

@ -474,5 +474,11 @@
"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.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"
}

View file

@ -33,8 +33,8 @@
"rotation": [90, 0, 0]
},
"gui": {
"rotation": [-157, 0, 0],
"scale": [3.5, 3.5, 3.5]
"rotation": [-155, 225, 0],
"scale": [2.5, 2.5, 2.5]
},
"head": {
"rotation": [90, 0, 0],