From fc35c1d7b35567c11cf4a50261c29077bcf46b01 Mon Sep 17 00:00:00 2001 From: Niklas Widmann Date: Fri, 20 Sep 2024 10:40:03 +0200 Subject: [PATCH] advancements & updated electrum textures --- .../assets/oreganized/lang/en_us.json | 34 +-- .../advancements/adventure/demoted.json | 31 +++ .../advancements/adventure/garglin_water.json | 30 +++ .../advancements/adventure/mirror_mirror.json | 4 +- .../advancements/adventure/weeping_devil.json | 49 +++++ .../advancements/husbandry/groovy.json | 49 +++++ .../advancements/story/disc_smith.json | 4 +- .../advancements/story/electrum_gear.json | 4 +- ...at_with_lead.json => like_the_romans.json} | 28 +-- .../advancements/story/melting_point.json | 4 +- .../advancements/story/obtain_silver.json | 4 +- .../story/profound_brain_damage.json | 38 ++++ .../java/galena/oreganized/Oreganized.java | 6 +- .../critera/DummyCriterionTrigger.java | 51 +++++ .../content/entity/GargoyleBlockEntity.java | 13 +- .../content/entity/LeadBoltEntity.java | 10 + .../oreganized/content/item/ScribeItem.java | 5 + .../galena/oreganized/data/OAdvancements.java | 199 +++++++++++------- .../java/galena/oreganized/data/OLang.java | 16 +- .../data/provider/OLangProvider.java | 19 +- .../oreganized/index/OCriteriaTriggers.java | 14 ++ .../compat/LogStrippingFakeRecipesMixin.java | 42 ++++ .../textures/item/electrum_pickaxe.png | Bin 265 -> 270 bytes .../textures/item/electrum_shovel.png | Bin 261 -> 267 bytes .../textures/item/electrum_sword.png | Bin 272 -> 271 bytes .../item_application/grooved_blue_ice.json | 17 -- .../create/item_application/grooved_ice.json | 17 -- .../item_application/grooved_packed_ice.json | 17 -- src/main/resources/oreganized.mixins.json | 3 +- 29 files changed, 508 insertions(+), 200 deletions(-) create mode 100644 src/generated/resources/data/oreganized/advancements/adventure/demoted.json create mode 100644 src/generated/resources/data/oreganized/advancements/adventure/garglin_water.json create mode 100644 src/generated/resources/data/oreganized/advancements/adventure/weeping_devil.json create mode 100644 src/generated/resources/data/oreganized/advancements/husbandry/groovy.json rename src/generated/resources/data/oreganized/advancements/story/{eat_with_lead.json => like_the_romans.json} (50%) create mode 100644 src/generated/resources/data/oreganized/advancements/story/profound_brain_damage.json create mode 100644 src/main/java/galena/oreganized/content/critera/DummyCriterionTrigger.java create mode 100644 src/main/java/galena/oreganized/index/OCriteriaTriggers.java create mode 100644 src/main/java/galena/oreganized/mixin/compat/LogStrippingFakeRecipesMixin.java delete mode 100644 src/main/resources/data/oreganized/recipes/create/item_application/grooved_blue_ice.json delete mode 100644 src/main/resources/data/oreganized/recipes/create/item_application/grooved_ice.json delete mode 100644 src/main/resources/data/oreganized/recipes/create/item_application/grooved_packed_ice.json diff --git a/src/generated/resources/assets/oreganized/lang/en_us.json b/src/generated/resources/assets/oreganized/lang/en_us.json index ee9aa7bf..aa57e735 100644 --- a/src/generated/resources/assets/oreganized/lang/en_us.json +++ b/src/generated/resources/assets/oreganized/lang/en_us.json @@ -1,16 +1,26 @@ { - "advancements.adventure.mirror_mirror.description": "Obtain a Silver Mirror", - "advancements.adventure.mirror_mirror.title": "Mirror, Mirror who is the fairest?", - "advancements.story.disc_smith.description": "Submerge a broken music disc into molten lead", - "advancements.story.disc_smith.title": "Disc Smith", - "advancements.story.eat_with_lead.description": "Eat anything with lead in your hotbar", - "advancements.story.eat_with_lead.title": "Like the Romans", - "advancements.story.electrum_gear.description": "Obtain a full set of electrum armor", - "advancements.story.electrum_gear.title": "Cover me in... Wings?", - "advancements.story.melting_point.description": "Pick up Molten Lead from a cauldron", - "advancements.story.melting_point.title": "Melting Point", - "advancements.story.obtain_silver.description": "Smelt Raw Silver", - "advancements.story.obtain_silver.title": "Every Stone has a Silver Lining", + "advancements.oreganized.demoted.description": "Use lead bolts in a crossbow to strip a pillager of his Ominous Banner", + "advancements.oreganized.demoted.title": "Demoted", + "advancements.oreganized.disc_smith.description": "Submerge a broken music disc into molten lead", + "advancements.oreganized.disc_smith.title": "Disc Smith", + "advancements.oreganized.electrum_gear.description": "Obtain a full set of electrum armor", + "advancements.oreganized.electrum_gear.title": "Cover me in... Wings?", + "advancements.oreganized.garglin_water.description": "Provide Gargoyle with a source of water to spew even without rain", + "advancements.oreganized.garglin_water.title": "Garglin' Water", + "advancements.oreganized.groovy.description": "Use the scribe to make grooves on Ice!", + "advancements.oreganized.groovy.title": "Groovy", + "advancements.oreganized.like_the_romans.description": "Get Brain Damage from interacting with lead", + "advancements.oreganized.like_the_romans.title": "Like the Romans", + "advancements.oreganized.melting_point.description": "Pick up Molten Lead from a cauldron", + "advancements.oreganized.melting_point.title": "Melting Point", + "advancements.oreganized.mirror_mirror.description": "Obtain a Silver Mirror", + "advancements.oreganized.mirror_mirror.title": "Mirror, Mirror who is the fairest?", + "advancements.oreganized.obtain_silver.description": "Smelt Raw Silver", + "advancements.oreganized.obtain_silver.title": "Every Stone has a Silver Lining", + "advancements.oreganized.profound_brain_damage.description": "Let your health reach half a heart while having the Brain Damage effect", + "advancements.oreganized.profound_brain_damage.title": "Profound Brain Damage", + "advancements.oreganized.weeping_devil.description": "Exchange a Silver Ingot for a hellish growl of the Gargoyle", + "advancements.oreganized.weeping_devil.title": "Weeping Devil", "attribute.oreganized.kinetic_damage": "Kinetic Damage", "block.oreganized.black_crystal_glass": "Black Crystal Glass", "block.oreganized.black_crystal_glass_pane": "Black Crystal Glass Pane", diff --git a/src/generated/resources/data/oreganized/advancements/adventure/demoted.json b/src/generated/resources/data/oreganized/advancements/adventure/demoted.json new file mode 100644 index 00000000..eb4a5895 --- /dev/null +++ b/src/generated/resources/data/oreganized/advancements/adventure/demoted.json @@ -0,0 +1,31 @@ +{ + "parent": "minecraft:adventure/whos_the_pillager_now", + "criteria": { + "see_gargoyle_gargle": { + "conditions": {}, + "trigger": "oreganized:knocked_banner_off" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancements.oreganized.demoted.description" + }, + "frame": "challenge", + "hidden": false, + "icon": { + "item": "minecraft:crossbow", + "nbt": "{Damage:0}" + }, + "show_toast": true, + "title": { + "translate": "advancements.oreganized.demoted.title" + } + }, + "requirements": [ + [ + "see_gargoyle_gargle" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/src/generated/resources/data/oreganized/advancements/adventure/garglin_water.json b/src/generated/resources/data/oreganized/advancements/adventure/garglin_water.json new file mode 100644 index 00000000..507bc788 --- /dev/null +++ b/src/generated/resources/data/oreganized/advancements/adventure/garglin_water.json @@ -0,0 +1,30 @@ +{ + "parent": "oreganized:adventure/weeping_devil", + "criteria": { + "see_gargoyle_gargle": { + "conditions": {}, + "trigger": "oreganized:see_gargoyle_gargle" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancements.oreganized.garglin_water.description" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "minecraft:water_bucket" + }, + "show_toast": true, + "title": { + "translate": "advancements.oreganized.garglin_water.title" + } + }, + "requirements": [ + [ + "see_gargoyle_gargle" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/src/generated/resources/data/oreganized/advancements/adventure/mirror_mirror.json b/src/generated/resources/data/oreganized/advancements/adventure/mirror_mirror.json index 61be3873..61ba39f0 100644 --- a/src/generated/resources/data/oreganized/advancements/adventure/mirror_mirror.json +++ b/src/generated/resources/data/oreganized/advancements/adventure/mirror_mirror.json @@ -17,7 +17,7 @@ "display": { "announce_to_chat": true, "description": { - "translate": "advancements.adventure.mirror_mirror.description" + "translate": "advancements.oreganized.mirror_mirror.description" }, "frame": "task", "hidden": false, @@ -26,7 +26,7 @@ }, "show_toast": true, "title": { - "translate": "advancements.adventure.mirror_mirror.title" + "translate": "advancements.oreganized.mirror_mirror.title" } }, "requirements": [ diff --git a/src/generated/resources/data/oreganized/advancements/adventure/weeping_devil.json b/src/generated/resources/data/oreganized/advancements/adventure/weeping_devil.json new file mode 100644 index 00000000..a418dc93 --- /dev/null +++ b/src/generated/resources/data/oreganized/advancements/adventure/weeping_devil.json @@ -0,0 +1,49 @@ +{ + "parent": "minecraft:adventure/root", + "criteria": { + "activated_gargoyle": { + "conditions": { + "location": [ + { + "condition": "minecraft:location_check", + "predicate": { + "block": { + "blocks": [ + "oreganized:gargoyle" + ] + } + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "tag": "forge:ingots/silver" + } + } + ] + }, + "trigger": "minecraft:item_used_on_block" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancements.oreganized.weeping_devil.description" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "oreganized:gargoyle" + }, + "show_toast": true, + "title": { + "translate": "advancements.oreganized.weeping_devil.title" + } + }, + "requirements": [ + [ + "activated_gargoyle" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/src/generated/resources/data/oreganized/advancements/husbandry/groovy.json b/src/generated/resources/data/oreganized/advancements/husbandry/groovy.json new file mode 100644 index 00000000..76f62608 --- /dev/null +++ b/src/generated/resources/data/oreganized/advancements/husbandry/groovy.json @@ -0,0 +1,49 @@ +{ + "parent": "minecraft:husbandry/root", + "criteria": { + "use_scribe_on_ice": { + "conditions": { + "location": [ + { + "condition": "minecraft:location_check", + "predicate": { + "block": { + "tag": "minecraft:ice" + } + } + }, + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "oreganized:scribe" + ] + } + } + ] + }, + "trigger": "minecraft:item_used_on_block" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancements.oreganized.groovy.description" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "oreganized:grooved_ice" + }, + "show_toast": true, + "title": { + "translate": "advancements.oreganized.groovy.title" + } + }, + "requirements": [ + [ + "use_scribe_on_ice" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/src/generated/resources/data/oreganized/advancements/story/disc_smith.json b/src/generated/resources/data/oreganized/advancements/story/disc_smith.json index eeff501a..a618848b 100644 --- a/src/generated/resources/data/oreganized/advancements/story/disc_smith.json +++ b/src/generated/resources/data/oreganized/advancements/story/disc_smith.json @@ -17,7 +17,7 @@ "display": { "announce_to_chat": true, "description": { - "translate": "advancements.story.disc_smith.description" + "translate": "advancements.oreganized.disc_smith.description" }, "frame": "task", "hidden": false, @@ -26,7 +26,7 @@ }, "show_toast": true, "title": { - "translate": "advancements.story.disc_smith.title" + "translate": "advancements.oreganized.disc_smith.title" } }, "requirements": [ diff --git a/src/generated/resources/data/oreganized/advancements/story/electrum_gear.json b/src/generated/resources/data/oreganized/advancements/story/electrum_gear.json index 4d84ea73..3f5be3a0 100644 --- a/src/generated/resources/data/oreganized/advancements/story/electrum_gear.json +++ b/src/generated/resources/data/oreganized/advancements/story/electrum_gear.json @@ -32,7 +32,7 @@ "display": { "announce_to_chat": true, "description": { - "translate": "advancements.story.electrum_gear.description" + "translate": "advancements.oreganized.electrum_gear.description" }, "frame": "challenge", "hidden": false, @@ -42,7 +42,7 @@ }, "show_toast": true, "title": { - "translate": "advancements.story.electrum_gear.title" + "translate": "advancements.oreganized.electrum_gear.title" } }, "requirements": [ diff --git a/src/generated/resources/data/oreganized/advancements/story/eat_with_lead.json b/src/generated/resources/data/oreganized/advancements/story/like_the_romans.json similarity index 50% rename from src/generated/resources/data/oreganized/advancements/story/eat_with_lead.json rename to src/generated/resources/data/oreganized/advancements/story/like_the_romans.json index 5069dc54..b8c91044 100644 --- a/src/generated/resources/data/oreganized/advancements/story/eat_with_lead.json +++ b/src/generated/resources/data/oreganized/advancements/story/like_the_romans.json @@ -1,21 +1,7 @@ { "parent": "minecraft:story/upgrade_tools", "criteria": { - "eaten": { - "conditions": {}, - "trigger": "minecraft:consume_item" - }, - "has_lead": { - "conditions": { - "items": [ - { - "tag": "forge:ingots/lead" - } - ] - }, - "trigger": "minecraft:inventory_changed" - }, - "stunned": { + "has_brain_damage": { "conditions": { "effects": { "oreganized:stunning": {} @@ -27,7 +13,7 @@ "display": { "announce_to_chat": true, "description": { - "translate": "advancements.story.eat_with_lead.description" + "translate": "advancements.oreganized.like_the_romans.description" }, "frame": "task", "hidden": false, @@ -36,18 +22,12 @@ }, "show_toast": true, "title": { - "translate": "advancements.story.eat_with_lead.title" + "translate": "advancements.oreganized.like_the_romans.title" } }, "requirements": [ [ - "stunned" - ], - [ - "has_lead" - ], - [ - "eaten" + "has_brain_damage" ] ], "sends_telemetry_event": true diff --git a/src/generated/resources/data/oreganized/advancements/story/melting_point.json b/src/generated/resources/data/oreganized/advancements/story/melting_point.json index fdf7537a..1f10d3c2 100644 --- a/src/generated/resources/data/oreganized/advancements/story/melting_point.json +++ b/src/generated/resources/data/oreganized/advancements/story/melting_point.json @@ -17,7 +17,7 @@ "display": { "announce_to_chat": true, "description": { - "translate": "advancements.story.melting_point.description" + "translate": "advancements.oreganized.melting_point.description" }, "frame": "task", "hidden": false, @@ -26,7 +26,7 @@ }, "show_toast": true, "title": { - "translate": "advancements.story.melting_point.title" + "translate": "advancements.oreganized.melting_point.title" } }, "requirements": [ diff --git a/src/generated/resources/data/oreganized/advancements/story/obtain_silver.json b/src/generated/resources/data/oreganized/advancements/story/obtain_silver.json index 44e6bbf4..186d63f7 100644 --- a/src/generated/resources/data/oreganized/advancements/story/obtain_silver.json +++ b/src/generated/resources/data/oreganized/advancements/story/obtain_silver.json @@ -15,7 +15,7 @@ "display": { "announce_to_chat": true, "description": { - "translate": "advancements.story.obtain_silver.description" + "translate": "advancements.oreganized.obtain_silver.description" }, "frame": "task", "hidden": false, @@ -24,7 +24,7 @@ }, "show_toast": true, "title": { - "translate": "advancements.story.obtain_silver.title" + "translate": "advancements.oreganized.obtain_silver.title" } }, "requirements": [ diff --git a/src/generated/resources/data/oreganized/advancements/story/profound_brain_damage.json b/src/generated/resources/data/oreganized/advancements/story/profound_brain_damage.json new file mode 100644 index 00000000..32092ef4 --- /dev/null +++ b/src/generated/resources/data/oreganized/advancements/story/profound_brain_damage.json @@ -0,0 +1,38 @@ +{ + "parent": "oreganized:story/like_the_romans", + "criteria": { + "stunned": { + "conditions": { + "effects": { + "oreganized:stunning": { + "amplifier": { + "max": 4 + } + } + } + }, + "trigger": "minecraft:effects_changed" + } + }, + "display": { + "announce_to_chat": true, + "description": { + "translate": "advancements.oreganized.profound_brain_damage.description" + }, + "frame": "task", + "hidden": false, + "icon": { + "item": "oreganized:molten_lead_bucket" + }, + "show_toast": true, + "title": { + "translate": "advancements.oreganized.profound_brain_damage.title" + } + }, + "requirements": [ + [ + "stunned" + ] + ], + "sends_telemetry_event": true +} \ No newline at end of file diff --git a/src/main/java/galena/oreganized/Oreganized.java b/src/main/java/galena/oreganized/Oreganized.java index 2a33b65f..728e9c59 100644 --- a/src/main/java/galena/oreganized/Oreganized.java +++ b/src/main/java/galena/oreganized/Oreganized.java @@ -250,9 +250,11 @@ public void gatherData(GatherDataEvent event) { boolean client = event.includeClient(); boolean server = event.includeServer(); + var lang = new OLang(output); + generator.addProvider(client, new OBlockStates(output, helper)); generator.addProvider(client, new OItemModels(output, helper)); - generator.addProvider(client, new OLang(output)); + generator.addProvider(client, lang); generator.addProvider(client, new OSoundDefinitions(output, helper)); generator.addProvider(client, new OSpriteSourceProvider(output, helper)); @@ -262,7 +264,7 @@ public void gatherData(GatherDataEvent event) { generator.addProvider(server, blockTags); generator.addProvider(server, new OItemTags(output, future, blockTags.contentsGetter(), helper)); generator.addProvider(server, new OEntityTags(output, future, helper)); - generator.addProvider(server, new OAdvancements(output, future, helper)); + generator.addProvider(server, new OAdvancements(output, future, helper, lang)); generator.addProvider(server, new OFluidTags(output, future, helper)); DatapackBuiltinEntriesProvider datapackProvider = new ORegistries(output, future); CompletableFuture lookupProvider = datapackProvider.getRegistryProvider(); diff --git a/src/main/java/galena/oreganized/content/critera/DummyCriterionTrigger.java b/src/main/java/galena/oreganized/content/critera/DummyCriterionTrigger.java new file mode 100644 index 00000000..125b2917 --- /dev/null +++ b/src/main/java/galena/oreganized/content/critera/DummyCriterionTrigger.java @@ -0,0 +1,51 @@ +package galena.oreganized.content.critera; + +import com.google.gson.JsonObject; +import com.simibubi.create.foundation.advancement.CriterionTriggerBase; +import net.minecraft.advancements.critereon.ContextAwarePredicate; +import net.minecraft.advancements.critereon.DeserializationContext; +import net.minecraft.advancements.critereon.SimpleCriterionTrigger; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.function.Supplier; + +public class DummyCriterionTrigger extends SimpleCriterionTrigger { + + private final ResourceLocation id; + + public DummyCriterionTrigger(ResourceLocation id) { + this.id = id; + } + + public TriggerInstance instance() { + return new TriggerInstance(getId()); + } + + @Override + protected TriggerInstance createInstance(JsonObject json, ContextAwarePredicate contextAwarePredicate, DeserializationContext deserializationContext) { + return instance(); + } + + public void trigger(ServerPlayer player) { + this.trigger(player, instance -> true); + } + + @Override + public ResourceLocation getId() { + return id; + } + + public static class TriggerInstance extends CriterionTriggerBase.Instance { + public TriggerInstance(ResourceLocation idIn) { + super(idIn, ContextAwarePredicate.ANY); + } + + protected boolean test(@Nullable List> suppliers) { + return true; + } + } + +} diff --git a/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java b/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java index 250a8782..4048cc5a 100644 --- a/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java +++ b/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java @@ -3,6 +3,7 @@ import galena.oreganized.Oreganized; import galena.oreganized.content.block.GargoyleBlock; import galena.oreganized.index.OBlockEntities; +import galena.oreganized.index.OCriteriaTriggers; import galena.oreganized.index.OParticleTypes; import galena.oreganized.index.OSoundEvents; import galena.oreganized.index.OTags; @@ -15,6 +16,7 @@ import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; import net.minecraft.util.ParticleUtils; import net.minecraft.util.valueproviders.UniformInt; @@ -27,6 +29,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.PacketDistributor; @@ -99,12 +102,20 @@ private void updateDripParticles(Level level, BlockPos pos, BlockState state) { var targetPos = pos.relative(fluidOffset, i); var targetState = level.getBlockState(targetPos); var fluid = targetState.getFluidState(); + if (!fluid.isEmpty()) { drippingFluid = fluid.getDripParticle(); + + if (fluid.is(Fluids.WATER)) { + level.getEntitiesOfClass(ServerPlayer.class, new AABB(pos).inflate(10.0, 5.0, 10.0)).forEach(player -> { + OCriteriaTriggers.SEE_GARGOYLE_GARGLE.trigger(player); + }); + } + return; } - if(!targetState.isRedstoneConductor(level, pos)) { + if (!targetState.isRedstoneConductor(level, pos)) { break; } diff --git a/src/main/java/galena/oreganized/content/entity/LeadBoltEntity.java b/src/main/java/galena/oreganized/content/entity/LeadBoltEntity.java index 7ff05bb0..d0dbea1e 100644 --- a/src/main/java/galena/oreganized/content/entity/LeadBoltEntity.java +++ b/src/main/java/galena/oreganized/content/entity/LeadBoltEntity.java @@ -1,16 +1,20 @@ package galena.oreganized.content.entity; +import galena.oreganized.index.OCriteriaTriggers; import galena.oreganized.index.OItems; import galena.oreganized.index.OSoundEvents; import net.minecraft.core.Position; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.ItemTags; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.Pillager; import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.item.Equipable; import net.minecraft.world.item.ItemStack; @@ -87,6 +91,12 @@ private void damageEntity(EntityHitResult result) { playSound(item.getEquipSound()); } + if (result.getEntity() instanceof Pillager && knockedOff.is(ItemTags.BANNERS)) { + if (getOwner() instanceof ServerPlayer player) { + OCriteriaTriggers.KNOCKED_BANNER_OFF.trigger(player); + } + } + discard(); return; } diff --git a/src/main/java/galena/oreganized/content/item/ScribeItem.java b/src/main/java/galena/oreganized/content/item/ScribeItem.java index b094eef5..6292d4fe 100644 --- a/src/main/java/galena/oreganized/content/item/ScribeItem.java +++ b/src/main/java/galena/oreganized/content/item/ScribeItem.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.function.Supplier; import static galena.oreganized.index.OTags.Blocks.MINEABLE_WITH_SCRIBE; @@ -36,6 +37,10 @@ public static void registerGroovedBlock(Block from, Supplier to) { GROOVED_BLOCKS.put(from, to); } + public static Set>> getGroovedBlocks() { + return GROOVED_BLOCKS.entrySet(); + } + static { registerGroovedBlock(Blocks.ICE, OBlocks.GROOVED_ICE); registerGroovedBlock(Blocks.PACKED_ICE, OBlocks.GROOVED_PACKED_ICE); diff --git a/src/main/java/galena/oreganized/data/OAdvancements.java b/src/main/java/galena/oreganized/data/OAdvancements.java index 3906b549..1f999002 100644 --- a/src/main/java/galena/oreganized/data/OAdvancements.java +++ b/src/main/java/galena/oreganized/data/OAdvancements.java @@ -1,131 +1,174 @@ package galena.oreganized.data; +import galena.oreganized.Oreganized; +import galena.oreganized.content.effect.StunningEffect; +import galena.oreganized.data.provider.OLangProvider; +import galena.oreganized.index.OBlocks; +import galena.oreganized.index.OCriteriaTriggers; import galena.oreganized.index.OEffects; import galena.oreganized.index.OItems; import galena.oreganized.index.OTags; import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.DisplayInfo; import net.minecraft.advancements.FrameType; -import net.minecraft.advancements.critereon.*; +import net.minecraft.advancements.critereon.BlockPredicate; +import net.minecraft.advancements.critereon.EffectsChangedTrigger; +import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger; +import net.minecraft.advancements.critereon.LocationPredicate; +import net.minecraft.advancements.critereon.MinMaxBounds; +import net.minecraft.advancements.critereon.MobEffectsPredicate; import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.common.data.ForgeAdvancementProvider; +import javax.annotation.Nullable; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; public class OAdvancements extends ForgeAdvancementProvider { - public OAdvancements(PackOutput output, CompletableFuture future, ExistingFileHelper helper) { - super(output, future, helper, List.of(new OreganizedAdvancements())); + public OAdvancements(PackOutput output, CompletableFuture future, ExistingFileHelper helper, OLangProvider lang) { + super(output, future, helper, List.of(new OreganizedAdvancements(lang))); } static class OreganizedAdvancements implements ForgeAdvancementProvider.AdvancementGenerator { + private final OLangProvider lang; + + OreganizedAdvancements(OLangProvider lang) { + this.lang = lang; + lang.addSubProvider(() -> this.generate(null, $ -> { + }, null)); + } + @Override - public void generate(HolderLookup.Provider provider, Consumer consumer, ExistingFileHelper helper) { - Advancement mirror_mirror = Advancement.Builder.advancement() + public void generate(@Nullable HolderLookup.Provider provider, Consumer consumer, @Nullable ExistingFileHelper helper) { + Advancement.Builder.advancement() .parent(getAdv("minecraft:adventure/root")) - .display( - OItems.SILVER_MIRROR.get(), - Component.translatable("advancements.adventure.mirror_mirror.title"), - Component.translatable("advancements.adventure.mirror_mirror.description"), - null, - FrameType.TASK, - true, - true, - false - ) + .display(info(OItems.SILVER_MIRROR.get(), "mirror_mirror", FrameType.TASK, + "Mirror, Mirror who is the fairest?", "Obtain a Silver Mirror")) .addCriterion("has_silver_mirror", InventoryChangeTrigger.TriggerInstance.hasItems(OItems.SILVER_MIRROR.get())) .save(consumer, "oreganized:adventure/mirror_mirror"); - Advancement eat_with_lead = Advancement.Builder.advancement() + var likeTheRomans = Advancement.Builder.advancement() .parent(getAdv("minecraft:story/upgrade_tools")) - .display( - OItems.LEAD_INGOT.get(), - Component.translatable("advancements.story.eat_with_lead.title"), - Component.translatable("advancements.story.eat_with_lead.description"), - null, - FrameType.TASK, - true, - true, - false - ) - .addCriterion("stunned", EffectsChangedTrigger.TriggerInstance.hasEffects(MobEffectsPredicate.effects().and(OEffects.STUNNING.get()))) - .addCriterion("has_lead", InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().of(OTags.Items.INGOTS_LEAD).build())) - .addCriterion("eaten", ConsumeItemTrigger.TriggerInstance.usedItem()) - .save(consumer, "oreganized:story/eat_with_lead"); - - Advancement obtain_silver = Advancement.Builder.advancement() + .display(info(OItems.LEAD_INGOT.get(), "like_the_romans", FrameType.TASK, + "Like the Romans", "Get Brain Damage from interacting with lead")) + .addCriterion("has_brain_damage", EffectsChangedTrigger.TriggerInstance.hasEffects(MobEffectsPredicate.effects().and(OEffects.STUNNING.get()))) + .save(consumer, "oreganized:story/like_the_romans"); + + Advancement.Builder.advancement() + .parent(likeTheRomans) + .display(info(OItems.MOLTEN_LEAD_BUCKET.get(), "profound_brain_damage", FrameType.TASK, + "Profound Brain Damage", "Let your health reach half a heart while having the Brain Damage effect")) + .addCriterion("stunned", EffectsChangedTrigger.TriggerInstance.hasEffects(MobEffectsPredicate.effects() + .and(OEffects.STUNNING.get(), new MobEffectsPredicate.MobEffectInstancePredicate(MinMaxBounds.Ints.atMost(StunningEffect.MAX_AMPLIFIER / 2), MinMaxBounds.Ints.ANY, null, null)))) + .save(consumer, "oreganized:story/profound_brain_damage"); + + var obtainSilver = Advancement.Builder.advancement() .parent(getAdv("minecraft:story/iron_tools")) - .display( - OItems.SILVER_INGOT.get(), - Component.translatable("advancements.story.obtain_silver.title"), - Component.translatable("advancements.story.obtain_silver.description"), - null, - FrameType.TASK, - true, - true, - false - ) + .display(info(OItems.SILVER_INGOT.get(), "obtain_silver", FrameType.TASK, + "Every Stone has a Silver Lining", "Smelt Raw Silver")) .addCriterion("has_silver_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(ItemPredicate.Builder.item().of(OTags.Items.INGOTS_SILVER).build())) .save(consumer, "oreganized:story/obtain_silver"); - Advancement electrum_gear = Advancement.Builder.advancement() - .parent(obtain_silver) - .display( - OItems.ELECTRUM_CHESTPLATE.get(), - Component.translatable("advancements.story.electrum_gear.title"), - Component.translatable("advancements.story.electrum_gear.description"), - null, - FrameType.CHALLENGE, - true, - true, - false - ) + Advancement.Builder.advancement() + .parent(obtainSilver) + .display(info(OItems.ELECTRUM_CHESTPLATE.get(), "electrum_gear", FrameType.CHALLENGE, + "Cover me in... Wings?", "Obtain a full set of electrum armor")) .addCriterion("has_all_electrum_armor", InventoryChangeTrigger.TriggerInstance.hasItems( - OItems.ELECTRUM_HELMET.get(), OItems.ELECTRUM_CHESTPLATE.get(), OItems.ELECTRUM_LEGGINGS.get(), OItems.ELECTRUM_BOOTS.get() + OItems.ELECTRUM_HELMET.get(), OItems.ELECTRUM_CHESTPLATE.get(), OItems.ELECTRUM_LEGGINGS.get(), OItems.ELECTRUM_BOOTS.get() )) .save(consumer, "oreganized:story/electrum_gear"); - Advancement melting_point = Advancement.Builder.advancement() + var meltingPoint = Advancement.Builder.advancement() .parent(getAdv("minecraft:story/upgrade_tools")) - .display( - OItems.MOLTEN_LEAD_BUCKET.get(), - Component.translatable("advancements.story.melting_point.title"), - Component.translatable("advancements.story.melting_point.description"), - null, - FrameType.TASK, - true, - true, - false - ) + .display(info(OItems.MOLTEN_LEAD_BUCKET.get(), "melting_point", FrameType.TASK, + "Melting Point", "Pick up Molten Lead from a cauldron")) .addCriterion("has_molten_lead_bucket", InventoryChangeTrigger.TriggerInstance.hasItems(OItems.MOLTEN_LEAD_BUCKET.get())) //.addCriterion("item_used_on_cauldron", ItemInteractWithBlockTrigger.TriggerInstance.itemUsedOnBlock())) .save(consumer, "oreganized:story/melting_point"); - Advancement disc_smith = Advancement.Builder.advancement() - .parent(melting_point) - .display( - OItems.MUSIC_DISC_STRUCTURE.get(), - Component.translatable("advancements.story.disc_smith.title"), - Component.translatable("advancements.story.disc_smith.description"), - null, - FrameType.TASK, - true, - true, - false - ) + Advancement.Builder.advancement() + .parent(meltingPoint) + .display(info(OItems.MUSIC_DISC_STRUCTURE.get(), "disc_smith", FrameType.TASK, + "Disc Smith", "Submerge a broken music disc into molten lead")) //.addCriterion("use_disc_on_lead_cauldron", ItemInteractWithBlockTrigger.TriggerInstance.itemUsedOnBlock(new LocationPredicate.Builder().setBlock(new BlockPredicate(null, Set.of(OBlocks.MOLTEN_LEAD_CAULDRON.get()), StatePropertiesPredicate.ANY, NbtPredicate.ANY)), ItemPredicate.Builder.item().of(Items.MUSIC_DISC_11))) .addCriterion("has_structure_disc", InventoryChangeTrigger.TriggerInstance.hasItems(OItems.MUSIC_DISC_STRUCTURE.get())) .save(consumer, "oreganized:story/disc_smith"); + + var weepingDevil = Advancement.Builder.advancement() + .parent(getAdv("minecraft:adventure/root")) + .display(info(OBlocks.GARGOYLE.get(), "weeping_devil", FrameType.TASK, + "Weeping Devil", "Exchange a Silver Ingot for a hellish growl of the Gargoyle")) + .addCriterion("activated_gargoyle", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( + LocationPredicate.Builder.location() + .setBlock(BlockPredicate.Builder.block().of(OBlocks.GARGOYLE.get()).build()), + ItemPredicate.Builder.item().of(OTags.Items.INGOTS_SILVER) + )) + .save(consumer, "oreganized:adventure/weeping_devil"); + + Advancement.Builder.advancement() + .parent(weepingDevil) + .display(info(Items.WATER_BUCKET, "garglin_water", FrameType.TASK, + "Garglin' Water", "Provide Gargoyle with a source of water to spew even without rain")) + .addCriterion("see_gargoyle_gargle", OCriteriaTriggers.SEE_GARGOYLE_GARGLE.instance()) + .save(consumer, "oreganized:adventure/garglin_water"); + + Advancement.Builder.advancement() + .parent(getAdv("adventure/whos_the_pillager_now")) + .display(info(new ItemStack(Items.CROSSBOW), "demoted", FrameType.CHALLENGE, + "Demoted", "Use lead bolts in a crossbow to strip a pillager of his Ominous Banner")) + .addCriterion("see_gargoyle_gargle", OCriteriaTriggers.KNOCKED_BANNER_OFF.instance()) + .save(consumer, "oreganized:adventure/demoted"); + + Advancement.Builder.advancement() + .parent(getAdv("husbandry/root")) + .display(info(OBlocks.GROOVED_ICE.get(), "groovy", FrameType.TASK, + "Groovy", "Use the scribe to make grooves on Ice!")) + .addCriterion("use_scribe_on_ice", ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( + LocationPredicate.Builder.location() + .setBlock(BlockPredicate.Builder.block() + .of(BlockTags.ICE) + .build()), + ItemPredicate.Builder.item().of(OItems.SCRIBE.get()) + )) + .save(consumer, "oreganized:husbandry/groovy"); } protected Advancement getAdv(String loc) { return Advancement.Builder.advancement().build(new ResourceLocation(loc)); } + + protected DisplayInfo info(ItemLike icon, String id, FrameType type, String title, String description) { + return info(new ItemStack(icon), id, type, title, description); + } + + protected DisplayInfo info(ItemStack icon, String id, FrameType type, String title, String description) { + var advancementId = Oreganized.MOD_ID + "." + id; + lang.addAdvTitle(advancementId, title); + lang.addAdvDesc(advancementId, description); + return new DisplayInfo( + icon, + Component.translatable("advancements.%s.title".formatted(advancementId)), + Component.translatable("advancements.%s.description".formatted(advancementId)), + null, + type, + true, + true, + false + ); + } } + } diff --git a/src/main/java/galena/oreganized/data/OLang.java b/src/main/java/galena/oreganized/data/OLang.java index f0935e6d..6bdde7c4 100644 --- a/src/main/java/galena/oreganized/data/OLang.java +++ b/src/main/java/galena/oreganized/data/OLang.java @@ -1,5 +1,6 @@ package galena.oreganized.data; +import com.google.common.collect.Lists; import galena.oreganized.Oreganized; import galena.oreganized.data.provider.OLangProvider; import galena.oreganized.index.OBlocks; @@ -14,6 +15,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; +import java.util.List; import java.util.function.Supplier; public class OLang extends OLangProvider { @@ -21,6 +23,7 @@ public class OLang extends OLangProvider { public OLang(PackOutput output) { super(output, Oreganized.MOD_ID, "en_us"); } + @Override protected void addTranslations() { addDisc(OItems.MUSIC_DISC_STRUCTURE, "Firch", "structure"); @@ -41,19 +44,6 @@ protected void addTranslations() { addEffect(OEffects.STUNNING, "Brain Damage"); addPotion(OPotions.STUNNING, "Brain Damage"); - addAdvTitle("adventure.mirror_mirror", "Mirror, Mirror who is the fairest?"); - addAdvDesc("adventure.mirror_mirror", "Obtain a Silver Mirror"); - addAdvTitle("story.melting_point", "Melting Point"); - addAdvDesc("story.melting_point", "Pick up Molten Lead from a cauldron"); - addAdvTitle("story.obtain_silver", "Every Stone has a Silver Lining"); - addAdvDesc("story.obtain_silver", "Smelt Raw Silver"); - addAdvTitle("story.electrum_gear", "Cover me in... Wings?"); - addAdvDesc("story.electrum_gear", "Obtain a full set of electrum armor"); - addAdvTitle("story.eat_with_lead", "Like the Romans"); - addAdvDesc("story.eat_with_lead", "Eat anything with lead in your hotbar"); - addAdvTitle("story.disc_smith", "Disc Smith"); - addAdvDesc("story.disc_smith", "Submerge a broken music disc into molten lead"); - add("trim_material.oreganized.lead", "Lead material"); add("trim_material.oreganized.silver", "Silver material"); add("trim_material.oreganized.electrum", "Electrum material"); diff --git a/src/main/java/galena/oreganized/data/provider/OLangProvider.java b/src/main/java/galena/oreganized/data/provider/OLangProvider.java index 64c041a5..8979a40d 100644 --- a/src/main/java/galena/oreganized/data/provider/OLangProvider.java +++ b/src/main/java/galena/oreganized/data/provider/OLangProvider.java @@ -1,12 +1,9 @@ package galena.oreganized.data.provider; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import com.google.common.collect.Lists; import com.google.gson.JsonObject; import net.minecraft.Util; -import net.minecraft.core.Registry; import net.minecraft.data.CachedOutput; -import net.minecraft.data.DataGenerator; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; import net.minecraft.world.effect.MobEffect; @@ -18,11 +15,10 @@ import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; -import net.minecraftforge.common.data.LanguageProvider; import net.minecraftforge.registries.ForgeRegistries; -import java.io.IOException; import java.nio.file.Path; +import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.concurrent.CompletableFuture; @@ -34,16 +30,23 @@ public abstract class OLangProvider implements DataProvider { private final String modid; private final String locale; + private final List subProviders = Lists.newArrayList(); + public OLangProvider(PackOutput output, String modid, String locale) { this.output = output; this.modid = modid; this.locale = locale; } + public void addSubProvider(Runnable runnable) { + this.subProviders.add(runnable); + } + protected abstract void addTranslations(); @Override public CompletableFuture run(CachedOutput cache) { + this.subProviders.forEach(Runnable::run); addTranslations(); if (!data.isEmpty()) return save(cache, this.output.getOutputFolder(PackOutput.Target.RESOURCE_PACK).resolve(this.modid).resolve("lang").resolve(this.locale + ".json")); @@ -97,11 +100,11 @@ public void addDisc(Supplier disc, String artist, String s } public void addAdvTitle(String advancementTitle, String name) { - add("advancements." + advancementTitle + ".title", name); + data.putIfAbsent("advancements." + advancementTitle + ".title", name); } public void addAdvDesc(String advancementTitle, String name) { - add("advancements." + advancementTitle + ".description", name); + data.putIfAbsent("advancements." + advancementTitle + ".description", name); } public void addSubtitle(String category, String subtitleName, String name) { diff --git a/src/main/java/galena/oreganized/index/OCriteriaTriggers.java b/src/main/java/galena/oreganized/index/OCriteriaTriggers.java new file mode 100644 index 00000000..55c365a8 --- /dev/null +++ b/src/main/java/galena/oreganized/index/OCriteriaTriggers.java @@ -0,0 +1,14 @@ +package galena.oreganized.index; + +import galena.oreganized.Oreganized; +import galena.oreganized.content.critera.DummyCriterionTrigger; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraftforge.fml.common.Mod; + +@Mod.EventBusSubscriber(modid = Oreganized.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +public class OCriteriaTriggers { + + public static final DummyCriterionTrigger SEE_GARGOYLE_GARGLE = CriteriaTriggers.register(new DummyCriterionTrigger(Oreganized.modLoc("see_gargoyle_gargle"))); + public static final DummyCriterionTrigger KNOCKED_BANNER_OFF = CriteriaTriggers.register(new DummyCriterionTrigger(Oreganized.modLoc("knocked_banner_off"))); + +} diff --git a/src/main/java/galena/oreganized/mixin/compat/LogStrippingFakeRecipesMixin.java b/src/main/java/galena/oreganized/mixin/compat/LogStrippingFakeRecipesMixin.java new file mode 100644 index 00000000..c0ff771b --- /dev/null +++ b/src/main/java/galena/oreganized/mixin/compat/LogStrippingFakeRecipesMixin.java @@ -0,0 +1,42 @@ +package galena.oreganized.mixin.compat; + +import com.simibubi.create.content.kinetics.deployer.ManualApplicationRecipe; +import com.simibubi.create.content.processing.recipe.ProcessingOutput; +import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder; +import com.simibubi.create.foundation.data.recipe.LogStrippingFakeRecipes; +import galena.oreganized.Oreganized; +import galena.oreganized.content.item.ScribeItem; +import galena.oreganized.index.OItems; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.ArrayList; +import java.util.List; + +@Mixin(value = LogStrippingFakeRecipes.class, remap = false) +public class LogStrippingFakeRecipesMixin { + + @Inject(method = "createRecipes", at = @At("RETURN"), require = 0, cancellable = true) + private static void addGroovedRecipes(CallbackInfoReturnable> cir) { + var newList = new ArrayList<>(cir.getReturnValue()); + + ScribeItem.getGroovedBlocks().forEach(entry -> { + var blockId = BuiltInRegistries.BLOCK.getKey(entry.getKey()).getPath(); + newList.add( + new ProcessingRecipeBuilder<>(ManualApplicationRecipe::new, Oreganized.modLoc("manual_application/" + blockId)) + .withItemIngredients(Ingredient.of(entry.getKey()), Ingredient.of(OItems.SCRIBE.get())) + .withItemOutputs(new ProcessingOutput(new ItemStack(entry.getValue().get()), 1F)) + .toolNotConsumed() + .build() + ); + }); + + cir.setReturnValue(newList); + } + +} diff --git a/src/main/resources/assets/oreganized/textures/item/electrum_pickaxe.png b/src/main/resources/assets/oreganized/textures/item/electrum_pickaxe.png index 5abff4801edea8b4623e9ab87eda2b8ed40d3af3..dbaaf49bc8174096387d74b63bf5cd48f09ad088 100644 GIT binary patch delta 213 zcmeBV>SLPVSg#V`6XH5K&FJ6XZ{OdoI}-*PZ|SmTeI!J@z-@h1wJoyFY%NOKzM!H^)1dVfj^tfc_oSUVWSg#o16XH5K&FJ6XZ{OdoI4nJ@ErnSMo|r~2B2V+r;B5VMsR6wG~WRQ4i?8i z&F}UF;tRh_EV1jc*7o@J&|lz0^c>GKYbSGDddix)VM@W0{^>I+iu)Dxk4kGA@_$_@ ybk8}#v*WJw7Lkk1e^h@nEc(UUVppuEd&VziK1Y{xZcPEu8U{~SKbLh*2~7YQty3ES diff --git a/src/main/resources/assets/oreganized/textures/item/electrum_shovel.png b/src/main/resources/assets/oreganized/textures/item/electrum_shovel.png index 19363dcb33719566defc5fc5ea9521dc363d134b..10b64b08b29d5a068c779e7e3e81160710f323c7 100644 GIT binary patch delta 149 zcmV;G0BZk*0*eBWUJz(b9w;6QiDxGO002)mym66kBYMFA01m+cxRGn^00013NklIU$$*Q=1{75*8=%IMz+t9Z6Erd7 zUeN9?$~~by-Tm7G_#QV4i1!fzsCx&*XETDx0Xg><%EJjQK2g)A00000NkvXXu0mjf DMW;H1 delta 143 zcmV;A0C4|{0)+yQUJ!|ACnz2ZXigpg003#**)Nf9BXq(501m<&EnjGz?W0!4npxzdh66{U~F#amFH;1K>7<&oeaASys|G)OH-o;Nr;fm1Y) sYh#G^cH>zAwEJA_VwY!p{T5~){RRh;`3)GE00000NkvXXt^-0~f+f^A0{{R3 delta 139 zcmV;60CfM40+0fbjeo)b01mMZ{{e z!I>u?*d2KC89^z$1&aKHbEO@DDoQVjn?FHq!BdblN|WFaqP{*kT1YKOUNij9<`CVd t?2ak=GmNJN(BaiLt(@^0%qvdJUIL8=n(x_d0RR9107*qoL