generated from TropheusJ/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
177 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/io/github/tropheusj/its_as_shrimple_as_that/criteria/KrillSelfTrigger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.github.tropheusj.its_as_shrimple_as_that.criteria; | ||
|
||
import java.util.Optional; | ||
|
||
import com.mojang.serialization.Codec; | ||
|
||
import io.github.tropheusj.its_as_shrimple_as_that.criteria.KrillSelfTrigger.TriggerInstance; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import net.minecraft.advancements.critereon.ContextAwarePredicate; | ||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger; | ||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public class KrillSelfTrigger extends SimpleCriterionTrigger<TriggerInstance> { | ||
public void trigger(ServerPlayer player) { | ||
this.trigger(player, instance -> true); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public Codec<TriggerInstance> codec() { | ||
return TriggerInstance.CODEC; | ||
} | ||
|
||
public record TriggerInstance() implements SimpleInstance { | ||
public static final Codec<TriggerInstance> CODEC = Codec.unit(new TriggerInstance()); | ||
|
||
@Override | ||
@NotNull | ||
public Optional<ContextAwarePredicate> player() { | ||
return Optional.empty(); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...a/io/github/tropheusj/its_as_shrimple_as_that/criteria/ShrimpAccomplishDreamsTrigger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.github.tropheusj.its_as_shrimple_as_that.criteria; | ||
|
||
import java.util.Optional; | ||
|
||
import com.mojang.serialization.Codec; | ||
|
||
import io.github.tropheusj.its_as_shrimple_as_that.criteria.ShrimpAccomplishDreamsTrigger.TriggerInstance; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import net.minecraft.advancements.critereon.ContextAwarePredicate; | ||
import net.minecraft.advancements.critereon.SimpleCriterionTrigger; | ||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public class ShrimpAccomplishDreamsTrigger extends SimpleCriterionTrigger<TriggerInstance> { | ||
public void trigger(ServerPlayer player) { | ||
this.trigger(player, instance -> true); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public Codec<TriggerInstance> codec() { | ||
return TriggerInstance.CODEC; | ||
} | ||
|
||
public record TriggerInstance() implements SimpleCriterionTrigger.SimpleInstance { | ||
public static final Codec<TriggerInstance> CODEC = Codec.unit(new TriggerInstance()); | ||
|
||
@Override | ||
@NotNull | ||
public Optional<ContextAwarePredicate> player() { | ||
return Optional.empty(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/io/github/tropheusj/its_as_shrimple_as_that/mixin/AdvancementWidgetMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.tropheusj.its_as_shrimple_as_that.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import net.minecraft.client.gui.Font; | ||
import net.minecraft.client.gui.screens.advancements.AdvancementWidget; | ||
import net.minecraft.network.chat.FormattedText; | ||
|
||
@Mixin(AdvancementWidget.class) | ||
public class AdvancementWidgetMixin { | ||
@WrapOperation( | ||
method = "<init>", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/client/gui/Font;substrByWidth(Lnet/minecraft/network/chat/FormattedText;I)Lnet/minecraft/network/chat/FormattedText;" | ||
) | ||
) | ||
private FormattedText extend(Font instance, FormattedText text, int width, Operation<FormattedText> original) { | ||
// don't shorten at all | ||
return text; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/resources/data/its_as_shrimple_as_that/advancements/its_as_shrimple_as_that.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/resources/data/its_as_shrimple_as_that/advancements/krill_yourself.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"parent": "its_as_shrimple_as_that:one_in_a_krillion", | ||
"display": { | ||
"icon": { | ||
"id": "its_as_shrimple_as_that:shrimp_spawn_egg" | ||
}, | ||
"title": "Krill Yourself", | ||
"description": "You make not like it, but this is what peak performance looks like.", | ||
"frame": "task", | ||
"show_toast": true, | ||
"announce_to_chat": true, | ||
"hidden": true | ||
}, | ||
"criteria": { | ||
"krill_self": { | ||
"trigger": "its_as_shrimple_as_that:krill_self" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"krill_self" | ||
] | ||
] | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/resources/data/its_as_shrimple_as_that/advancements/one_in_a_krillion.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"display": { | ||
"icon": { | ||
"id": "its_as_shrimple_as_that:shrimp_spawn_egg", | ||
"components": { | ||
"enchantments": { | ||
"efficiency": 1 | ||
} | ||
} | ||
}, | ||
"title": "One in a krillion", | ||
"description": "Help a shrimp to accomplish its dreams.", | ||
"background": "minecraft:textures/block/terredepomme.png", | ||
"frame": "task", | ||
"show_toast": true, | ||
"announce_to_chat": true, | ||
"hidden": false | ||
}, | ||
"criteria": { | ||
"accomplish_dreams": { | ||
"trigger": "its_as_shrimple_as_that:accomplish_dreams" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"accomplish_dreams" | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters