This commit is contained in:
petrak@ 2022-11-29 13:42:31 -05:00
parent de8e84cdbd
commit 3a8dfa6cc8
6 changed files with 18 additions and 16 deletions

View file

@ -1,7 +1,7 @@
// 1.19.2 2022-11-09T19:44:43.405259 Advancements // 1.19.2 2022-11-29T13:33:14.877218824 Advancements
b21f0b7f0cda29a7e84693df8139f2fecfeea960 data/hexcasting/advancements/aaa_wasteful_cast.json b21f0b7f0cda29a7e84693df8139f2fecfeea960 data/hexcasting/advancements/aaa_wasteful_cast.json
9d8b41dd8ddfccdf2cd19433d8d7d3cf934e64db data/hexcasting/advancements/aab_big_cast.json 9d8b41dd8ddfccdf2cd19433d8d7d3cf934e64db data/hexcasting/advancements/aab_big_cast.json
ef61c93d776c6f212820af20909a4c1d92822baf data/hexcasting/advancements/enlightenment.json 425b42f6da5fd6498053f565dce1f171997dbb8b data/hexcasting/advancements/enlightenment.json
8f97205fa79270eab688aa3019d6fe7dd8c8b0d3 data/hexcasting/advancements/lore.json 8f97205fa79270eab688aa3019d6fe7dd8c8b0d3 data/hexcasting/advancements/lore.json
2f5ad49936d58c7097ac7f8fbbf3f66f9f90fd2c data/hexcasting/advancements/lore/experiment1.json 2f5ad49936d58c7097ac7f8fbbf3f66f9f90fd2c data/hexcasting/advancements/lore/experiment1.json
9a4eba1c9d7868906e8ea1b4ec287f54a2c379b5 data/hexcasting/advancements/lore/experiment2.json 9a4eba1c9d7868906e8ea1b4ec287f54a2c379b5 data/hexcasting/advancements/lore/experiment2.json
@ -11,6 +11,6 @@ ef06ae5bd79e2c52291fbfb3c69bc2f74a604477 data/hexcasting/advancements/lore/terab
74fbb1ce0e3acf982325b9e9205f774a67956c3c data/hexcasting/advancements/lore/terabithia3.json 74fbb1ce0e3acf982325b9e9205f774a67956c3c data/hexcasting/advancements/lore/terabithia3.json
861374b7c144ccdbbd031a3f5042af6718ba42bf data/hexcasting/advancements/lore/terabithia4.json 861374b7c144ccdbbd031a3f5042af6718ba42bf data/hexcasting/advancements/lore/terabithia4.json
e26db8dfa825b7ac572d59a548b610db7c7bf736 data/hexcasting/advancements/lore/terabithia5.json e26db8dfa825b7ac572d59a548b610db7c7bf736 data/hexcasting/advancements/lore/terabithia5.json
2acbfb4efe2a72a1986c8dbe62ad8d93e9613e99 data/hexcasting/advancements/opened_eyes.json bf319d71d9e706f9131c9484be1bc83ca2b8b6a3 data/hexcasting/advancements/opened_eyes.json
d19039a73324eb7532d035d08442f3b68bb13bcb data/hexcasting/advancements/root.json d19039a73324eb7532d035d08442f3b68bb13bcb data/hexcasting/advancements/root.json
b1b82068d65d6872c258d905d4f78499e8227ccf data/hexcasting/advancements/y_u_no_cast_angy.json b1b82068d65d6872c258d905d4f78499e8227ccf data/hexcasting/advancements/y_u_no_cast_angy.json

View file

@ -7,8 +7,8 @@
"min": 0.8 "min": 0.8
}, },
"mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": {
"max": 2.05, "max": 1.0,
"min": 0.1 "min": 2.2250738585072014E-308
} }
}, },
"trigger": "hexcasting:overcast" "trigger": "hexcasting:overcast"

View file

