start work on making sounds badnt
This commit is contained in:
parent
979fc3aa35
commit
7699a5e468
43 changed files with 277 additions and 222 deletions
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.api.addldata;
|
||||
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
|
@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.spell.iota.Iota;
|
|||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.client.ClientTickCounter;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package at.petrak.hexcasting.api.spell
|
||||
|
||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||
import at.petrak.hexcasting.api.spell.casting.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.api.spell
|
||||
|
||||
import at.petrak.hexcasting.api.spell.casting.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package at.petrak.hexcasting.api.spell
|
||||
|
||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||
import at.petrak.hexcasting.api.spell.casting.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import at.petrak.hexcasting.api.mod.HexStatistics
|
|||
import at.petrak.hexcasting.api.spell.Action
|
||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||
import at.petrak.hexcasting.api.spell.SpellList
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||
import at.petrak.hexcasting.api.spell.iota.ListIota
|
||||
import at.petrak.hexcasting.api.spell.iota.PatternIota
|
||||
|
@ -19,7 +20,7 @@ import at.petrak.hexcasting.api.spell.math.HexDir
|
|||
import at.petrak.hexcasting.api.spell.math.HexPattern
|
||||
import at.petrak.hexcasting.api.spell.mishaps.*
|
||||
import at.petrak.hexcasting.api.utils.*
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
|
||||
import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
|
@ -382,6 +383,7 @@ class CastingHarness private constructor(
|
|||
escapeNext = true,
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
}
|
||||
|
||||
SpecialPatterns.INTROSPECTION.anglesSignature() -> {
|
||||
// we have escaped the parens onto the stack; we just also record our count.
|
||||
val newParens = this.parenthesized.toMutableList()
|
||||
|
@ -391,6 +393,7 @@ class CastingHarness private constructor(
|
|||
parenCount = this.parenCount + 1
|
||||
) to if (this.parenCount == 0) ResolvedPatternType.EVALUATED else ResolvedPatternType.ESCAPED
|
||||
}
|
||||
|
||||
SpecialPatterns.RETROSPECTION.anglesSignature() -> {
|
||||
val newParenCount = this.parenCount - 1
|
||||
displayDepth--
|
||||
|
@ -415,6 +418,7 @@ class CastingHarness private constructor(
|
|||
) to ResolvedPatternType.ESCAPED
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
val newParens = this.parenthesized.toMutableList()
|
||||
newParens.add(iota)
|
||||
|
@ -438,14 +442,17 @@ class CastingHarness private constructor(
|
|||
escapeNext = true
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
}
|
||||
|
||||
SpecialPatterns.INTROSPECTION.anglesSignature() -> {
|
||||
this.getFunctionalData().copy(
|
||||
parenCount = this.parenCount + 1
|
||||
) to ResolvedPatternType.EVALUATED
|
||||
}
|
||||
|
||||
SpecialPatterns.RETROSPECTION.anglesSignature() -> {
|
||||
throw MishapTooManyCloseParens()
|
||||
}
|
||||
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import at.petrak.hexcasting.api.utils.NBTBuilder
|
|||
import at.petrak.hexcasting.api.utils.getList
|
||||
import at.petrak.hexcasting.api.utils.hasList
|
||||
import at.petrak.hexcasting.api.utils.serializeToNBT
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.nbt.Tag
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
|
@ -194,6 +194,7 @@ sealed interface ContinuationFrame {
|
|||
world
|
||||
)!!.list
|
||||
)
|
||||
|
||||
"end" -> FinishEval
|
||||
"foreach" -> ForEach(
|
||||
HexIotaTypes.LIST.deserialize(tag.getList("data", Tag.TAG_COMPOUND), world)!!.list,
|
||||
|
@ -207,6 +208,7 @@ sealed interface ContinuationFrame {
|
|||
world
|
||||
)!!.list.toMutableList()
|
||||
)
|
||||
|
||||
else -> Evaluate(SpellList.LList(0, listOf()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package at.petrak.hexcasting.api.spell.casting
|
||||
|
||||
import at.petrak.hexcasting.common.lib.HexSounds
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
|
||||
/**
|
||||
* Sound that plays as a side-effect-adjacent when casting
|
||||
*/
|
||||
enum class EvalSound {
|
||||
/** Silence */
|
||||
NONE,
|
||||
|
||||
/** The generic "bvwonh" sound for non-spell ops */
|
||||
GENERIC,
|
||||
|
||||
/** The "bwoink!" for spell ops */
|
||||
SPELL_BOINK,
|
||||
|
||||
/** The "gvwoh" for mishaps */
|
||||
MISHAP;
|
||||
|
||||
/**
|
||||
* Which sound type has the greater priority?
|
||||
*/
|
||||
fun greaterOf(that: EvalSound): EvalSound =
|
||||
EvalSound.values()[maxOf(this.ordinal, that.ordinal)]
|
||||
|
||||
fun soundEvent(): SoundEvent? = when (this) {
|
||||
NONE -> null
|
||||
GENERIC -> HexSounds.ADD_PATTERN
|
||||
SPELL_BOINK -> HexSounds.ACTUALLY_CAST
|
||||
MISHAP -> HexSounds.FAIL_PATTERN
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package at.petrak.hexcasting.api.spell.casting.sideeffects;
|
||||
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* The kind of sound that plays after a cast.
|
||||
*
|
||||
* @param sound the actual sound file
|
||||
* @param priority the priority of this sound. the sound with the highest priority in a given cast will be
|
||||
* playd.
|
||||
* shortcutMetacasting takes precedence over this.
|
||||
*/
|
||||
public record EvalSound(@Nullable SoundEvent sound, int priority) {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package at.petrak.hexcasting.api.spell.casting
|
||||
package at.petrak.hexcasting.api.spell.casting.sideeffects
|
||||
|
||||
import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers
|
||||
import at.petrak.hexcasting.api.block.circle.BlockEntityAbstractImpetus
|
||||
|
@ -6,6 +6,7 @@ import at.petrak.hexcasting.api.misc.FrozenColorizer
|
|||
import at.petrak.hexcasting.api.mod.HexStatistics
|
||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||
import at.petrak.hexcasting.api.spell.RenderedSpell
|
||||
import at.petrak.hexcasting.api.spell.casting.CastingHarness
|
||||
import at.petrak.hexcasting.api.spell.mishaps.Mishap
|
||||
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
||||
import at.petrak.hexcasting.common.lib.HexItems
|
|
@ -0,0 +1,10 @@
|
|||
package at.petrak.hexcasting.api.spell.casting.sideeffects
|
||||
|
||||
/**
|
||||
* Package for all the side effects that happen during one cast.
|
||||
*
|
||||
* This lives outside of nested evaluations so we don't get giant sound spam
|
||||
*/
|
||||
class SideEffectsTracker private constructor(private val ops: MutableList<OperatorSideEffect>, private var sound: EvalSound) {
|
||||
public constructor() : this(mutableListOf(), EvalSound.NONE)
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.ByteTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.DoubleTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.spell.iota;
|
|||
|
||||
import at.petrak.hexcasting.api.spell.SpellList;
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -117,7 +117,8 @@ public class ListIota extends Iota {
|
|||
// We aim to not break one iota between lines
|
||||
var listTag = HexUtils.downcast(tag, ListTag.TYPE);
|
||||
|
||||
var start = FormattedCharSequence.forward(listTag.isEmpty() ? "[]" : "[", Style.EMPTY.withColor(ChatFormatting.DARK_PURPLE));
|
||||
var start = FormattedCharSequence.forward(listTag.isEmpty() ? "[]" : "[",
|
||||
Style.EMPTY.withColor(ChatFormatting.DARK_PURPLE));
|
||||
var cursor = font.width(start);
|
||||
var currentLine = new ArrayList<>(List.of(start));
|
||||
var out = new ArrayList<FormattedCharSequence>();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
@ -15,7 +15,8 @@ import org.jetbrains.annotations.Nullable;
|
|||
public class NullIota extends Iota {
|
||||
private static final Object NULL_SUBSTITUTE = new Object();
|
||||
|
||||
public static final Component DISPLAY = Component.translatable("hexcasting.tooltip.null_iota").withStyle(ChatFormatting.GRAY);
|
||||
public static final Component DISPLAY =
|
||||
Component.translatable("hexcasting.tooltip.null_iota").withStyle(ChatFormatting.GRAY);
|
||||
|
||||
public NullIota() {
|
||||
// We have to pass *something* here, but there's nothing that actually needs to go there,
|
||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.spell.iota;
|
|||
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package at.petrak.hexcasting.api.spell.iota;
|
||||
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.LongArrayTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -5,7 +5,7 @@ package at.petrak.hexcasting.api.utils
|
|||
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||
import at.petrak.hexcasting.api.spell.iota.ListIota
|
||||
import at.petrak.hexcasting.api.spell.math.HexCoord
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.nbt.*
|
||||
import net.minecraft.network.chat.Component
|
||||
|
|
|
@ -18,7 +18,7 @@ import at.petrak.hexcasting.common.items.magic.ItemMediaBattery;
|
|||
import at.petrak.hexcasting.common.items.magic.ItemPackagedHex;
|
||||
import at.petrak.hexcasting.common.lib.HexBlockEntities;
|
||||
import at.petrak.hexcasting.common.lib.HexBlocks;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import at.petrak.hexcasting.xplat.IClientXplatAbstractions;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
@ -325,7 +325,8 @@ public class RegisterClientStuff {
|
|||
}
|
||||
|
||||
// Copypasta from PoweredRailBlock.class
|
||||
private static int findPoweredRailSignal(Level level, BlockPos pos, BlockState state, boolean travelPositive, int depth) {
|
||||
private static int findPoweredRailSignal(Level level, BlockPos pos, BlockState state, boolean travelPositive,
|
||||
int depth) {
|
||||
if (depth >= 8) {
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -417,7 +418,8 @@ public class RegisterClientStuff {
|
|||
} else if (shape == RailShape.NORTH_SOUTH && (otherShape == RailShape.EAST_WEST || otherShape == RailShape.ASCENDING_EAST || otherShape == RailShape.ASCENDING_WEST)) {
|
||||
return 0;
|
||||
} else if (otherState.getValue(PoweredRailBlock.POWERED)) {
|
||||
return level.hasNeighborSignal(pos) ? 8 - depth : findPoweredRailSignal(level, pos, otherState, travelPositive, depth + 1);
|
||||
return level.hasNeighborSignal(pos) ? 8 - depth : findPoweredRailSignal(level, pos, otherState,
|
||||
travelPositive, depth + 1);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import at.petrak.hexcasting.api.utils.gold
|
|||
import at.petrak.hexcasting.client.*
|
||||
import at.petrak.hexcasting.client.ktxt.accumulatedScroll
|
||||
import at.petrak.hexcasting.client.sound.GridSoundInstance
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
|
||||
import at.petrak.hexcasting.common.lib.HexSounds
|
||||
import at.petrak.hexcasting.common.network.MsgNewSpellPatternSyn
|
||||
import at.petrak.hexcasting.xplat.IClientXplatAbstractions
|
||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.blocks.akashic;
|
|||
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
|
|
@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.block.HexBlockEntity;
|
|||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.api.spell.math.HexPattern;
|
||||
import at.petrak.hexcasting.common.lib.HexBlockEntities;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
|
|
@ -4,8 +4,8 @@ import at.petrak.hexcasting.api.spell.Action
|
|||
import at.petrak.hexcasting.api.spell.OperationResult
|
||||
import at.petrak.hexcasting.api.spell.RenderedSpell
|
||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||
import at.petrak.hexcasting.api.spell.casting.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.OperatorSideEffect
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.item.IotaHolderItem;
|
|||
import at.petrak.hexcasting.api.spell.iota.DoubleIota;
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.HexSounds;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
|
|
@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.item.IotaHolderItem;
|
|||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.api.spell.iota.NullIota;
|
||||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
|
|
@ -7,7 +7,7 @@ import at.petrak.hexcasting.api.spell.math.HexPattern;
|
|||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.client.gui.PatternTooltipComponent;
|
||||
import at.petrak.hexcasting.common.entities.EntityWallScroll;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.misc.PatternTooltip;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
|
|
@ -9,7 +9,7 @@ import at.petrak.hexcasting.api.spell.math.HexPattern;
|
|||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.client.gui.PatternTooltipComponent;
|
||||
import at.petrak.hexcasting.common.blocks.circles.BlockEntitySlate;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.misc.PatternTooltip;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -4,7 +4,7 @@ import at.petrak.hexcasting.api.item.IotaHolderItem;
|
|||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.api.spell.iota.NullIota;
|
||||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext;
|
|||
import at.petrak.hexcasting.api.spell.casting.CastingHarness;
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package at.petrak.hexcasting.common.lib.hex;
|
||||
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound;
|
||||
import at.petrak.hexcasting.common.lib.HexSounds;
|
||||
import at.petrak.hexcasting.xplat.IXplatAbstractions;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static at.petrak.hexcasting.api.HexAPI.modLoc;
|
||||
|
||||
public class HexEvalSounds {
|
||||
public static final Registry<EvalSound> REGISTRY = IXplatAbstractions.INSTANCE.getEvalSoundRegistry();
|
||||
|
||||
private static final Map<ResourceLocation, EvalSound> TYPES = new LinkedHashMap<>();
|
||||
|
||||
public static final EvalSound NOTHING = make("nothing",
|
||||
new EvalSound(null, Integer.MIN_VALUE));
|
||||
public static final EvalSound OPERATOR = make("operator",
|
||||
new EvalSound(HexSounds.ADD_PATTERN, 0));
|
||||
public static final EvalSound SPELL = make("spell",
|
||||
new EvalSound(HexSounds.ACTUALLY_CAST, 1000));
|
||||
public static final EvalSound MISHAP = make("mishap",
|
||||
new EvalSound(HexSounds.FAIL_PATTERN, Integer.MAX_VALUE));
|
||||
|
||||
private static EvalSound make(String name, EvalSound sound) {
|
||||
var old = TYPES.put(modLoc(name), sound);
|
||||
if (old != null) {
|
||||
throw new IllegalArgumentException("Typo? Duplicate id " + name);
|
||||
}
|
||||
return sound;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package at.petrak.hexcasting.common.lib;
|
||||
package at.petrak.hexcasting.common.lib.hex;
|
||||
|
||||
import at.petrak.hexcasting.api.HexAPI;
|
||||
import at.petrak.hexcasting.api.spell.iota.*;
|
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Registries and such of types Hexcasting itself defines
|
||||
*/
|
||||
package at.petrak.hexcasting.common.lib.hex;
|
|
@ -3,7 +3,7 @@ package at.petrak.hexcasting.common.network;
|
|||
import at.petrak.hexcasting.api.utils.NBTHelper;
|
||||
import at.petrak.hexcasting.common.items.ItemAbacus;
|
||||
import at.petrak.hexcasting.common.items.ItemSpellbook;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import at.petrak.hexcasting.common.lib.HexSounds;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
|
|
@ -9,6 +9,7 @@ import at.petrak.hexcasting.api.player.FlightAbility;
|
|||
import at.petrak.hexcasting.api.player.Sentinel;
|
||||
import at.petrak.hexcasting.api.spell.casting.CastingHarness;
|
||||
import at.petrak.hexcasting.api.spell.casting.ResolvedPattern;
|
||||
import at.petrak.hexcasting.api.spell.casting.sideeffects.EvalSound;
|
||||
import at.petrak.hexcasting.api.spell.iota.IotaType;
|
||||
import at.petrak.hexcasting.common.network.IMessage;
|
||||
import at.petrak.hexcasting.interop.pehkui.PehkuiInterop;
|
||||
|
@ -159,6 +160,8 @@ public interface IXplatAbstractions {
|
|||
|
||||
Registry<IotaType<?>> getIotaTypeRegistry();
|
||||
|
||||
Registry<EvalSound> getEvalSoundRegistry();
|
||||
|
||||
boolean isBreakingAllowed(Level world, BlockPos pos, BlockState state, Player player);
|
||||
|
||||
boolean isPlacingAllowed(Level world, BlockPos pos, ItemStack blockStack, Player player);
|
||||
|
|
|
@ -12,6 +12,7 @@ import at.petrak.hexcasting.common.entities.HexEntities
|
|||
import at.petrak.hexcasting.common.items.ItemJewelerHammer
|
||||
import at.petrak.hexcasting.common.items.ItemLens
|
||||
import at.petrak.hexcasting.common.lib.*
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes
|
||||
import at.petrak.hexcasting.common.loot.HexLootHandler
|
||||
import at.petrak.hexcasting.common.misc.AkashicTreeGrower
|
||||
import at.petrak.hexcasting.common.misc.Brainsweeping
|
||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.fabric.cc.adimpl;
|
|||
|
||||
import at.petrak.hexcasting.api.item.IotaHolderItem;
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.fabric.cc.HexCardinalComponents;
|
||||
import dev.onyxstudios.cca.api.v3.item.ItemComponent;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
|
|
@ -13,6 +13,7 @@ import at.petrak.hexcasting.common.entities.HexEntities;
|
|||
import at.petrak.hexcasting.common.items.ItemJewelerHammer;
|
||||
import at.petrak.hexcasting.common.items.ItemLens;
|
||||
import at.petrak.hexcasting.common.lib.*;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.loot.HexLootHandler;
|
||||
import at.petrak.hexcasting.common.misc.AkashicTreeGrower;
|
||||
import at.petrak.hexcasting.common.misc.Brainsweeping;
|
||||
|
@ -131,9 +132,12 @@ public class ForgeHexInitializer {
|
|||
HexComposting.setup();
|
||||
HexStrippables.init();
|
||||
RegisterPatterns.registerPatterns();
|
||||
// Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric and Quilt.
|
||||
// However, all launcher panic if the same resource is registered twice. But do need blocks and items to be completely initialized.
|
||||
// Explicitly calling here avoids potential confusion, or reliance on tricks that may fail under compiler optimization.
|
||||
// Forge does not strictly require TreeGrowers to initialize during early game stages, unlike Fabric
|
||||
// and Quilt.
|
||||
// However, all launcher panic if the same resource is registered twice. But do need blocks and
|
||||
// items to be completely initialized.
|
||||
// Explicitly calling here avoids potential confusion, or reliance on tricks that may fail under
|
||||
// compiler optimization.
|
||||
AkashicTreeGrower.init();
|
||||
|
||||
HexInterop.init();
|
||||
|
@ -143,7 +147,8 @@ public class ForgeHexInitializer {
|
|||
modBus.addListener((RegisterEvent evt) -> {
|
||||
if (evt.getRegistryKey().equals(Registry.ITEM_REGISTRY)) {
|
||||
CraftingHelper.register(ForgeUnsealedIngredient.ID, ForgeUnsealedIngredient.Serializer.INSTANCE);
|
||||
CraftingHelper.register(ForgeModConditionalIngredient.ID, ForgeModConditionalIngredient.Serializer.INSTANCE);
|
||||
CraftingHelper.register(ForgeModConditionalIngredient.ID,
|
||||
ForgeModConditionalIngredient.Serializer.INSTANCE);
|
||||
HexStatistics.register();
|
||||
HexLootFunctions.registerSerializers((lift, id) ->
|
||||
Registry.register(Registry.LOOT_FUNCTION_TYPE, id, lift));
|
||||
|
|
|
@ -13,7 +13,7 @@ import at.petrak.hexcasting.api.mod.HexConfig;
|
|||
import at.petrak.hexcasting.api.spell.iota.DoubleIota;
|
||||
import at.petrak.hexcasting.api.spell.iota.Iota;
|
||||
import at.petrak.hexcasting.common.entities.EntityWallScroll;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -146,11 +146,13 @@ public class ForgeCapabilityHandler {
|
|||
};
|
||||
}
|
||||
|
||||
private static <CAP> SimpleProvider<CAP> provide(Entity entity, Capability<CAP> capability, NonNullSupplier<CAP> supplier) {
|
||||
private static <CAP> SimpleProvider<CAP> provide(Entity entity, Capability<CAP> capability,
|
||||
NonNullSupplier<CAP> supplier) {
|
||||
return provide(entity::isRemoved, capability, supplier);
|
||||
}
|
||||
|
||||
private static <CAP> SimpleProvider<CAP> provide(BlockEntity be, Capability<CAP> capability, NonNullSupplier<CAP> supplier) {
|
||||
private static <CAP> SimpleProvider<CAP> provide(BlockEntity be, Capability<CAP> capability,
|
||||
NonNullSupplier<CAP> supplier) {
|
||||
return provide(be::isRemoved, capability, supplier);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingHarness;
|
|||
import at.petrak.hexcasting.api.spell.casting.ResolvedPattern;
|
||||
import at.petrak.hexcasting.api.spell.iota.IotaType;
|
||||
import at.petrak.hexcasting.api.utils.HexUtils;
|
||||
import at.petrak.hexcasting.common.lib.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.hex.HexIotaTypes;
|
||||
import at.petrak.hexcasting.common.lib.HexItems;
|
||||
import at.petrak.hexcasting.common.network.IMessage;
|
||||
import at.petrak.hexcasting.forge.cap.CapSyncers;
|
||||
|
|
Loading…
Reference in a new issue