@ -4,7 +4,7 @@
"health_used": { "health_used": {
"conditions": { "conditions": {
"mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": { "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion": {
"min": 0.1 "min": 0.0
} }
}, },
"trigger": "hexcasting:overcast" "trigger": "hexcasting:overcast"

View file

@ -15,7 +15,8 @@ public class OvercastTrigger extends SimpleCriterionTrigger<OvercastTrigger.Inst
private static final String TAG_MEDIA_GENERATED = "media_generated"; private static final String TAG_MEDIA_GENERATED = "media_generated";
private static final String TAG_HEALTH_USED = "health_used"; private static final String TAG_HEALTH_USED = "health_used";
// HEY KIDS DID YOYU KNOW THERE'S NOT A CRITERIA FOR HOW MUCH ***HEALTH*** AN ENTITY HAS // HEY KIDS DID YOYU KNOW THERE'S NOT A CRITERIA FOR HOW MUCH ***HEALTH*** AN ENTITY HAS
private static final String TAG_HEALTH_LEFT = "mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion"; private static final String TAG_HEALTH_LEFT =
"mojang_i_am_begging_and_crying_please_add_an_entity_health_criterion";
@Override @Override
public ResourceLocation getId() { public ResourceLocation getId() {
@ -41,6 +42,7 @@ public class OvercastTrigger extends SimpleCriterionTrigger<OvercastTrigger.Inst
public static class Instance extends AbstractCriterionTriggerInstance { public static class Instance extends AbstractCriterionTriggerInstance {
protected final MinMaxBounds.Ints mediaGenerated; protected final MinMaxBounds.Ints mediaGenerated;
// This is the *proporttion* of the health bar.
protected final MinMaxBounds.Doubles healthUsed; protected final MinMaxBounds.Doubles healthUsed;
// DID YOU KNOW THERES ONE TO CHECK THE WORLD TIME, BUT NOT THE HEALTH!? // DID YOU KNOW THERES ONE TO CHECK THE WORLD TIME, BUT NOT THE HEALTH!?
protected final MinMaxBounds.Doubles healthLeft; protected final MinMaxBounds.Doubles healthLeft;

View file

@ -38,6 +38,7 @@ import net.minecraft.sounds.SoundSource
import net.minecraft.util.Mth import net.minecraft.util.Mth
import net.minecraft.world.level.gameevent.GameEvent import net.minecraft.world.level.gameevent.GameEvent
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
import kotlin.math.max
import kotlin.math.min import kotlin.math.min
/** /**
@ -542,7 +543,7 @@ class CastingHarness private constructor(
if (allowOvercast && costLeft > 0) { if (allowOvercast && costLeft > 0) {
// Cast from HP! // Cast from HP!
val mediaToHealth = HexConfig.common().mediaToHealthRate() val mediaToHealth = HexConfig.common().mediaToHealthRate()
val healthToRemove = costLeft.toDouble() / mediaToHealth val healthToRemove = max(costLeft.toDouble() / mediaToHealth, 0.5)
val mediaAbleToCastFromHP = this.ctx.caster.health * mediaToHealth val mediaAbleToCastFromHP = this.ctx.caster.health * mediaToHealth
val mediaToActuallyPayFor = min(mediaAbleToCastFromHP.toInt(), costLeft) val mediaToActuallyPayFor = min(mediaAbleToCastFromHP.toInt(), costLeft)

View file

@ -5,19 +5,15 @@ import at.petrak.hexcasting.api.advancements.FailToCastGreatSpellTrigger;
import at.petrak.hexcasting.api.advancements.OvercastTrigger; import at.petrak.hexcasting.api.advancements.OvercastTrigger;
import at.petrak.hexcasting.api.advancements.SpendMediaTrigger; import at.petrak.hexcasting.api.advancements.SpendMediaTrigger;
import at.petrak.hexcasting.api.misc.MediaConstants; import at.petrak.hexcasting.api.misc.MediaConstants;
import at.petrak.hexcasting.api.mod.HexItemTags;
import at.petrak.hexcasting.common.items.ItemLoreFragment; import at.petrak.hexcasting.common.items.ItemLoreFragment;
import at.petrak.hexcasting.common.lib.HexBlocks; import at.petrak.hexcasting.common.lib.HexBlocks;
import at.petrak.hexcasting.api.mod.HexItemTags;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.paucal.api.datagen.PaucalAdvancementProvider; import at.petrak.paucal.api.datagen.PaucalAdvancementProvider;
import net.minecraft.advancements.Advancement; import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.DisplayInfo; import net.minecraft.advancements.DisplayInfo;
import net.minecraft.advancements.FrameType; import net.minecraft.advancements.FrameType;
import net.minecraft.advancements.critereon.*; import net.minecraft.advancements.critereon.*;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -77,7 +73,7 @@ public class HexAdvancements extends PaucalAdvancementProvider {
MinMaxBounds.Ints.ANY, MinMaxBounds.Ints.ANY,
MinMaxBounds.Doubles.ANY, MinMaxBounds.Doubles.ANY,
// you can't just kill yourself // you can't just kill yourself
MinMaxBounds.Doubles.atLeast(0.1))) MinMaxBounds.Doubles.atLeast(0.0)))
.save(consumer, prefix("opened_eyes")); .save(consumer, prefix("opened_eyes"));
Advancement.Builder.advancement() Advancement.Builder.advancement()
@ -90,9 +86,12 @@ public class HexAdvancements extends PaucalAdvancementProvider {
.addCriterion("health_used", .addCriterion("health_used",
new OvercastTrigger.Instance(EntityPredicate.Composite.ANY, new OvercastTrigger.Instance(EntityPredicate.Composite.ANY,
MinMaxBounds.Ints.ANY, MinMaxBounds.Ints.ANY,
// add a little bit of slop here // add a little bit of slop here. use 80% or more health ...
MinMaxBounds.Doubles.atLeast(0.8), MinMaxBounds.Doubles.atLeast(0.8),
MinMaxBounds.Doubles.between(0.1, 2.05))) // and be left with under 1 healthpoint (half a heart)
// TODO this means if 80% of your health is less than half a heart, so if you have 2.5 hearts or
// less, you can't become enlightened.
MinMaxBounds.Doubles.between(Double.MIN_NORMAL, 1.0)))
.save(consumer, prefix("enlightenment")); .save(consumer, prefix("enlightenment"));
var loreRoot = Advancement.Builder.advancement() var loreRoot = Advancement.Builder.advancement()