it compiles!

This commit is contained in:
gamma-delta 2022-11-03 18:29:48 +01:00
parent e3c5321426
commit 7c65777e22
67 changed files with 604 additions and 918 deletions

View file

@ -158,7 +158,7 @@ public class PatternRegistry {
* In the base mod, this is used for number patterns and Bookkeeper's Gambit. * In the base mod, this is used for number patterns and Bookkeeper's Gambit.
*/ */
@FunctionalInterface @FunctionalInterface
interface SpecialHandler { public interface SpecialHandler {
@Nullable Action handlePattern(HexPattern pattern); @Nullable Action handlePattern(HexPattern pattern);
} }

View file

@ -4,6 +4,7 @@ import at.petrak.hexcasting.api.spell.math.HexPattern;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -17,7 +18,6 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Random;
// Facing dir is the direction it starts searching for slates in to start // Facing dir is the direction it starts searching for slates in to start
public abstract class BlockAbstractImpetus extends BlockCircleComponent implements EntityBlock { public abstract class BlockAbstractImpetus extends BlockCircleComponent implements EntityBlock {
@ -56,7 +56,7 @@ public abstract class BlockAbstractImpetus extends BlockCircleComponent implemen
} }
@Override @Override
public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, Random pRandom) { public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) {
if (pLevel.getBlockEntity(pPos) instanceof BlockEntityAbstractImpetus tile && pState.getValue(ENERGIZED)) { if (pLevel.getBlockEntity(pPos) instanceof BlockEntityAbstractImpetus tile && pState.getValue(ENERGIZED)) {
tile.stepCircle(); tile.stepCircle();
} }

View file

@ -24,7 +24,6 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
@ -122,7 +121,7 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen
lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), ItemCreativeUnlocker.infiniteMedia(world))); lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), ItemCreativeUnlocker.infiniteMedia(world)));
} else { } else {
var dustCount = (float) beai.getMana() / (float) ManaConstants.DUST_UNIT; var dustCount = (float) beai.getMana() / (float) ManaConstants.DUST_UNIT;
var dustCmp = new TranslatableComponent("hexcasting.tooltip.lens.impetus.mana", var dustCmp = Component.translatable("hexcasting.tooltip.lens.impetus.mana",
String.format("%.2f", dustCount)); String.format("%.2f", dustCount));
lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), dustCmp)); lines.add(new Pair<>(new ItemStack(HexItems.AMETHYST_DUST), dustCmp));
} }
@ -547,8 +546,9 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen
} }
public int extractManaFromItem(ItemStack stack, boolean simulate) { public int extractManaFromItem(ItemStack stack, boolean simulate) {
if (this.mana < 0) if (this.mana < 0) {
return 0; return 0;
}
return ManaHelper.extractMana(stack, remainingManaCapacity(), true, simulate); return ManaHelper.extractMana(stack, remainingManaCapacity(), true, simulate);
} }
@ -571,8 +571,9 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen
} }
public int remainingManaCapacity() { public int remainingManaCapacity() {
if (this.mana < 0) if (this.mana < 0) {
return 0; return 0;
}
return MAX_CAPACITY - this.mana; return MAX_CAPACITY - this.mana;
} }
} }

View file

@ -8,8 +8,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
@ -32,7 +30,8 @@ public interface IotaHolderItem {
*/ */
String TAG_OVERRIDE_VISUALLY = "VisualOverride"; String TAG_OVERRIDE_VISUALLY = "VisualOverride";
@Nullable CompoundTag readIotaTag(ItemStack stack); @Nullable
CompoundTag readIotaTag(ItemStack stack);
@Nullable @Nullable
default Iota readIota(ItemStack stack, ServerLevel world) { default Iota readIota(ItemStack stack, ServerLevel world) {
@ -72,14 +71,14 @@ public interface IotaHolderItem {
var datumTag = self.readIotaTag(stack); var datumTag = self.readIotaTag(stack);
if (datumTag != null) { if (datumTag != null) {
var cmp = HexIotaTypes.getDisplay(datumTag); var cmp = HexIotaTypes.getDisplay(datumTag);
components.add(new TranslatableComponent("hexcasting.spelldata.onitem", cmp)); components.add(Component.translatable("hexcasting.spelldata.onitem", cmp));
if (flag.isAdvanced()) { if (flag.isAdvanced()) {
components.add(new TextComponent("").append(NbtUtils.toPrettyComponent(datumTag))); components.add(Component.literal("").append(NbtUtils.toPrettyComponent(datumTag)));
} }
} else if (NBTHelper.hasString(stack, IotaHolderItem.TAG_OVERRIDE_VISUALLY)) { } else if (NBTHelper.hasString(stack, IotaHolderItem.TAG_OVERRIDE_VISUALLY)) {
components.add(new TranslatableComponent("hexcasting.spelldata.onitem", components.add(Component.translatable("hexcasting.spelldata.onitem",
new TranslatableComponent("hexcasting.spelldata.anything").withStyle(ChatFormatting.LIGHT_PURPLE))); Component.translatable("hexcasting.spelldata.anything").withStyle(ChatFormatting.LIGHT_PURPLE)));
} }
} }
} }

View file

@ -24,10 +24,7 @@ sealed class OperatorSideEffect {
data class RequiredEnlightenment(val awardStat: Boolean) : OperatorSideEffect() { data class RequiredEnlightenment(val awardStat: Boolean) : OperatorSideEffect() {
override fun performEffect(harness: CastingHarness): Boolean { override fun performEffect(harness: CastingHarness): Boolean {
harness.ctx.caster.sendMessage( harness.ctx.caster.sendSystemMessage("hexcasting.message.cant_great_spell".asTranslatedComponent)
"hexcasting.message.cant_great_spell".asTranslatedComponent,
Util.NIL_UUID
)
if (awardStat) if (awardStat)
HexAdvancementTriggers.FAIL_GREAT_SPELL_TRIGGER.trigger(harness.ctx.caster) HexAdvancementTriggers.FAIL_GREAT_SPELL_TRIGGER.trigger(harness.ctx.caster)
@ -37,7 +34,11 @@ sealed class OperatorSideEffect {
} }
/** Try to cast a spell */ /** Try to cast a spell */
data class AttemptSpell(val spell: RenderedSpell, val hasCastingSound: Boolean = true, val awardStat: Boolean = true) : data class AttemptSpell(
val spell: RenderedSpell,
val hasCastingSound: Boolean = true,
val awardStat: Boolean = true
) :
OperatorSideEffect() { OperatorSideEffect() {
override fun performEffect(harness: CastingHarness): Boolean { override fun performEffect(harness: CastingHarness): Boolean {
this.spell.cast(harness.ctx) this.spell.cast(harness.ctx)
@ -52,10 +53,7 @@ sealed class OperatorSideEffect {
val overcastOk = harness.ctx.canOvercast val overcastOk = harness.ctx.canOvercast
val leftoverMana = harness.withdrawMana(this.amount, overcastOk) val leftoverMana = harness.withdrawMana(this.amount, overcastOk)
if (leftoverMana > 0 && !overcastOk) { if (leftoverMana > 0 && !overcastOk) {
harness.ctx.caster.sendMessage( harness.ctx.caster.sendSystemMessage("hexcasting.message.cant_overcast".asTranslatedComponent)
"hexcasting.message.cant_overcast".asTranslatedComponent,
Util.NIL_UUID
)
} }
return leftoverMana > 0 return leftoverMana > 0
} }
@ -80,7 +78,7 @@ sealed class OperatorSideEffect {
} }
} else { } else {
// for now // for now
harness.ctx.caster.sendMessage(msg, Util.NIL_UUID) harness.ctx.caster.sendSystemMessage(msg)
} }
val spray = mishap.particleSpray(harness.ctx) val spray = mishap.particleSpray(harness.ctx)

View file

@ -6,7 +6,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.DoubleTag; import net.minecraft.nbt.DoubleTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -67,6 +66,6 @@ public class DoubleIota extends Iota {
} }
public static Component display(double d) { public static Component display(double d) {
return new TextComponent(String.format("%.2f", d)).withStyle(ChatFormatting.GREEN); return Component.literal(String.format("%.2f", d)).withStyle(ChatFormatting.GREEN);
} }
} }

View file

@ -7,7 +7,6 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -30,7 +29,8 @@ public class EntityIota extends Iota {
} }
@Override @Override
public @NotNull Tag serialize() { public @NotNull
Tag serialize() {
var out = new CompoundTag(); var out = new CompoundTag();
out.putUUID("uuid", this.getEntity().getUUID()); out.putUUID("uuid", this.getEntity().getUUID());
out.putString("name", Component.Serializer.toJson(this.getEntity().getName())); out.putString("name", Component.Serializer.toJson(this.getEntity().getName()));
@ -62,10 +62,10 @@ public class EntityIota extends Iota {
@Override @Override
public Component display(Tag tag) { public Component display(Tag tag) {
if (!(tag instanceof CompoundTag ctag)) { if (!(tag instanceof CompoundTag ctag)) {
return new TranslatableComponent("hexcasting.spelldata.entity.whoknows"); return Component.translatable("hexcasting.spelldata.entity.whoknows");
} }
if (!ctag.contains("name", Tag.TAG_STRING)) { if (!ctag.contains("name", Tag.TAG_STRING)) {
return new TranslatableComponent("hexcasting.spelldata.entity.whoknows"); return Component.translatable("hexcasting.spelldata.entity.whoknows");
} }
var nameJson = ctag.getString("name"); var nameJson = ctag.getString("name");
return Component.Serializer.fromJsonLenient(nameJson).withStyle(ChatFormatting.AQUA); return Component.Serializer.fromJsonLenient(nameJson).withStyle(ChatFormatting.AQUA);

View file

@ -5,7 +5,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.FastColor; import net.minecraft.util.FastColor;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -19,7 +18,7 @@ import java.util.Random;
public class GarbageIota extends Iota { public class GarbageIota extends Iota {
private static final Object NULL_SUBSTITUTE = new Object(); private static final Object NULL_SUBSTITUTE = new Object();
public static final Component DISPLAY = new TextComponent("arimfexendrapuse") public static final Component DISPLAY = Component.literal("arimfexendrapuse")
.withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.OBFUSCATED); .withStyle(ChatFormatting.DARK_GRAY, ChatFormatting.OBFUSCATED);
private static final Random RANDOM = new Random(); private static final Random RANDOM = new Random();

View file

@ -10,7 +10,6 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.FormattedCharSequence;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -98,7 +97,7 @@ public class ListIota extends Iota {
@Override @Override
public Component display(Tag tag) { public Component display(Tag tag) {
var out = new TextComponent("[").withStyle(ChatFormatting.DARK_PURPLE); var out = Component.literal("[").withStyle(ChatFormatting.DARK_PURPLE);
var list = HexUtils.downcast(tag, ListTag.TYPE); var list = HexUtils.downcast(tag, ListTag.TYPE);
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
Tag sub = list.get(i); Tag sub = list.get(i);
@ -110,7 +109,7 @@ public class ListIota extends Iota {
out.append(","); out.append(",");
} }
} }
out.append(new TextComponent("]").withStyle(ChatFormatting.DARK_PURPLE)); out.append(Component.literal("]").withStyle(ChatFormatting.DARK_PURPLE));
return out; return out;
} }

View file

@ -5,7 +5,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -16,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
public class NullIota extends Iota { public class NullIota extends Iota {
private static final Object NULL_SUBSTITUTE = new Object(); private static final Object NULL_SUBSTITUTE = new Object();
public static final Component DISPLAY = new TextComponent("NULL") public static final Component DISPLAY = Component.literal("NULL")
.withStyle(ChatFormatting.GRAY); .withStyle(ChatFormatting.GRAY);
public NullIota() { public NullIota() {

View file

@ -7,7 +7,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -68,6 +67,6 @@ public class PatternIota extends Iota {
bob.append(sig); bob.append(sig);
} }
bob.append(")"); bob.append(")");
return new TextComponent(bob.toString()).withStyle(ChatFormatting.GOLD); return Component.literal(bob.toString()).withStyle(ChatFormatting.GOLD);
} }
} }

View file

@ -6,7 +6,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.LongArrayTag; import net.minecraft.nbt.LongArrayTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -63,7 +62,7 @@ public class Vec3Iota extends Iota {
} }
public static Component display(double x, double y, double z) { public static Component display(double x, double y, double z) {
return new TextComponent(String.format("(%.2f, %.2f, %.2f)", x, y, z)) return Component.literal(String.format("(%.2f, %.2f, %.2f)", x, y, z))
.withStyle(ChatFormatting.LIGHT_PURPLE); .withStyle(ChatFormatting.LIGHT_PURPLE);
} }

View file

@ -167,10 +167,10 @@ operator fun MutableComponent.plusAssign(component: Component) {
append(component) append(component)
} }
val String.asTextComponent get() = TextComponent(this) val String.asTextComponent: MutableComponent get() = Component.literal(this)
val String.asTranslatedComponent get() = TranslatableComponent(this) val String.asTranslatedComponent: MutableComponent get() = Component.translatable(this)
fun String.asTranslatedComponent(vararg args: Any) = TranslatableComponent(this, *args) fun String.asTranslatedComponent(vararg args: Any): MutableComponent = Component.translatable(this, *args)
/** /**
* Represents a value that the garbage collector is still allowed to collect. * Represents a value that the garbage collector is still allowed to collect.

View file

@ -26,9 +26,9 @@ import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor; import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -166,11 +166,11 @@ public class RegisterClientStuff {
lines.add(new Pair<>( lines.add(new Pair<>(
new ItemStack(Items.MUSIC_DISC_CHIRP), new ItemStack(Items.MUSIC_DISC_CHIRP),
new TextComponent(String.valueOf(instrument.ordinal())) Component.literal(String.valueOf(instrument.ordinal()))
.withStyle(color(instrumentColor(instrument))))); .withStyle(color(instrumentColor(instrument)))));
lines.add(new Pair<>( lines.add(new Pair<>(
new ItemStack(Items.NOTE_BLOCK), new ItemStack(Items.NOTE_BLOCK),
new TextComponent(String.valueOf(note)) Component.literal(String.valueOf(note))
.withStyle(color(noteColor)))); .withStyle(color(noteColor))));
}); });
@ -190,22 +190,21 @@ public class RegisterClientStuff {
int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(true); int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(true);
lines.add(new Pair<>( lines.add(new Pair<>(
new ItemStack(Items.REDSTONE), new ItemStack(Items.REDSTONE),
new TextComponent(comparatorValue == -1 ? "" : String.valueOf(comparatorValue)) Component.literal(comparatorValue == -1 ? "" : String.valueOf(comparatorValue))
.withStyle(redstoneColor(comparatorValue)))); .withStyle(redstoneColor(comparatorValue))));
boolean compare = state.getValue(ComparatorBlock.MODE) == ComparatorMode.COMPARE; boolean compare = state.getValue(ComparatorBlock.MODE) == ComparatorMode.COMPARE;
lines.add(new Pair<>( lines.add(new Pair<>(
new ItemStack(Items.REDSTONE_TORCH), new ItemStack(Items.REDSTONE_TORCH),
new TextComponent( Component.literal(compare ? ">=" : "-")
compare ? ">=" : "-")
.withStyle(redstoneColor(compare ? 0 : 15)))); .withStyle(redstoneColor(compare ? 0 : 15))));
}); });
ScryingLensOverlayRegistry.addDisplayer(Blocks.REPEATER, ScryingLensOverlayRegistry.addDisplayer(Blocks.REPEATER,
(lines, state, pos, observer, world, direction, lensHand) -> lines.add(new Pair<>( (lines, state, pos, observer, world, direction, lensHand) -> lines.add(new Pair<>(
new ItemStack(Items.CLOCK), new ItemStack(Items.CLOCK),
new TextComponent(String.valueOf(state.getValue(RepeaterBlock.DELAY))) Component.literal(String.valueOf(state.getValue(RepeaterBlock.DELAY)))
.withStyle(ChatFormatting.YELLOW)))); .withStyle(ChatFormatting.YELLOW))));
ScryingLensOverlayRegistry.addPredicateDisplayer( ScryingLensOverlayRegistry.addPredicateDisplayer(
@ -223,7 +222,7 @@ public class RegisterClientStuff {
lines.add(0, new Pair<>( lines.add(0, new Pair<>(
new ItemStack(Items.REDSTONE), new ItemStack(Items.REDSTONE),
new TextComponent(String.valueOf(signalStrength)) Component.literal(String.valueOf(signalStrength))
.withStyle(redstoneColor(signalStrength)))); .withStyle(redstoneColor(signalStrength))));
}); });
@ -234,7 +233,7 @@ public class RegisterClientStuff {
lines.add( lines.add(
new Pair<>( new Pair<>(
new ItemStack(Items.COMPARATOR), new ItemStack(Items.COMPARATOR),
new TextComponent(comparatorValue == -1 ? "" : String.valueOf(comparatorValue)) Component.literal(comparatorValue == -1 ? "" : String.valueOf(comparatorValue))
.withStyle(redstoneColor(comparatorValue)))); .withStyle(redstoneColor(comparatorValue))));
}); });
} }

View file

@ -26,6 +26,7 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.gui.screens.Screen import net.minecraft.client.gui.screens.Screen
import net.minecraft.client.renderer.GameRenderer import net.minecraft.client.renderer.GameRenderer
import net.minecraft.client.resources.sounds.SimpleSoundInstance import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.client.resources.sounds.SoundInstance
import net.minecraft.nbt.CompoundTag import net.minecraft.nbt.CompoundTag
import net.minecraft.sounds.SoundSource import net.minecraft.sounds.SoundSource
import net.minecraft.util.FormattedCharSequence import net.minecraft.util.FormattedCharSequence
@ -51,6 +52,8 @@ class GuiSpellcasting constructor(
private var ambianceSoundInstance: GridSoundInstance? = null private var ambianceSoundInstance: GridSoundInstance? = null
private val randSrc = SoundInstance.createUnseededRandom()
init { init {
for ((pattern, origin) in patterns) { for ((pattern, origin) in patterns) {
this.usedSpots.addAll(pattern.positions(origin)) this.usedSpots.addAll(pattern.positions(origin))
@ -71,6 +74,7 @@ class GuiSpellcasting constructor(
SoundSource.PLAYERS, SoundSource.PLAYERS,
0.5f, 0.5f,
1f + (Math.random().toFloat() - 0.5f) * 0.1f, 1f + (Math.random().toFloat() - 0.5f) * 0.1f,
randSrc,
this.ambianceSoundInstance!!.x, this.ambianceSoundInstance!!.x,
this.ambianceSoundInstance!!.y, this.ambianceSoundInstance!!.y,
this.ambianceSoundInstance!!.z, this.ambianceSoundInstance!!.z,
@ -147,6 +151,7 @@ class GuiSpellcasting constructor(
SoundSource.PLAYERS, SoundSource.PLAYERS,
0.25f, 0.25f,
1f, 1f,
randSrc,
this.ambianceSoundInstance!!.x, this.ambianceSoundInstance!!.x,
this.ambianceSoundInstance!!.y, this.ambianceSoundInstance!!.y,
this.ambianceSoundInstance!!.z, this.ambianceSoundInstance!!.z,
@ -222,6 +227,7 @@ class GuiSpellcasting constructor(
SoundSource.PLAYERS, SoundSource.PLAYERS,
0.25f, 0.25f,
1f + (Math.random().toFloat() - 0.5f) * 0.1f, 1f + (Math.random().toFloat() - 0.5f) * 0.1f,
randSrc,
this.ambianceSoundInstance!!.x, this.ambianceSoundInstance!!.x,
this.ambianceSoundInstance!!.y, this.ambianceSoundInstance!!.y,
this.ambianceSoundInstance!!.z, this.ambianceSoundInstance!!.z,

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.client.gui; package at.petrak.hexcasting.client.gui;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.api.spell.math.HexPattern; import at.petrak.hexcasting.api.spell.math.HexPattern;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.client.RenderLib; import at.petrak.hexcasting.client.RenderLib;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
@ -102,10 +102,7 @@ public class PatternTooltipGreeble implements ClientTooltipComponent, TooltipCom
buffer.vertex(neo, 0, SIZE, 0.0F).uv(0.0F, 1.0f).endVertex(); buffer.vertex(neo, 0, SIZE, 0.0F).uv(0.0F, 1.0f).endVertex();
buffer.vertex(neo, SIZE, SIZE, 0.0F).uv(1.0F, 1.0f).endVertex(); buffer.vertex(neo, SIZE, SIZE, 0.0F).uv(1.0F, 1.0f).endVertex();
buffer.vertex(neo, SIZE, 0, 0.0F).uv(1.0F, 0.0F).endVertex(); buffer.vertex(neo, SIZE, 0, 0.0F).uv(1.0F, 0.0F).endVertex();
buffer.end(); BufferUploader.draw(buffer.end());
BufferUploader.end(buffer);
} }
@Override @Override

View file

@ -11,7 +11,11 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
class GridSoundInstance(val player: Player) : class GridSoundInstance(val player: Player) :
AbstractTickableSoundInstance(HexSounds.CASTING_AMBIANCE, SoundSource.PLAYERS) { AbstractTickableSoundInstance(
HexSounds.CASTING_AMBIANCE,
SoundSource.PLAYERS,
SoundInstance.createUnseededRandom()
) {
var mousePosX: Double = 0.5 var mousePosX: Double = 0.5
var mousePosY: Double = 0.5 var mousePosY: Double = 0.5

View file

@ -5,6 +5,7 @@ import at.petrak.hexcasting.api.spell.math.HexPattern;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -20,7 +21,6 @@ import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Random;
public class BlockRedstoneDirectrix extends BlockCircleComponent { public class BlockRedstoneDirectrix extends BlockCircleComponent {
public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final DirectionProperty FACING = BlockStateProperties.FACING;
@ -84,7 +84,7 @@ public class BlockRedstoneDirectrix extends BlockCircleComponent {
@Override @Override
public void animateTick(BlockState bs, Level pLevel, BlockPos pos, Random rand) { public void animateTick(BlockState bs, Level pLevel, BlockPos pos, RandomSource rand) {
if (bs.getValue(REDSTONE_POWERED)) { if (bs.getValue(REDSTONE_POWERED)) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
var step = bs.getValue(FACING).getOpposite().step(); var step = bs.getValue(FACING).getOpposite().step();

View file

@ -9,6 +9,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -22,8 +23,6 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Random;
public class BlockStoredPlayerImpetus extends BlockAbstractImpetus { public class BlockStoredPlayerImpetus extends BlockAbstractImpetus {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
@ -72,7 +71,7 @@ public class BlockStoredPlayerImpetus extends BlockAbstractImpetus {
} }
@Override @Override
public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, Random pRandom) { public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) {
super.tick(pState, pLevel, pPos, pRandom); super.tick(pState, pLevel, pPos, pRandom);
if (pLevel.getBlockEntity(pPos) instanceof BlockEntityStoredPlayerImpetus tile) { if (pLevel.getBlockEntity(pPos) instanceof BlockEntityStoredPlayerImpetus tile) {
tile.updatePlayerProfile(); tile.updatePlayerProfile();

View file

@ -4,6 +4,7 @@ import at.petrak.hexcasting.common.particles.ConjureParticleOptions;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.AmethystBlock; import net.minecraft.world.level.block.AmethystBlock;
@ -12,8 +13,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Random;
public class BlockSconce extends AmethystBlock { public class BlockSconce extends AmethystBlock {
protected static VoxelShape AABB = Block.box(4, 0, 4, 12, 1, 12); protected static VoxelShape AABB = Block.box(4, 0, 4, 12, 1, 12);
@ -27,14 +26,14 @@ public class BlockSconce extends AmethystBlock {
} }
@Override @Override
public void animateTick(BlockState pState, Level pLevel, BlockPos pPos, Random rand) { public void animateTick(BlockState pState, Level pLevel, BlockPos pPos, RandomSource rand) {
if (rand.nextFloat() < 0.8f) { if (rand.nextFloat() < 0.8f) {
var cx = pPos.getX() + 0.5; var cx = pPos.getX() + 0.5;
var cy = pPos.getY() + 0.5; var cy = pPos.getY() + 0.5;
var cz = pPos.getZ() + 0.5; var cz = pPos.getZ() + 0.5;
int[] colors = {0xff_6f4fab, 0xff_b38ef3, 0xff_cfa0f3, 0xff_cfa0f3, 0xff_fffdd5}; int[] colors = {0xff_6f4fab, 0xff_b38ef3, 0xff_cfa0f3, 0xff_cfa0f3, 0xff_fffdd5};
pLevel.addParticle(new ConjureParticleOptions(colors[rand.nextInt(colors.length)], true), cx, cy, cz, pLevel.addParticle(new ConjureParticleOptions(colors[rand.nextInt(colors.length)], true), cx, cy, cz,
rand.nextFloat(-0.01f, 0.01f), rand.nextFloat(0.01f, 0.05f), rand.nextFloat(-0.01f, 0.01f)); rand.triangle(-0.01f, 0.01f), rand.triangle(0.01f, 0.05f), rand.triangle(-0.01f, 0.01f));
if (rand.nextFloat() < 0.08f) { if (rand.nextFloat() < 0.08f) {
pLevel.playLocalSound(cx, cy, cz, pLevel.playLocalSound(cx, cy, cz,
SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.BLOCKS, 1.0F, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.BLOCKS, 1.0F,

View file

@ -13,7 +13,6 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -44,11 +43,13 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
} }
@Override @Override
protected @Nullable Player getPlayer() { protected @Nullable
Player getPlayer() {
return this.storedPlayer == null ? null : this.level.getPlayerByUUID(this.storedPlayer); return this.storedPlayer == null ? null : this.level.getPlayerByUUID(this.storedPlayer);
} }
protected @Nullable GameProfile getPlayerName() { protected @Nullable
GameProfile getPlayerName() {
Player player = getStoredPlayer(); Player player = getStoredPlayer();
if (player != null) { if (player != null) {
return player.getGameProfile(); return player.getGameProfile();
@ -75,7 +76,8 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
} }
// just feels wrong to use the protected method // just feels wrong to use the protected method
public @Nullable Player getStoredPlayer() { public @Nullable
Player getStoredPlayer() {
return this.getPlayer(); return this.getPlayer();
} }
@ -95,10 +97,10 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
cachedDisplayStack = head; cachedDisplayStack = head;
} }
lines.add(new Pair<>(cachedDisplayStack, lines.add(new Pair<>(cachedDisplayStack,
new TranslatableComponent("hexcasting.tooltip.lens.impetus.storedplayer", name.getName()))); Component.translatable("hexcasting.tooltip.lens.impetus.storedplayer", name.getName())));
} else { } else {
lines.add(new Pair<>(new ItemStack(Items.BARRIER), lines.add(new Pair<>(new ItemStack(Items.BARRIER),
new TranslatableComponent("hexcasting.tooltip.lens.impetus.storedplayer.none"))); Component.translatable("hexcasting.tooltip.lens.impetus.storedplayer.none")));
} }
} }

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.common.casting; package at.petrak.hexcasting.common.casting;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.misc.ManaConstants; import at.petrak.hexcasting.api.misc.ManaConstants;
import at.petrak.hexcasting.api.spell.Action; import at.petrak.hexcasting.api.spell.Action;
import at.petrak.hexcasting.api.spell.iota.DoubleIota; import at.petrak.hexcasting.api.spell.iota.DoubleIota;
@ -52,267 +52,267 @@ public class RegisterPatterns {
// - CW is the special or destruction version // - CW is the special or destruction version
// == Getters == // == Getters ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaq", HexDir.NORTH_EAST), modLoc("get_caster"), PatternRegistry.mapPattern(HexPattern.fromAngles("qaq", HexDir.NORTH_EAST), modLoc("get_caster"),
OpGetCaster.INSTANCE); OpGetCaster.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("get_entity_pos"), PatternRegistry.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("get_entity_pos"),
OpEntityPos.INSTANCE); OpEntityPos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wa", HexDir.EAST), modLoc("get_entity_look"), PatternRegistry.mapPattern(HexPattern.fromAngles("wa", HexDir.EAST), modLoc("get_entity_look"),
OpEntityLook.INSTANCE); OpEntityLook.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awq", HexDir.NORTH_EAST), modLoc("get_entity_height"), PatternRegistry.mapPattern(HexPattern.fromAngles("awq", HexDir.NORTH_EAST), modLoc("get_entity_height"),
OpEntityHeight.INSTANCE); OpEntityHeight.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"), PatternRegistry.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"),
OpEntityVelocity.INSTANCE); OpEntityVelocity.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"), PatternRegistry.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"),
OpBlockRaycast.INSTANCE); OpBlockRaycast.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"), PatternRegistry.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"),
OpBlockAxisRaycast.INSTANCE); OpBlockAxisRaycast.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"), PatternRegistry.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"),
OpEntityRaycast.INSTANCE); OpEntityRaycast.INSTANCE);
// == spell circle getters == // == spell circle getters ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqae", HexDir.SOUTH_WEST),
modLoc("circle/impetus_pos"), OpImpetusPos.INSTANCE); modLoc("circle/impetus_pos"), OpImpetusPos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST),
modLoc("circle/impetus_dir"), OpImpetusDir.INSTANCE); modLoc("circle/impetus_dir"), OpImpetusDir.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewdd", HexDir.SOUTH_WEST),
modLoc("circle/bounds/min"), new OpCircleBounds(false)); modLoc("circle/bounds/min"), new OpCircleBounds(false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST),
modLoc("circle/bounds/max"), new OpCircleBounds(true)); modLoc("circle/bounds/max"), new OpCircleBounds(true));
// == Modify Stack == // == Modify Stack ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"), PatternRegistry.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"),
OpDuplicate.INSTANCE); OpDuplicate.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"), PatternRegistry.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"),
OpDuplicateN.INSTANCE); OpDuplicateN.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST), modLoc("stack_len"), PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawqaeaqa", HexDir.NORTH_WEST), modLoc("stack_len"),
OpStackSize.INSTANCE); OpStackSize.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), OpSwap.INSTANCE); PatternRegistry.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), OpSwap.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"), PatternRegistry.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"),
OpFisherman.INSTANCE); OpFisherman.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"), PatternRegistry.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"),
OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE); OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE);
// == Math == // == Math ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"), PatternRegistry.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"),
OpAdd.INSTANCE); OpAdd.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"), PatternRegistry.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"),
OpSub.INSTANCE); OpSub.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST), modLoc("mul_dot"), PatternRegistry.mapPattern(HexPattern.fromAngles("waqaw", HexDir.SOUTH_EAST), modLoc("mul_dot"),
OpMulDot.INSTANCE); OpMulDot.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"), PatternRegistry.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"),
OpDivCross.INSTANCE); OpDivCross.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST), modLoc("abs_len"), PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqw", HexDir.NORTH_EAST), modLoc("abs_len"),
OpAbsLen.INSTANCE); OpAbsLen.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"), PatternRegistry.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"),
OpPowProj.INSTANCE); OpPowProj.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"), PatternRegistry.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"),
OpFloor.INSTANCE); OpFloor.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"), PatternRegistry.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"),
OpCeil.INSTANCE); OpCeil.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"), PatternRegistry.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"),
OpConstructVec.INSTANCE); OpConstructVec.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"), PatternRegistry.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"),
OpDeconstructVec.INSTANCE); OpDeconstructVec.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST), modLoc("coerce_axial"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaww", HexDir.NORTH_WEST), modLoc("coerce_axial"),
OpCoerceToAxial.INSTANCE); OpCoerceToAxial.INSTANCE);
// == Logic == // == Logic ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"), PatternRegistry.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"),
OpBoolAnd.INSTANCE); OpBoolAnd.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"), PatternRegistry.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"),
OpBoolOr.INSTANCE); OpBoolOr.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"), PatternRegistry.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"),
OpBoolXor.INSTANCE); OpBoolXor.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("e", HexDir.SOUTH_EAST), modLoc("greater"), PatternRegistry.mapPattern(HexPattern.fromAngles("e", HexDir.SOUTH_EAST), modLoc("greater"),
new OpCompare(false, (a, b) -> a > b)); new OpCompare(false, (a, b) -> a > b));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("q", HexDir.SOUTH_WEST), modLoc("less"), PatternRegistry.mapPattern(HexPattern.fromAngles("q", HexDir.SOUTH_WEST), modLoc("less"),
new OpCompare(false, (a, b) -> a < b)); new OpCompare(false, (a, b) -> a < b));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ee", HexDir.SOUTH_EAST), modLoc("greater_eq"), PatternRegistry.mapPattern(HexPattern.fromAngles("ee", HexDir.SOUTH_EAST), modLoc("greater_eq"),
new OpCompare(true, (a, b) -> a >= b)); new OpCompare(true, (a, b) -> a >= b));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qq", HexDir.SOUTH_WEST), modLoc("less_eq"), PatternRegistry.mapPattern(HexPattern.fromAngles("qq", HexDir.SOUTH_WEST), modLoc("less_eq"),
new OpCompare(true, (a, b) -> a <= b)); new OpCompare(true, (a, b) -> a <= b));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"), PatternRegistry.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"),
new OpEquality(false)); new OpEquality(false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("da", HexDir.EAST), modLoc("not_equals"), PatternRegistry.mapPattern(HexPattern.fromAngles("da", HexDir.EAST), modLoc("not_equals"),
new OpEquality(true)); new OpEquality(true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"), PatternRegistry.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"),
OpBoolNot.INSTANCE); OpBoolNot.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("identity"), PatternRegistry.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("identity"),
OpBoolIdentityKindOf.INSTANCE); OpBoolIdentityKindOf.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"), PatternRegistry.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"),
OpRandom.INSTANCE); OpRandom.INSTANCE);
// == Advanced Math == // == Advanced Math ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"),
OpSin.INSTANCE); OpSin.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"),
OpCos.INSTANCE); OpCos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"), PatternRegistry.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"),
OpTan.INSTANCE); OpTan.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"), PatternRegistry.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"),
OpArcSin.INSTANCE); OpArcSin.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"), PatternRegistry.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"),
OpArcCos.INSTANCE); OpArcCos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"), PatternRegistry.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"),
OpArcTan.INSTANCE); OpArcTan.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"), PatternRegistry.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"),
OpLog.INSTANCE); OpLog.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"), PatternRegistry.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"),
OpModulo.INSTANCE); OpModulo.INSTANCE);
// == Sets == // == Sets ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST), modLoc("and_bit"), PatternRegistry.mapPattern(HexPattern.fromAngles("wdweaqa", HexDir.NORTH_EAST), modLoc("and_bit"),
OpAnd.INSTANCE); OpAnd.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"), PatternRegistry.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"),
OpOr.INSTANCE); OpOr.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST), modLoc("xor_bit"), PatternRegistry.mapPattern(HexPattern.fromAngles("dwaeaqa", HexDir.NORTH_WEST), modLoc("xor_bit"),
OpXor.INSTANCE); OpXor.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"), PatternRegistry.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"),
OpNot.INSTANCE); OpNot.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST), modLoc("to_set"), PatternRegistry.mapPattern(HexPattern.fromAngles("aweaqa", HexDir.NORTH_EAST), modLoc("to_set"),
OpToSet.INSTANCE); OpToSet.INSTANCE);
// == Spells == // == Spells ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"), PatternRegistry.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"),
OpPrint.INSTANCE); OpPrint.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"), PatternRegistry.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"),
new OpExplode(false)); new OpExplode(false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddwddwdd", HexDir.EAST), modLoc("explode/fire"), PatternRegistry.mapPattern(HexPattern.fromAngles("ddwddwdd", HexDir.EAST), modLoc("explode/fire"),
new OpExplode(true)); new OpExplode(true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"), PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"),
OpAddMotion.INSTANCE); OpAddMotion.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"), PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"),
OpBlink.INSTANCE); OpBlink.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"), PatternRegistry.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"),
OpBreakBlock.INSTANCE); OpBreakBlock.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST), modLoc("place_block"), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeede", HexDir.SOUTH_WEST), modLoc("place_block"),
OpPlaceBlock.INSTANCE); OpPlaceBlock.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST),
modLoc("colorize"), modLoc("colorize"),
OpColorize.INSTANCE); OpColorize.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), modLoc("create_water"), PatternRegistry.mapPattern(HexPattern.fromAngles("aqawqadaq", HexDir.SOUTH_EAST), modLoc("create_water"),
OpCreateWater.INSTANCE); OpCreateWater.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST),
modLoc("destroy_water"), modLoc("destroy_water"),
OpDestroyWater.INSTANCE); OpDestroyWater.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"), PatternRegistry.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"),
OpIgnite.INSTANCE); OpIgnite.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"), PatternRegistry.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"),
OpExtinguish.INSTANCE); OpExtinguish.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqa", HexDir.NORTH_EAST), modLoc("conjure_block"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqa", HexDir.NORTH_EAST), modLoc("conjure_block"),
new OpConjureBlock(false)); new OpConjureBlock(false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqd", HexDir.NORTH_EAST), modLoc("conjure_light"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqd", HexDir.NORTH_EAST), modLoc("conjure_light"),
new OpConjureBlock(true)); new OpConjureBlock(true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"), PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"),
OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE); OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST),
modLoc("recharge"), modLoc("recharge"),
OpRecharge.INSTANCE); OpRecharge.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"), PatternRegistry.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"),
new OpErase()); new OpErase());
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"), PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"),
OpEdifySapling.INSTANCE); OpEdifySapling.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"), PatternRegistry.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"),
OpBeep.INSTANCE); OpBeep.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waqqqqq", HexDir.EAST), modLoc("craft/cypher"), PatternRegistry.mapPattern(HexPattern.fromAngles("waqqqqq", HexDir.EAST), modLoc("craft/cypher"),
new OpMakePackagedSpell<>(HexItems.CYPHER, ManaConstants.CRYSTAL_UNIT)); new OpMakePackagedSpell<>(HexItems.CYPHER, ManaConstants.CRYSTAL_UNIT));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST),
modLoc("craft/trinket"), modLoc("craft/trinket"),
new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * ManaConstants.CRYSTAL_UNIT)); new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * ManaConstants.CRYSTAL_UNIT));
PatternRegistryBak.mapPattern( PatternRegistry.mapPattern(
HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST), HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST),
modLoc("craft/artifact"), modLoc("craft/artifact"),
new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * ManaConstants.CRYSTAL_UNIT)); new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * ManaConstants.CRYSTAL_UNIT));
PatternRegistryBak.mapPattern( PatternRegistry.mapPattern(
HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST), HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST),
modLoc("craft/battery"), modLoc("craft/battery"),
OpMakeBattery.INSTANCE, OpMakeBattery.INSTANCE,
true); true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST),
modLoc("potion/weakness"), modLoc("potion/weakness"),
new OpPotionEffect(MobEffects.WEAKNESS, ManaConstants.DUST_UNIT / 10, true, false, false)); new OpPotionEffect(MobEffects.WEAKNESS, ManaConstants.DUST_UNIT / 10, true, false, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqawwawawd", HexDir.WEST),
modLoc("potion/levitation"), modLoc("potion/levitation"),
new OpPotionEffect(MobEffects.LEVITATION, ManaConstants.DUST_UNIT / 5, false, false, false)); new OpPotionEffect(MobEffects.LEVITATION, ManaConstants.DUST_UNIT / 5, false, false, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaewawawe", HexDir.SOUTH_WEST),
modLoc("potion/wither"), modLoc("potion/wither"),
new OpPotionEffect(MobEffects.WITHER, ManaConstants.DUST_UNIT, true, false, false)); new OpPotionEffect(MobEffects.WITHER, ManaConstants.DUST_UNIT, true, false, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqadwawaww", HexDir.SOUTH_EAST),
modLoc("potion/poison"), modLoc("potion/poison"),
new OpPotionEffect(MobEffects.POISON, ManaConstants.DUST_UNIT / 3, true, false, false)); new OpPotionEffect(MobEffects.POISON, ManaConstants.DUST_UNIT / 3, true, false, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqadwawaw", HexDir.SOUTH_EAST),
modLoc("potion/slowness"), modLoc("potion/slowness"),
new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, ManaConstants.DUST_UNIT / 3, true, false, false)); new OpPotionEffect(MobEffects.MOVEMENT_SLOWDOWN, ManaConstants.DUST_UNIT / 3, true, false, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqaawawaedd", HexDir.NORTH_WEST),
modLoc("potion/regeneration"), modLoc("potion/regeneration"),
new OpPotionEffect(MobEffects.REGENERATION, ManaConstants.DUST_UNIT, true, true, true), true); new OpPotionEffect(MobEffects.REGENERATION, ManaConstants.DUST_UNIT, true, true, true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaawawaeqdd", HexDir.WEST),
modLoc("potion/night_vision"), modLoc("potion/night_vision"),
new OpPotionEffect(MobEffects.NIGHT_VISION, ManaConstants.DUST_UNIT / 5, false, true, true), true); new OpPotionEffect(MobEffects.NIGHT_VISION, ManaConstants.DUST_UNIT / 5, false, true, true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqaawawaeqqdd", HexDir.SOUTH_WEST),
modLoc("potion/absorption"), modLoc("potion/absorption"),
new OpPotionEffect(MobEffects.ABSORPTION, ManaConstants.DUST_UNIT, true, true, true), true); new OpPotionEffect(MobEffects.ABSORPTION, ManaConstants.DUST_UNIT, true, true, true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qaawawaeqqqdd", HexDir.SOUTH_EAST),
modLoc("potion/haste"), modLoc("potion/haste"),
new OpPotionEffect(MobEffects.DIG_SPEED, ManaConstants.DUST_UNIT / 3, true, true, true), true); new OpPotionEffect(MobEffects.DIG_SPEED, ManaConstants.DUST_UNIT / 3, true, true, true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("aawawaeqqqqdd", HexDir.EAST),
modLoc("potion/strength"), modLoc("potion/strength"),
new OpPotionEffect(MobEffects.DAMAGE_BOOST, ManaConstants.DUST_UNIT / 3, true, true, true), true); new OpPotionEffect(MobEffects.DAMAGE_BOOST, ManaConstants.DUST_UNIT / 3, true, true, true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawae", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("waeawae", HexDir.EAST),
modLoc("sentinel/create"), modLoc("sentinel/create"),
new OpCreateSentinel(false)); new OpCreateSentinel(false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST),
modLoc("sentinel/destroy"), modLoc("sentinel/destroy"),
OpDestroySentinel.INSTANCE); OpDestroySentinel.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST),
modLoc("sentinel/get_pos"), modLoc("sentinel/get_pos"),
OpGetSentinelPos.INSTANCE); OpGetSentinelPos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST),
modLoc("sentinel/wayfind"), modLoc("sentinel/wayfind"),
OpGetSentinelWayfind.INSTANCE); OpGetSentinelWayfind.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST),
modLoc("lightning"), OpLightning.INSTANCE, true); modLoc("lightning"), OpLightning.INSTANCE, true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("eawwaeawawaa", HexDir.NORTH_WEST),
modLoc("flight"), OpFlight.INSTANCE, true); modLoc("flight"), OpFlight.INSTANCE, true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST),
modLoc("create_lava"), OpCreateLava.INSTANCE, true); modLoc("create_lava"), OpCreateLava.INSTANCE, true);
PatternRegistryBak.mapPattern( PatternRegistry.mapPattern(
HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST), HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST),
modLoc("teleport"), OpTeleport.INSTANCE, true); modLoc("teleport"), OpTeleport.INSTANCE, true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST),
modLoc("sentinel/create/great"), modLoc("sentinel/create/great"),
new OpCreateSentinel(true), true); new OpCreateSentinel(true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST),
modLoc("dispel_rain"), modLoc("dispel_rain"),
new OpWeather(false), true); new OpWeather(false), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST),
modLoc("summon_rain"), modLoc("summon_rain"),
new OpWeather(true), true); new OpWeather(true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST),
modLoc("brainsweep"), modLoc("brainsweep"),
OpBrainsweep.INSTANCE, true); OpBrainsweep.INSTANCE, true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST), modLoc("akashic/read"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqwqqqqqaq", HexDir.WEST), modLoc("akashic/read"),
OpAkashicRead.INSTANCE); OpAkashicRead.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"),
OpAkashicWrite.INSTANCE); OpAkashicWrite.INSTANCE);
// == Meta stuff == // == Meta stuff ==
@ -322,155 +322,155 @@ public class RegisterPatterns {
// http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf // http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf
// eval being a space filling curve feels apt doesn't it // eval being a space filling curve feels apt doesn't it
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"), PatternRegistry.mapPattern(HexPattern.fromAngles("deaqq", HexDir.SOUTH_EAST), modLoc("eval"),
OpEval.INSTANCE); OpEval.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"), PatternRegistry.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"),
OpHalt.INSTANCE); OpHalt.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"), PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"),
OpRead.INSTANCE); OpRead.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"), PatternRegistry.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"),
OpWrite.INSTANCE); OpWrite.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"), PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"),
OpReadable.INSTANCE); OpReadable.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"), PatternRegistry.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"),
OpWritable.INSTANCE); OpWritable.INSTANCE);
// lorge boyes // lorge boyes
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST),
modLoc("read/entity"), OpTheCoolerRead.INSTANCE); modLoc("read/entity"), OpTheCoolerRead.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST),
modLoc("readable/entity"), OpTheCoolerReadable.INSTANCE); modLoc("readable/entity"), OpTheCoolerReadable.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qeewdweddw", HexDir.NORTH_EAST),
modLoc("read/local"), OpPeekLocal.INSTANCE); modLoc("read/local"), OpPeekLocal.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST),
modLoc("write/local"), OpPushLocal.INSTANCE); modLoc("write/local"), OpPushLocal.INSTANCE);
// == Consts == // == Consts ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"), PatternRegistry.mapPattern(HexPattern.fromAngles("d", HexDir.EAST), modLoc("const/null"),
Action.makeConstantOp(new NullIota())); Action.makeConstantOp(new NullIota()));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqea", HexDir.NORTH_WEST), modLoc("const/vec/px"),
Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(1.0, 0.0, 0.0))));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqew", HexDir.NORTH_WEST), modLoc("const/vec/py"),
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 1.0, 0.0))));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqed", HexDir.NORTH_WEST), modLoc("const/vec/pz"),
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 1.0))));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqa", HexDir.SOUTH_WEST), modLoc("const/vec/nx"),
Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(-1.0, 0.0, 0.0))));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqw", HexDir.SOUTH_WEST), modLoc("const/vec/ny"),
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, -1.0, 0.0))));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeeqd", HexDir.SOUTH_WEST), modLoc("const/vec/nz"),
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, -1.0))));
// Yep, this is what I spend the "plain hexagon" pattern on. // Yep, this is what I spend the "plain hexagon" pattern on.
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqq", HexDir.NORTH_WEST), modLoc("const/vec/0"),
Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0)))); Action.makeConstantOp(new Vec3Iota(new Vec3(0.0, 0.0, 0.0))));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"), PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdq", HexDir.NORTH_EAST), modLoc("const/double/pi"),
Action.makeConstantOp(new DoubleIota(Math.PI))); Action.makeConstantOp(new DoubleIota(Math.PI)));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"), PatternRegistry.mapPattern(HexPattern.fromAngles("eawae", HexDir.NORTH_WEST), modLoc("const/double/tau"),
Action.makeConstantOp(new DoubleIota(HexUtils.TAU))); Action.makeConstantOp(new DoubleIota(HexUtils.TAU)));
// e // e
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"), PatternRegistry.mapPattern(HexPattern.fromAngles("aaq", HexDir.EAST), modLoc("const/double/e"),
Action.makeConstantOp(new DoubleIota(Math.E))); Action.makeConstantOp(new DoubleIota(Math.E)));
// == Entities == // == Entities ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqa", HexDir.SOUTH_EAST), modLoc("get_entity"),
new OpGetEntityAt(e -> true)); new OpGetEntityAt(e -> true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST),
modLoc("get_entity/animal"), modLoc("get_entity/animal"),
new OpGetEntityAt(OpGetEntitiesBy::isAnimal)); new OpGetEntityAt(OpGetEntitiesBy::isAnimal));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST),
modLoc("get_entity/monster"), modLoc("get_entity/monster"),
new OpGetEntityAt(OpGetEntitiesBy::isMonster)); new OpGetEntityAt(OpGetEntitiesBy::isMonster));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST),
modLoc("get_entity/item"), modLoc("get_entity/item"),
new OpGetEntityAt(OpGetEntitiesBy::isItem)); new OpGetEntityAt(OpGetEntitiesBy::isItem));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST),
modLoc("get_entity/player"), modLoc("get_entity/player"),
new OpGetEntityAt(OpGetEntitiesBy::isPlayer)); new OpGetEntityAt(OpGetEntitiesBy::isPlayer));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST),
modLoc("get_entity/living"), modLoc("get_entity/living"),
new OpGetEntityAt(OpGetEntitiesBy::isLiving)); new OpGetEntityAt(OpGetEntitiesBy::isLiving));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwded", HexDir.SOUTH_EAST), modLoc("zone_entity"),
new OpGetEntitiesBy(e -> true, false)); new OpGetEntitiesBy(e -> true, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST),
modLoc("zone_entity/animal"), modLoc("zone_entity/animal"),
new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false)); new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawa", HexDir.NORTH_EAST),
modLoc("zone_entity/not_animal"), modLoc("zone_entity/not_animal"),
new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, true)); new OpGetEntitiesBy(OpGetEntitiesBy::isAnimal, true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwq", HexDir.SOUTH_EAST),
modLoc("zone_entity/monster"), modLoc("zone_entity/monster"),
new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false)); new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawq", HexDir.NORTH_EAST),
modLoc("zone_entity/not_monster"), modLoc("zone_entity/not_monster"),
new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, true)); new OpGetEntitiesBy(OpGetEntitiesBy::isMonster, true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddww", HexDir.SOUTH_EAST),
modLoc("zone_entity/item"), modLoc("zone_entity/item"),
new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false)); new OpGetEntitiesBy(OpGetEntitiesBy::isItem, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaaww", HexDir.NORTH_EAST),
modLoc("zone_entity/not_item"), modLoc("zone_entity/not_item"),
new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true)); new OpGetEntitiesBy(OpGetEntitiesBy::isItem, true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwe", HexDir.SOUTH_EAST),
modLoc("zone_entity/player"), modLoc("zone_entity/player"),
new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false)); new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawe", HexDir.NORTH_EAST),
modLoc("zone_entity/not_player"), modLoc("zone_entity/not_player"),
new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, true)); new OpGetEntitiesBy(OpGetEntitiesBy::isPlayer, true));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwd", HexDir.SOUTH_EAST),
modLoc("zone_entity/living"), modLoc("zone_entity/living"),
new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false)); new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("eeeeewaqaawd", HexDir.NORTH_EAST),
modLoc("zone_entity/not_living"), modLoc("zone_entity/not_living"),
new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true)); new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true));
// == Lists == // == Lists ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"), PatternRegistry.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"),
OpAppend.INSTANCE); OpAppend.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"), PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"),
OpConcat.INSTANCE); OpConcat.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"), PatternRegistry.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"),
OpIndex.INSTANCE); OpIndex.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"), PatternRegistry.mapPattern(HexPattern.fromAngles("dadad", HexDir.NORTH_EAST), modLoc("for_each"),
OpForEach.INSTANCE); OpForEach.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"), PatternRegistry.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"),
OpListSize.INSTANCE); OpListSize.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"), PatternRegistry.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"),
OpSingleton.INSTANCE); OpSingleton.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqaeaae", HexDir.NORTH_EAST), modLoc("empty_list"),
OpEmptyList.INSTANCE); OpEmptyList.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"), PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"),
OpReverski.INSTANCE); OpReverski.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"), PatternRegistry.mapPattern(HexPattern.fromAngles("ewdqdwe", HexDir.SOUTH_WEST), modLoc("last_n_list"),
OpLastNToList.INSTANCE); OpLastNToList.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"), PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"),
OpSplat.INSTANCE); OpSplat.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"), PatternRegistry.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"),
OpIndexOf.INSTANCE); OpIndexOf.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"), PatternRegistry.mapPattern(HexPattern.fromAngles("edqdewaqa", HexDir.SOUTH_WEST), modLoc("list_remove"),
OpRemove.INSTANCE); OpRemove.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"), PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"),
OpSlice.INSTANCE); OpSlice.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST),
modLoc("modify_in_place"), modLoc("modify_in_place"),
OpModifyInPlace.INSTANCE); OpModifyInPlace.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"), PatternRegistry.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"),
OpCons.INSTANCE); OpCons.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"), PatternRegistry.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"),
OpUnCons.INSTANCE); OpUnCons.INSTANCE);
} catch (PatternRegistryBak.RegisterPatternException exn) { } catch (PatternRegistry.RegisterPatternException exn) {
exn.printStackTrace(); exn.printStackTrace();
} }
// Add zilde->number // Add zilde->number
PatternRegistryBak.addSpecialHandler(modLoc("number"), pat -> { PatternRegistry.addSpecialHandler(modLoc("number"), pat -> {
var sig = pat.anglesSignature(); var sig = pat.anglesSignature();
if (sig.startsWith("aqaa") || sig.startsWith("dedd")) { if (sig.startsWith("aqaa") || sig.startsWith("dedd")) {
var negate = sig.startsWith("dedd"); var negate = sig.startsWith("dedd");
@ -497,7 +497,7 @@ public class RegisterPatterns {
} }
}); });
PatternRegistryBak.addSpecialHandler(modLoc("mask"), pat -> { PatternRegistry.addSpecialHandler(modLoc("mask"), pat -> {
var directions = pat.directions(); var directions = pat.directions();
HexDir flatDir = pat.getStartDir(); HexDir flatDir = pat.getStartDir();

View file

@ -8,7 +8,6 @@ import at.petrak.hexcasting.api.spell.casting.OperatorSideEffect
import at.petrak.hexcasting.api.spell.casting.SpellContinuation import at.petrak.hexcasting.api.spell.casting.SpellContinuation
import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.iota.Iota
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
import net.minecraft.Util
// TODO should this dump the whole stack // TODO should this dump the whole stack
object OpPrint : Action { object OpPrint : Action {
@ -31,10 +30,7 @@ object OpPrint : Action {
private data class Spell(val datum: Iota) : RenderedSpell { private data class Spell(val datum: Iota) : RenderedSpell {
override fun cast(ctx: CastingContext) { override fun cast(ctx: CastingContext) {
ctx.caster.sendMessage( ctx.caster.sendSystemMessage(datum.display())
datum.display(),
Util.NIL_UUID
)
} }
} }
} }

View file

@ -1,33 +1,33 @@
package at.petrak.hexcasting.common.command; package at.petrak.hexcasting.common.command;
import at.petrak.hexcasting.common.misc.Brainsweeping; import at.petrak.hexcasting.common.misc.Brainsweeping;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.EntityArgument;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.Villager;
public class BrainsweepCommand { public class BrainsweepCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) { public static void add(LiteralArgumentBuilder<CommandSourceStack> cmd) {
dispatcher.register(Commands.literal("hexcasting:brainsweep") cmd.then(Commands.literal("brainsweep")
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) .requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS))
.then(Commands.argument("villager", EntityArgument.entity()).executes(ctx -> { .then(Commands.argument("villager", EntityArgument.entity()).executes(ctx -> {
var target = EntityArgument.getEntity(ctx, "villager"); var target = EntityArgument.getEntity(ctx, "villager");
if (target instanceof Villager v) { if (target instanceof Villager v) {
if (Brainsweeping.isBrainswept(v)) { if (Brainsweeping.isBrainswept(v)) {
ctx.getSource().sendFailure( ctx.getSource().sendFailure(
new TranslatableComponent("command.hexcasting.brainsweep.fail.already", Component.translatable("command.hexcasting.brainsweep.fail.already",
v.getDisplayName())); v.getDisplayName()));
return 0; return 0;
} }
Brainsweeping.brainsweep(v); Brainsweeping.brainsweep(v);
ctx.getSource().sendSuccess( ctx.getSource().sendSuccess(
new TranslatableComponent("command.hexcasting.brainsweep", v.getDisplayName()), true); Component.translatable("command.hexcasting.brainsweep", v.getDisplayName()), true);
return 1; return 1;
} else { } else {
ctx.getSource().sendFailure( ctx.getSource().sendFailure(
new TranslatableComponent("command.hexcasting.brainsweep.fail.badtype", Component.translatable("command.hexcasting.brainsweep.fail.badtype",
target.getDisplayName())); target.getDisplayName()));
return 0; return 0;
} }

View file

@ -5,20 +5,19 @@ import at.petrak.hexcasting.api.spell.iota.PatternIota;
import at.petrak.hexcasting.api.spell.math.HexPattern; import at.petrak.hexcasting.api.spell.math.HexPattern;
import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.items.ItemScroll;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.commands.arguments.ResourceLocationArgument; import net.minecraft.commands.arguments.ResourceLocationArgument;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
public class ListPatternsCommand { public class ListPatternsCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) { public static void add(LiteralArgumentBuilder<CommandSourceStack> cmd) {
dispatcher.register(Commands.literal("hexcasting:patterns") cmd.then(Commands.literal("patterns")
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) .requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS))
.then(Commands.literal("list").executes(ctx -> { .then(Commands.literal("list").executes(ctx -> {
@ -28,10 +27,10 @@ public class ListPatternsCommand {
.sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst())) .sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst()))
.toList(); .toList();
ctx.getSource().sendSuccess(new TranslatableComponent("command.hexcasting.pats.listing"), false); ctx.getSource().sendSuccess(Component.translatable("command.hexcasting.pats.listing"), false);
for (var pair : listing) { for (var pair : listing) {
HexPattern hexPattern = HexPattern.fromAngles(pair.getKey(), pair.getValue().getSecond()); HexPattern hexPattern = HexPattern.fromAngles(pair.getKey(), pair.getValue().getSecond());
ctx.getSource().sendSuccess(new TextComponent(pair.getValue().getFirst().toString()) ctx.getSource().sendSuccess(Component.literal(pair.getValue().getFirst().toString())
.append(": ") .append(": ")
.append(PatternIota.display(hexPattern)), false); .append(PatternIota.display(hexPattern)), false);
} }
@ -56,7 +55,7 @@ public class ListPatternsCommand {
stack.setTag(tag); stack.setTag(tag);
ctx.getSource().sendSuccess( ctx.getSource().sendSuccess(
new TranslatableComponent( Component.translatable(
"command.hexcasting.pats.specific.success", "command.hexcasting.pats.specific.success",
stack.getDisplayName(), stack.getDisplayName(),
targetId), targetId),
@ -99,7 +98,7 @@ public class ListPatternsCommand {
}); });
ctx.getSource().sendSuccess( ctx.getSource().sendSuccess(
new TranslatableComponent("command.hexcasting.pats.all", lookup.size()), true); Component.translatable("command.hexcasting.pats.all", lookup.size()), true);
return lookup.size(); return lookup.size();
} else { } else {
return 0; return 0;

View file

@ -10,7 +10,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.SharedSuggestionProvider; import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.commands.arguments.ResourceLocationArgument; import net.minecraft.commands.arguments.ResourceLocationArgument;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -18,7 +18,7 @@ import java.util.concurrent.CompletableFuture;
public class PatternResLocArgument extends ResourceLocationArgument { public class PatternResLocArgument extends ResourceLocationArgument {
private static final DynamicCommandExceptionType ERROR_UNKNOWN_PATTERN = new DynamicCommandExceptionType( private static final DynamicCommandExceptionType ERROR_UNKNOWN_PATTERN = new DynamicCommandExceptionType(
(errorer) -> (errorer) ->
new TranslatableComponent("hexcasting.pattern.unknown", errorer) Component.translatable("hexcasting.pattern.unknown", errorer)
); );
public static PatternResLocArgument id() { public static PatternResLocArgument id() {

View file

@ -1,22 +1,22 @@
package at.petrak.hexcasting.common.command; package at.petrak.hexcasting.common.command;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.network.chat.Component;
public class RecalcPatternsCommand { public class RecalcPatternsCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) { public static void add(LiteralArgumentBuilder<CommandSourceStack> cmd) {
dispatcher.register(Commands.literal("hexcasting:recalcPatterns") cmd.then(Commands.literal("recalcPatterns")
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) .requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS))
.executes(ctx -> { .executes(ctx -> {
var world = ctx.getSource().getServer().overworld(); var world = ctx.getSource().getServer().overworld();
var ds = world.getDataStorage(); var ds = world.getDataStorage();
ds.set(PatternRegistryBak.TAG_SAVED_DATA, PatternRegistryBak.Save.create(world.getSeed())); ds.set(PatternRegistry.TAG_SAVED_DATA, PatternRegistry.Save.create(world.getSeed()));
ctx.getSource().sendSuccess( ctx.getSource().sendSuccess(
new TranslatableComponent("command.hexcasting.recalc"), true); Component.translatable("command.hexcasting.recalc"), true);
return 1; return 1;
})); }));
} }

View file

@ -8,7 +8,6 @@ import at.petrak.hexcasting.common.lib.HexIotaTypes;
import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.common.lib.HexSounds;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -28,7 +27,8 @@ public class ItemAbacus extends Item implements IotaHolderItem {
} }
@Override @Override
public @Nullable CompoundTag readIotaTag(ItemStack stack) { public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
var datum = new DoubleIota(NBTHelper.getDouble(stack, TAG_VALUE)); var datum = new DoubleIota(NBTHelper.getDouble(stack, TAG_VALUE));
return HexIotaTypes.serialize(datum); return HexIotaTypes.serialize(datum);
} }
@ -56,7 +56,7 @@ public class ItemAbacus extends Item implements IotaHolderItem {
if (oldNum == 69) { if (oldNum == 69) {
key += ".nice"; key += ".nice";
} }
player.displayClientMessage(new TranslatableComponent(key), true); player.displayClientMessage(Component.translatable(key), true);
return InteractionResultHolder.sidedSuccess(stack, world.isClientSide); return InteractionResultHolder.sidedSuccess(stack, world.isClientSide);
} else { } else {

View file

@ -1,11 +1,9 @@
package at.petrak.hexcasting.common.items; package at.petrak.hexcasting.common.items;
import at.petrak.hexcasting.common.lib.HexSounds; import at.petrak.hexcasting.common.lib.HexSounds;
import net.minecraft.Util;
import net.minecraft.advancements.Advancement; import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.network.chat.ChatType; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
@ -67,8 +65,7 @@ public class ItemLoreFragment extends Item {
} }
if (unfoundLore == null) { if (unfoundLore == null) {
splayer.sendMessage(new TranslatableComponent("item.hexcasting.lore_fragment.all"), ChatType.GAME_INFO, splayer.displayClientMessage(Component.translatable("item.hexcasting.lore_fragment.all"), true);
Util.NIL_UUID);
splayer.giveExperiencePoints(20); splayer.giveExperiencePoints(20);
level.playSound(null, player.position().x, player.position().y, player.position().z, level.playSound(null, player.position().x, player.position().y, player.position().z,
HexSounds.READ_LORE_FRAGMENT, SoundSource.PLAYERS, 1f, 1f); HexSounds.READ_LORE_FRAGMENT, SoundSource.PLAYERS, 1f, 1f);

View file

@ -12,7 +12,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
@ -50,7 +49,8 @@ public class ItemScroll extends Item implements IotaHolderItem {
} }
@Override @Override
public @Nullable CompoundTag readIotaTag(ItemStack stack) { public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
CompoundTag pattern = NBTHelper.getCompound(stack, TAG_PATTERN); CompoundTag pattern = NBTHelper.getCompound(stack, TAG_PATTERN);
if (pattern == null) { if (pattern == null) {
return null; return null;
@ -119,12 +119,12 @@ public class ItemScroll extends Item implements IotaHolderItem {
var descID = this.getDescriptionId(pStack); var descID = this.getDescriptionId(pStack);
var ancientId = NBTHelper.getString(pStack, TAG_OP_ID); var ancientId = NBTHelper.getString(pStack, TAG_OP_ID);
if (ancientId != null) { if (ancientId != null) {
return new TranslatableComponent(descID + ".of", return Component.translatable(descID + ".of",
new TranslatableComponent("hexcasting.spell." + ResourceLocation.tryParse(ancientId))); Component.translatable( "hexcasting.spell." + ResourceLocation.tryParse(ancientId)));
} else if (NBTHelper.hasCompound(pStack, TAG_PATTERN)) { } else if (NBTHelper.hasCompound(pStack, TAG_PATTERN)) {
return new TranslatableComponent(descID); return Component.translatable(descID);
} else { } else {
return new TranslatableComponent(descID + ".empty"); return Component.translatable(descID + ".empty");
} }
} }

View file

@ -13,7 +13,6 @@ import at.petrak.hexcasting.common.lib.HexIotaTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;
@ -38,7 +37,7 @@ public class ItemSlate extends BlockItem implements IotaHolderItem {
@Override @Override
public Component getName(ItemStack pStack) { public Component getName(ItemStack pStack) {
var key = "block." + HexAPI.MOD_ID + ".slate." + (hasPattern(pStack) ? "written" : "blank"); var key = "block." + HexAPI.MOD_ID + ".slate." + (hasPattern(pStack) ? "written" : "blank");
return new TranslatableComponent(key); return Component.translatable(key);
} }
public static boolean hasPattern(ItemStack stack) { public static boolean hasPattern(ItemStack stack) {
@ -66,7 +65,8 @@ public class ItemSlate extends BlockItem implements IotaHolderItem {
} }
@Override @Override
public @Nullable CompoundTag readIotaTag(ItemStack stack) { public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
var bet = NBTHelper.getCompound(stack, "BlockEntityTag"); var bet = NBTHelper.getCompound(stack, "BlockEntityTag");
if (bet == null || !bet.contains(BlockEntitySlate.TAG_PATTERN, Tag.TAG_COMPOUND)) { if (bet == null || !bet.contains(BlockEntitySlate.TAG_PATTERN, Tag.TAG_COMPOUND)) {

View file

@ -9,8 +9,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
@ -52,15 +50,15 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
int highest = highestPage(stack); int highest = highestPage(stack);
if (highest != 0) { if (highest != 0) {
if (sealed) { if (sealed) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page.sealed", tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.page.sealed",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(highest)).withStyle(ChatFormatting.WHITE),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD)) Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} else { } else {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page", tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE)) Component.literal(String.valueOf(highest)).withStyle(ChatFormatting.WHITE))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} }
} else { } else {
@ -74,16 +72,16 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
boolean overridden = NBTHelper.hasString(stack, TAG_OVERRIDE_VISUALLY); boolean overridden = NBTHelper.hasString(stack, TAG_OVERRIDE_VISUALLY);
if (sealed) { if (sealed) {
if (overridden) { if (overridden) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle( tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(
ChatFormatting.GOLD)); ChatFormatting.GOLD));
} else { } else {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty.sealed", tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.empty.sealed",
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD)) Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY)); .withStyle(ChatFormatting.GRAY));
} }
} else if (!overridden) { } else if (!overridden) {
tooltip.add( tooltip.add(
new TranslatableComponent("hexcasting.tooltip.spellbook.empty").withStyle(ChatFormatting.GRAY)); Component.translatable("hexcasting.tooltip.spellbook.empty").withStyle(ChatFormatting.GRAY));
} }
} }
@ -113,7 +111,8 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
} }
@Override @Override
public @Nullable CompoundTag readIotaTag(ItemStack stack) { public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
int idx = getPage(stack, 1); int idx = getPage(stack, 1);
var key = String.valueOf(idx); var key = String.valueOf(idx);
var tag = NBTHelper.getCompound(stack, TAG_PAGES); var tag = NBTHelper.getCompound(stack, TAG_PAGES);
@ -125,7 +124,8 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
} }
@Override @Override
public @Nullable Iota emptyIota(ItemStack stack) { public @Nullable
Iota emptyIota(ItemStack stack) {
return new NullIota(); return new NullIota();
} }

View file

@ -5,10 +5,11 @@ import at.petrak.hexcasting.api.misc.ManaConstants;
import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.api.utils.NBTHelper;
import at.petrak.hexcasting.common.lib.HexItems; import at.petrak.hexcasting.common.lib.HexItems;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.advancements.Advancement; import net.minecraft.advancements.Advancement;
import net.minecraft.locale.Language; import net.minecraft.locale.Language;
import net.minecraft.network.chat.*; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextColor;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
@ -39,9 +40,9 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
String prefix = "item.hexcasting.creative_unlocker."; String prefix = "item.hexcasting.creative_unlocker.";
String emphasis = Language.getInstance().getOrDefault(prefix + "for_emphasis"); String emphasis = Language.getInstance().getOrDefault(prefix + "for_emphasis");
MutableComponent emphasized = new TextComponent(""); MutableComponent emphasized = Component.literal("");
for (int i = 0; i < emphasis.length(); i++) { for (int i = 0; i < emphasis.length(); i++) {
emphasized.append(rainbow(new TextComponent("" + emphasis.charAt(i)), i, level)); emphasized.append(rainbow(Component.literal("" + emphasis.charAt(i)), i, level));
} }
return emphasized; return emphasized;
@ -106,17 +107,17 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
NBTHelper.remove(stack, TAG_EXTRACTIONS); NBTHelper.remove(stack, TAG_EXTRACTIONS);
for (int i : arr) { for (int i : arr) {
if (i < 0) { if (i < 0) {
entity.sendMessage(new TranslatableComponent("hexcasting.debug.mana_withdrawn", entity.sendSystemMessage(Component.translatable("hexcasting.debug.mana_withdrawn",
stack.getDisplayName(), stack.getDisplayName(),
new TranslatableComponent("hexcasting.debug.all_mana").withStyle(ChatFormatting.GRAY)) Component.translatable("hexcasting.debug.all_mana").withStyle(ChatFormatting.GRAY))
.withStyle(ChatFormatting.LIGHT_PURPLE), Util.NIL_UUID); .withStyle(ChatFormatting.LIGHT_PURPLE));
} else { } else {
entity.sendMessage(new TranslatableComponent("hexcasting.debug.mana_withdrawn.with_dust", entity.sendSystemMessage(Component.translatable("hexcasting.debug.mana_withdrawn.with_dust",
stack.getDisplayName(), stack.getDisplayName(),
new TextComponent("" + i).withStyle(ChatFormatting.WHITE), Component.literal("" + i).withStyle(ChatFormatting.WHITE),
new TextComponent(String.format("%.2f", i * 1.0 / ManaConstants.DUST_UNIT)).withStyle( Component.literal(String.format("%.2f", i * 1.0 / ManaConstants.DUST_UNIT)).withStyle(
ChatFormatting.WHITE)) ChatFormatting.WHITE))
.withStyle(ChatFormatting.LIGHT_PURPLE), Util.NIL_UUID); .withStyle(ChatFormatting.LIGHT_PURPLE));
} }
} }
} }
@ -168,12 +169,12 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
Component emphasized = infiniteMedia(level); Component emphasized = infiniteMedia(level);
MutableComponent modName = new TranslatableComponent(prefix + "mod_name").withStyle( MutableComponent modName = Component.translatable(prefix + "mod_name").withStyle(
(s) -> s.withColor(HEX_COLOR)); (s) -> s.withColor(HEX_COLOR));
tooltipComponents.add( tooltipComponents.add(
new TranslatableComponent(prefix + "tooltip.0", emphasized).withStyle(ChatFormatting.GRAY)); Component.translatable(prefix + "tooltip.0", emphasized).withStyle(ChatFormatting.GRAY));
tooltipComponents.add(new TranslatableComponent(prefix + "tooltip.1", modName).withStyle(ChatFormatting.GRAY)); tooltipComponents.add(Component.translatable(prefix + "tooltip.1", modName).withStyle(ChatFormatting.GRAY));
} }
private static void addChildren(Advancement root, List<Advancement> out) { private static void addChildren(Advancement root, List<Advancement> out) {

View file

@ -30,7 +30,7 @@ public class ItemMediaBattery extends ItemMediaHolder {
@Override @Override
public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList<ItemStack> items) { public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList<ItemStack> items) {
// who was drunk at the wheel when they named this // who was drunk at the wheel when they named this
if (allowdedIn(tab)) { if (allowedIn(tab)) {
var manamounts = new int[]{ var manamounts = new int[]{
ManaConstants.CRYSTAL_UNIT, ManaConstants.CRYSTAL_UNIT,
20 * ManaConstants.CRYSTAL_UNIT, 20 * ManaConstants.CRYSTAL_UNIT,

View file

@ -5,7 +5,6 @@ import at.petrak.hexcasting.api.utils.ManaHelper;
import at.petrak.hexcasting.api.utils.NBTHelper; import at.petrak.hexcasting.api.utils.NBTHelper;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -77,10 +76,10 @@ public abstract class ItemMediaHolder extends Item implements MediaHolderItem {
TooltipFlag pIsAdvanced) { TooltipFlag pIsAdvanced) {
if (pIsAdvanced.isAdvanced() && getMaxMedia(pStack) > 0) { if (pIsAdvanced.isAdvanced() && getMaxMedia(pStack) > 0) {
pTooltipComponents.add( pTooltipComponents.add(
new TranslatableComponent("item.hexcasting.manaholder.amount", Component.translatable("item.hexcasting.manaholder.amount",
String.format("%,d", getMedia(pStack)), String.format("%,d", getMedia(pStack)),
String.format("%,d", getMaxMedia(pStack)), String.format("%,d", getMaxMedia(pStack)),
100f * getManaFullness(pStack)).withStyle(ChatFormatting.GRAY)); 100f * getManaFullness(pStack)).withStyle(ChatFormatting.GRAY));
} }
super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced); super.appendHoverText(pStack, pLevel, pTooltipComponents, pIsAdvanced);

View file

@ -98,7 +98,7 @@ public class HexBlocks {
BlockBehaviour.Properties.of(Material.GLASS, MaterialColor.NONE) BlockBehaviour.Properties.of(Material.GLASS, MaterialColor.NONE)
.sound(SoundType.AMETHYST) .sound(SoundType.AMETHYST)
.lightLevel((state) -> 15) .lightLevel((state) -> 15)
.noDrops() .noLootTable()
.isValidSpawn(HexBlocks::never) .isValidSpawn(HexBlocks::never)
.instabreak() .instabreak()
.noCollission() .noCollission()
@ -110,7 +110,7 @@ public class HexBlocks {
BlockBehaviour.Properties.of(Material.GLASS, MaterialColor.NONE) BlockBehaviour.Properties.of(Material.GLASS, MaterialColor.NONE)
.sound(SoundType.AMETHYST) .sound(SoundType.AMETHYST)
.lightLevel((state) -> 2) .lightLevel((state) -> 2)
.noDrops() .noLootTable()
.isValidSpawn(HexBlocks::never) .isValidSpawn(HexBlocks::never)
.instabreak() .instabreak()
.noOcclusion() .noOcclusion()

View file

@ -5,11 +5,16 @@ import at.petrak.hexcasting.common.command.ListPatternsCommand;
import at.petrak.hexcasting.common.command.RecalcPatternsCommand; import at.petrak.hexcasting.common.command.RecalcPatternsCommand;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
public class HexCommands { public class HexCommands {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) { public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
ListPatternsCommand.register(dispatcher); var mainCmd = Commands.literal("hexcasting");
RecalcPatternsCommand.register(dispatcher);
BrainsweepCommand.register(dispatcher); BrainsweepCommand.add(mainCmd);
ListPatternsCommand.add(mainCmd);
RecalcPatternsCommand.add(mainCmd);
dispatcher.register(mainCmd);
} }
} }

View file

@ -10,7 +10,6 @@ import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.FormattedCharSequence; import net.minecraft.util.FormattedCharSequence;
@ -136,11 +135,11 @@ public class HexIotaTypes {
public static Component getDisplay(CompoundTag tag) { public static Component getDisplay(CompoundTag tag) {
var type = getTypeFromTag(tag); var type = getTypeFromTag(tag);
if (type == null) { if (type == null) {
return TextComponent.EMPTY; return Component.empty();
} }
var data = tag.get(KEY_DATA); var data = tag.get(KEY_DATA);
if (data == null) { if (data == null) {
return TextComponent.EMPTY; return Component.empty();
} }
return type.display(data); return type.display(data);
} }

View file

@ -19,8 +19,7 @@ public class HexLootHandler {
public static final ResourceLocation TABLE_INJECT_AMETHYST_CLUSTER = modLoc("inject/amethyst_cluster"); public static final ResourceLocation TABLE_INJECT_AMETHYST_CLUSTER = modLoc("inject/amethyst_cluster");
public static void lootLoad(ResourceLocation id, public static void lootLoad(ResourceLocation id, Consumer<LootPool.Builder> addPool) {
Consumer<LootPool> addPool) {
if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) { if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) {
addPool.accept(getInjectPool(TABLE_INJECT_AMETHYST_CLUSTER)); addPool.accept(getInjectPool(TABLE_INJECT_AMETHYST_CLUSTER));
} else { } else {
@ -32,11 +31,10 @@ public class HexLootHandler {
} }
} }
public static LootPool getInjectPool(ResourceLocation entry) { public static LootPool.Builder getInjectPool(ResourceLocation entry) {
return LootPool.lootPool() return LootPool.lootPool()
.add(getInjectEntry(entry, 1)) .add(getInjectEntry(entry, 1))
.setBonusRolls(UniformGenerator.between(0, 1)) .setBonusRolls(UniformGenerator.between(0, 1));
.build();
} }
private static LootPoolEntryContainer.Builder<?> getInjectEntry(ResourceLocation table, int weight) { private static LootPoolEntryContainer.Builder<?> getInjectEntry(ResourceLocation table, int weight) {

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.common.loot; package at.petrak.hexcasting.common.loot;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.spell.math.HexPattern; import at.petrak.hexcasting.api.spell.math.HexPattern;
import at.petrak.hexcasting.common.items.ItemScroll; import at.petrak.hexcasting.common.items.ItemScroll;
import at.petrak.hexcasting.common.lib.HexLootFunctions; import at.petrak.hexcasting.common.lib.HexLootFunctions;
@ -22,14 +22,14 @@ public class PatternScrollFunc extends LootItemConditionalFunction {
@Override @Override
protected ItemStack run(ItemStack stack, LootContext ctx) { protected ItemStack run(ItemStack stack, LootContext ctx) {
var rand = ctx.getRandom(); var rand = ctx.getRandom();
var worldLookup = PatternRegistryBak.getPerWorldPatterns(ctx.getLevel()); var worldLookup = PatternRegistry.getPerWorldPatterns(ctx.getLevel());
var keys = worldLookup.keySet().stream().toList(); var keys = worldLookup.keySet().stream().toList();
var sig = keys.get(rand.nextInt(keys.size())); var sig = keys.get(rand.nextInt(keys.size()));
var entry = worldLookup.get(sig); var entry = worldLookup.get(sig);
var opId = entry.component1(); var opId = entry.getFirst();
var startDir = entry.component2(); var startDir = entry.getSecond();
var tag = new CompoundTag(); var tag = new CompoundTag();
tag.putString(ItemScroll.TAG_OP_ID, opId.toString()); tag.putString(ItemScroll.TAG_OP_ID, opId.toString());
tag.put(ItemScroll.TAG_PATTERN, HexPattern.fromAngles(sig, startDir).serializeToNBT()); tag.put(ItemScroll.TAG_PATTERN, HexPattern.fromAngles(sig, startDir).serializeToNBT());

View file

@ -5,6 +5,7 @@ import at.petrak.hexcasting.common.lib.HexBlocks;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.FeatureUtils; import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.util.RandomSource;
import net.minecraft.util.valueproviders.ConstantInt; import net.minecraft.util.valueproviders.ConstantInt;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.grower.AbstractTreeGrower; import net.minecraft.world.level.block.grower.AbstractTreeGrower;
@ -19,7 +20,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
import java.util.OptionalInt; import java.util.OptionalInt;
import java.util.Random;
public class AkashicTreeGrower extends AbstractTreeGrower { public class AkashicTreeGrower extends AbstractTreeGrower {
public static final AkashicTreeGrower INSTANCE = new AkashicTreeGrower(); public static final AkashicTreeGrower INSTANCE = new AkashicTreeGrower();
@ -48,7 +48,7 @@ public class AkashicTreeGrower extends AbstractTreeGrower {
@Nullable @Nullable
@Override @Override
protected Holder<? extends ConfiguredFeature<?, ?>> getConfiguredFeature(Random pRandom, boolean pLargeHive) { protected Holder<? extends ConfiguredFeature<?, ?>> getConfiguredFeature(RandomSource pRandom, boolean pLargeHive) {
return GROWERS.get(pRandom.nextInt(GROWERS.size())); return GROWERS.get(pRandom.nextInt(GROWERS.size()));
} }
} }

View file

@ -9,9 +9,8 @@ import at.petrak.hexcasting.common.lib.HexSounds;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
@ -25,7 +24,8 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
* Sent client->server when the client shift+scrolls with a shift-scrollable item * Sent client->server when the client shift+scrolls with a shift-scrollable item
* or scrolls in the spellcasting UI. * or scrolls in the spellcasting UI.
*/ */
public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boolean isCtrl, boolean invertSpellbook, boolean invertAbacus) implements IMessage { public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boolean isCtrl, boolean invertSpellbook,
boolean invertAbacus) implements IMessage {
public static final ResourceLocation ID = modLoc("scroll"); public static final ResourceLocation ID = modLoc("scroll");
@Override @Override
@ -84,30 +84,30 @@ public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boole
MutableComponent component; MutableComponent component;
if (hand == InteractionHand.OFF_HAND && stack.hasCustomHoverName()) { if (hand == InteractionHand.OFF_HAND && stack.hasCustomHoverName()) {
if (sealed) { if (sealed) {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name.sealed", component = Component.translatable("hexcasting.tooltip.spellbook.page_with_name.sealed",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TextComponent("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC) Component.literal("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC)
.append(stack.getHoverName()), .append(stack.getHoverName()),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD)); Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
} else { } else {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name", component = Component.translatable("hexcasting.tooltip.spellbook.page_with_name",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TextComponent("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC) Component.literal("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC)
.append(stack.getHoverName())); .append(stack.getHoverName()));
} }
} else { } else {
if (sealed) { if (sealed) {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page.sealed", component = Component.translatable("hexcasting.tooltip.spellbook.page.sealed",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD)); Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
} else { } else {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page", component = Component.translatable("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE), Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE)); Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE));
} }
} }
@ -146,7 +146,7 @@ public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boole
if (datumTag != null) { if (datumTag != null) {
var popup = HexIotaTypes.getDisplay(datumTag); var popup = HexIotaTypes.getDisplay(datumTag);
sender.displayClientMessage( sender.displayClientMessage(
new TranslatableComponent("hexcasting.tooltip.abacus", popup).withStyle(ChatFormatting.GREEN), true); Component.translatable("hexcasting.tooltip.abacus", popup).withStyle(ChatFormatting.GREEN), true);
} }
} }
} }

View file

@ -5,7 +5,6 @@ import com.google.gson.JsonObject;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
@ -67,7 +66,7 @@ public class StateIngredientBlockState implements StateIngredient {
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked", "rawtypes"})
String name = ((Property) key).getName(entry.getValue()); String name = ((Property) key).getName(entry.getValue());
tooltip.add(new TextComponent(key.getName() + " = " + name).withStyle(ChatFormatting.GRAY)); tooltip.add(Component.literal(key.getName() + " = " + name).withStyle(ChatFormatting.GRAY));
} }
return tooltip; return tooltip;
} }

View file

@ -7,8 +7,6 @@ import net.minecraft.core.Registry;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper; import net.minecraft.util.GsonHelper;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
@ -40,35 +38,37 @@ public record VillagerIngredient(
} }
public Component name() { public Component name() {
MutableComponent component = new TextComponent(""); MutableComponent component = Component.literal("");
boolean addedAny = false; boolean addedAny = false;
if (minLevel >= 5) { if (minLevel >= 5) {
component.append(new TranslatableComponent("merchant.level.5")); component.append(Component.translatable("merchant.level.5"));
addedAny = true; addedAny = true;
} else if (minLevel > 1) { } else if (minLevel > 1) {
component.append(new TranslatableComponent("merchant.level." + minLevel)); component.append(Component.translatable("merchant.level." + minLevel));
addedAny = true; addedAny = true;
} else if (profession != null) { } else if (profession != null) {
component.append(new TranslatableComponent("merchant.level.1")); component.append(Component.translatable("merchant.level.1"));
addedAny = true; addedAny = true;
} }
if (biome != null) { if (biome != null) {
if (addedAny) if (addedAny) {
component.append(" "); component.append(" ");
component.append(new TranslatableComponent("biome.minecraft." + biome.getPath())); }
component.append(Component.translatable("biome.minecraft." + biome.getPath()));
addedAny = true; addedAny = true;
} }
if (profession != null) { if (profession != null) {
// We've for sure added something // We've for sure added something
component.append(" "); component.append(" ");
component.append(new TranslatableComponent("entity.minecraft.villager." + profession.getPath())); component.append(Component.translatable("entity.minecraft.villager." + profession.getPath()));
} else { } else {
if (addedAny) if (addedAny) {
component.append(" "); component.append(" ");
}
component.append(EntityType.VILLAGER.getDescription()); component.append(EntityType.VILLAGER.getDescription());
} }
@ -86,20 +86,24 @@ public record VillagerIngredient(
if (advanced) { if (advanced) {
if (orHigher) { if (orHigher) {
if (minLevel >= 5) { if (minLevel >= 5) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.level", 5).withStyle(ChatFormatting.DARK_GRAY)); tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", 5)
.withStyle(ChatFormatting.DARK_GRAY));
} else if (minLevel > 1) { } else if (minLevel > 1) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.min_level", minLevel).withStyle(ChatFormatting.DARK_GRAY)); tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.min_level", minLevel)
.withStyle(ChatFormatting.DARK_GRAY));
} }
} else if (profession != null || minLevel > 1) { } else if (profession != null || minLevel > 1) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.level", Mth.clamp(minLevel, 1, 5)).withStyle(ChatFormatting.DARK_GRAY)); tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.level", Mth.clamp(minLevel, 1, 5))
.withStyle(ChatFormatting.DARK_GRAY));
} }
if (biome != null) { if (biome != null) {
tooltip.add(new TextComponent(biome.toString()).withStyle(ChatFormatting.DARK_GRAY)); tooltip.add(Component.literal(biome.toString()).withStyle(ChatFormatting.DARK_GRAY));
} }
ResourceLocation displayId = Objects.requireNonNullElseGet(profession, () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); ResourceLocation displayId = Objects.requireNonNullElseGet(profession,
tooltip.add(new TextComponent(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER));
tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY));
} }
tooltip.add(getModNameComponent()); tooltip.add(getModNameComponent());
@ -110,7 +114,7 @@ public record VillagerIngredient(
public Component getModNameComponent() { public Component getModNameComponent() {
String namespace = profession == null ? "minecraft" : profession.getNamespace(); String namespace = profession == null ? "minecraft" : profession.getNamespace();
String mod = IXplatAbstractions.INSTANCE.getModName(namespace); String mod = IXplatAbstractions.INSTANCE.getModName(namespace);
return new TextComponent(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC); return Component.literal(mod).withStyle(ChatFormatting.BLUE, ChatFormatting.ITALIC);
} }
public JsonObject serialize() { public JsonObject serialize() {

View file

@ -14,8 +14,7 @@ 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.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
@ -33,8 +32,8 @@ public class HexAdvancements extends PaucalAdvancementProvider {
// what an ergonomic design decision // what an ergonomic design decision
// i am so happy that data generators are the future // i am so happy that data generators are the future
.display(new DisplayInfo(new ItemStack(Items.BUDDING_AMETHYST), .display(new DisplayInfo(new ItemStack(Items.BUDDING_AMETHYST),
new TranslatableComponent("advancement.hexcasting:root"), Component.translatable("advancement.hexcasting:root"),
new TranslatableComponent("advancement.hexcasting:root.desc"), Component.translatable("advancement.hexcasting:root.desc"),
new ResourceLocation("minecraft", "textures/block/calcite.png"), new ResourceLocation("minecraft", "textures/block/calcite.png"),
FrameType.TASK, true, true, true)) FrameType.TASK, true, true, true))
// the only thing making this vaguely tolerable is the knowledge the json files are worse somehow // the only thing making this vaguely tolerable is the knowledge the json files are worse somehow
@ -78,8 +77,8 @@ public class HexAdvancements extends PaucalAdvancementProvider {
Advancement.Builder.advancement() Advancement.Builder.advancement()
.display(new DisplayInfo(new ItemStack(Items.MUSIC_DISC_11), .display(new DisplayInfo(new ItemStack(Items.MUSIC_DISC_11),
new TranslatableComponent("advancement.hexcasting:enlightenment"), Component.translatable("advancement.hexcasting:enlightenment"),
new TranslatableComponent("advancement.hexcasting:enlightenment.desc"), Component.translatable("advancement.hexcasting:enlightenment.desc"),
null, null,
FrameType.CHALLENGE, true, true, true)) FrameType.CHALLENGE, true, true, true))
.parent(opened_eyes) .parent(opened_eyes)
@ -101,7 +100,7 @@ public class HexAdvancements extends PaucalAdvancementProvider {
for (var advId : ItemLoreFragment.NAMES) { for (var advId : ItemLoreFragment.NAMES) {
Advancement.Builder.advancement() Advancement.Builder.advancement()
.display(new DisplayInfo(new ItemStack(HexItems.LORE_FRAGMENT), .display(new DisplayInfo(new ItemStack(HexItems.LORE_FRAGMENT),
new TranslatableComponent("advancement." + advId), TextComponent.EMPTY, Component.translatable("advancement." + advId), Component.empty(),
null, FrameType.TASK, true, true, true)) null, FrameType.TASK, true, true, true))
.parent(loreRoot) .parent(loreRoot)
.addCriterion(ItemLoreFragment.CRITEREON_KEY, new ImpossibleTrigger.TriggerInstance()) .addCriterion(ItemLoreFragment.CRITEREON_KEY, new ImpossibleTrigger.TriggerInstance())

View file

@ -81,9 +81,4 @@ public class HexBlockTagProvider extends PaucalBlockTagProvider {
tag(BlockTags.WOODEN_BUTTONS) tag(BlockTags.WOODEN_BUTTONS)
.add(HexBlocks.EDIFIED_BUTTON); .add(HexBlocks.EDIFIED_BUTTON);
} }
@Override
public String getName() {
return "Hexcasting Block Tags";
}
} }

View file

@ -49,9 +49,4 @@ public class HexItemTagProvider extends PaucalItemTagProvider {
this.copy(BlockTags.BUTTONS, ItemTags.BUTTONS); this.copy(BlockTags.BUTTONS, ItemTags.BUTTONS);
this.copy(BlockTags.WOODEN_BUTTONS, ItemTags.WOODEN_BUTTONS); this.copy(BlockTags.WOODEN_BUTTONS, ItemTags.WOODEN_BUTTONS);
} }
@Override
public String getName() {
return "Hexcasting Item Tags";
}
} }

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.interop.patchouli; package at.petrak.hexcasting.interop.patchouli;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.spell.math.HexCoord; import at.petrak.hexcasting.api.spell.math.HexCoord;
import at.petrak.hexcasting.api.spell.math.HexPattern; import at.petrak.hexcasting.api.spell.math.HexPattern;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -23,9 +23,9 @@ public class LookupPatternComponent extends AbstractPatternComponent {
@Override @Override
public List<Pair<HexPattern, HexCoord>> getPatterns(UnaryOperator<IVariable> lookup) { public List<Pair<HexPattern, HexCoord>> getPatterns(UnaryOperator<IVariable> lookup) {
var entry = PatternRegistryBak.lookupPattern(this.opName); var entry = PatternRegistry.lookupPattern(this.opName);
this.strokeOrder = !entry.isPerWorld(); this.strokeOrder = !entry.isPerWorld();
return List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())); return List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin()));
} }
@Override @Override

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.interop.pehkui; package at.petrak.hexcasting.interop.pehkui;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.spell.math.HexDir; import at.petrak.hexcasting.api.spell.math.HexDir;
import at.petrak.hexcasting.api.spell.math.HexPattern; import at.petrak.hexcasting.api.spell.math.HexPattern;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -10,11 +10,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class PehkuiInterop { public class PehkuiInterop {
public static void init() { public static void init() {
try { try {
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST),
modLoc("interop/pehkui/get"), OpGetScale.INSTANCE); modLoc("interop/pehkui/get"), OpGetScale.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("ddwdwwdwwd", HexDir.NORTH_EAST),
modLoc("interop/pehkui/set"), OpSetScale.INSTANCE); modLoc("interop/pehkui/set"), OpSetScale.INSTANCE);
} catch (PatternRegistryBak.RegisterPatternException e) { } catch (PatternRegistry.RegisterPatternException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View file

@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
@ -16,35 +17,33 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Random;
@Mixin(ClientLevel.class) @Mixin(ClientLevel.class)
public abstract class MixinClientLevel { public abstract class MixinClientLevel {
@Inject(method = "doAnimateTick", @Inject(method = "doAnimateTick",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/Block;animateTick(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Ljava/util/Random;)V"), at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/Block;animateTick(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/util/RandomSource;)V"),
locals = LocalCapture.CAPTURE_FAILSOFT) locals = LocalCapture.CAPTURE_FAILSOFT)
public void addBuddingAmethystParticles(int baseX, int baseY, int baseZ, int range, Random rand, Block marked, BlockPos.MutableBlockPos pos, CallbackInfo ci, public void addBuddingAmethystParticles(int $$0, int $$1, int $$2, int $$3, RandomSource rand, Block $$5,
int trueX, int trueY, int trueZ, BlockState state) { BlockPos.MutableBlockPos pos, CallbackInfo ci, int trueX, int trueY, int trueZ, BlockState state) {
ClientLevel self = ((ClientLevel) (Object) this); ClientLevel self = ((ClientLevel) (Object) this);
if (state.is(Blocks.BUDDING_AMETHYST)) { if (state.is(Blocks.BUDDING_AMETHYST)) {
ParticleOptions options = new ConjureParticleOptions(0x8932b8, true); ParticleOptions options = new ConjureParticleOptions(0x8932b8, true);
Vec3 center = Vec3.atCenterOf(pos); Vec3 center = Vec3.atCenterOf(pos);
for (Direction direction : Direction.values()) { for (Direction direction : Direction.values()) {
int dX = direction.getStepX(); int dX = direction.getStepX();
int dY = direction.getStepY(); int dY = direction.getStepY();
int dZ = direction.getStepZ(); int dZ = direction.getStepZ();
int count = rand.nextInt(10) / 5; int count = rand.nextInt(10) / 5;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
double pX = center.x + (dX == 0 ? Mth.nextDouble(rand, -0.5D, 0.5D) : (double) dX * 0.55D); double pX = center.x + (dX == 0 ? Mth.nextDouble(rand, -0.5D, 0.5D) : (double) dX * 0.55D);
double pY = center.y + (dY == 0 ? Mth.nextDouble(rand, -0.5D, 0.5D) : (double) dY * 0.55D); double pY = center.y + (dY == 0 ? Mth.nextDouble(rand, -0.5D, 0.5D) : (double) dY * 0.55D);
double pZ = center.z + (dZ == 0 ? Mth.nextDouble(rand, -0.5D, 0.5D) : (double) dZ * 0.55D); double pZ = center.z + (dZ == 0 ? Mth.nextDouble(rand, -0.5D, 0.5D) : (double) dZ * 0.55D);
self.addParticle(options, pX, pY, pZ, 0, 0, 0); self.addParticle(options, pX, pY, pZ, 0, 0, 0);
} }
} }
} }
} }
} }

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version "$loomVersion" id 'fabric-loom' // version "1.0-SNAPSHOT"
} }
archivesBaseName = getArtifactID("fabric") archivesBaseName = getArtifactID("fabric")
@ -74,9 +74,9 @@ dependencies {
modImplementation "com.jamieswhiteshirt:reach-entity-attributes:2.1.1" modImplementation "com.jamieswhiteshirt:reach-entity-attributes:2.1.1"
include "com.jamieswhiteshirt:reach-entity-attributes:2.1.1" include "com.jamieswhiteshirt:reach-entity-attributes:2.1.1"
// TODO(yrsegal): do whatever it is you did with this on 1.18, on 1.19 // apparently the 1.18 version Just Works on 1.19
// modImplementation "io.github.tropheusj:serialization-hooks:$serializationHooksVersion" modImplementation "io.github.tropheusj:serialization-hooks:$serializationHooksVersion"
// include "io.github.tropheusj:serialization-hooks:$serializationHooksVersion" include "io.github.tropheusj:serialization-hooks:$serializationHooksVersion"
// Optional integrations // Optional integrations

View file

@ -1,10 +1,9 @@
loomVersion=0.11-SNAPSHOT
fabricVersion=0.64.0+1.19.2 fabricVersion=0.64.0+1.19.2
fabricLoaderVersion=0.14.10 fabricLoaderVersion=0.14.10
fiberVersion=0.23.0-2 fiberVersion=0.23.0-2
cardinalComponentsVersion=5.0.2 cardinalComponentsVersion=5.0.2
serializationHooksVersion=0.3.24
emiVersion=0.4.0+1.19 emiVersion=0.4.0+1.19
gravityApiVersion=0.7.12+fabric gravityApiVersion=0.7.12+fabric

View file

@ -21,14 +21,14 @@ import at.petrak.hexcasting.fabric.storage.FabricImpetusStorage
import at.petrak.hexcasting.interop.HexInterop import at.petrak.hexcasting.interop.HexInterop
import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer import io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer
import net.fabricmc.api.ModInitializer import net.fabricmc.api.ModInitializer
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents
import net.fabricmc.fabric.api.event.player.AttackBlockCallback import net.fabricmc.fabric.api.event.player.AttackBlockCallback
import net.fabricmc.fabric.api.event.player.UseEntityCallback import net.fabricmc.fabric.api.event.player.UseEntityCallback
import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback import net.fabricmc.fabric.api.loot.v2.LootTableEvents
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry import net.fabricmc.fabric.api.registry.FlammableBlockRegistry
import net.minecraft.commands.synchronization.ArgumentTypes import net.minecraft.commands.synchronization.SingletonArgumentInfo
import net.minecraft.commands.synchronization.EmptyArgumentSerializer
import net.minecraft.core.Registry import net.minecraft.core.Registry
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.InteractionResult import net.minecraft.world.InteractionResult
@ -43,10 +43,10 @@ object FabricHexInitializer : ModInitializer {
initRegistries() initRegistries()
ArgumentTypes.register( ArgumentTypeRegistry.registerArgumentType(
"hexcasting:pattern", modLoc("pattern"),
PatternResLocArgument::class.java, PatternResLocArgument::class.java,
EmptyArgumentSerializer { PatternResLocArgument.id() } SingletonArgumentInfo.contextFree { PatternResLocArgument.id() }
) )
RegisterPatterns.registerPatterns() RegisterPatterns.registerPatterns()
HexAdvancementTriggers.registerTriggers() HexAdvancementTriggers.registerTriggers()
@ -73,12 +73,10 @@ object FabricHexInitializer : ModInitializer {
ServerTickEvents.END_WORLD_TICK.register(PlayerPositionRecorder::updateAllPlayers) ServerTickEvents.END_WORLD_TICK.register(PlayerPositionRecorder::updateAllPlayers)
CommandRegistrationCallback.EVENT.register { dp, _ -> HexCommands.register(dp) } CommandRegistrationCallback.EVENT.register { dp, _, _ -> HexCommands.register(dp) }
LootTableLoadingCallback.EVENT.register { _, _, id, supplier, _ -> LootTableEvents.MODIFY.register { _, _, id, supplier, _ ->
HexLootHandler.lootLoad( HexLootHandler.lootLoad(id, supplier::withPool)
id,
) { supplier.withPool(it) }
} }
} }

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.fabric.interop.emi; package at.petrak.hexcasting.fabric.interop.emi;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.spell.math.HexCoord; import at.petrak.hexcasting.api.spell.math.HexCoord;
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil; import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
import at.petrak.hexcasting.interop.utils.PatternEntry; import at.petrak.hexcasting.interop.utils.PatternEntry;
@ -25,7 +25,7 @@ public class PatternRendererEMI implements EmiRenderable {
private final List<Vec2> pathfinderDots; private final List<Vec2> pathfinderDots;
public PatternRendererEMI(ResourceLocation pattern, int w, int h) { public PatternRendererEMI(ResourceLocation pattern, int w, int h) {
var entry = PatternRegistryBak.lookupPattern(pattern); var entry = PatternRegistry.lookupPattern(pattern);
this.strokeOrder = !entry.isPerWorld(); this.strokeOrder = !entry.isPerWorld();
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin()))); var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
this.patterns = data.patterns(); this.patterns = data.patterns();

View file

@ -19,8 +19,6 @@ import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.Villager;
@ -34,181 +32,184 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
import static at.petrak.hexcasting.client.RenderLib.renderEntity; import static at.petrak.hexcasting.client.RenderLib.renderEntity;
public class VillagerEmiStack extends EmiStack { public class VillagerEmiStack extends EmiStack {
private final VillagerEntry entry; private final VillagerEntry entry;
public final VillagerIngredient ingredient; public final VillagerIngredient ingredient;
public final boolean mindless; public final boolean mindless;
private final ResourceLocation id; private final ResourceLocation id;
public VillagerEmiStack(VillagerIngredient villager) { public VillagerEmiStack(VillagerIngredient villager) {
this(villager, false); this(villager, false);
} }
public VillagerEmiStack(VillagerIngredient villager, boolean mindless) { public VillagerEmiStack(VillagerIngredient villager, boolean mindless) {
this(villager, mindless, 1); this(villager, mindless, 1);
} }
public VillagerEmiStack(VillagerIngredient villager, boolean mindless, long amount) { public VillagerEmiStack(VillagerIngredient villager, boolean mindless, long amount) {
entry = new VillagerEntry(new VillagerVariant(villager, mindless)); entry = new VillagerEntry(new VillagerVariant(villager, mindless));
this.ingredient = villager; this.ingredient = villager;
this.mindless = mindless; this.mindless = mindless;
this.amount = amount; this.amount = amount;
// This is so scuffed // This is so scuffed
this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless) this.id = modLoc((Objects.toString(villager.profession()) + villager.minLevel() + mindless)
.replace(':', '-')); .replace(':', '-'));
} }
public static EmiIngredient atLevelOrHigher(VillagerIngredient ingredient, boolean remainder) { public static EmiIngredient atLevelOrHigher(VillagerIngredient ingredient, boolean remainder) {
if (ingredient.profession() == null) { if (ingredient.profession() == null) {
return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream() return EmiIngredient.of(Registry.VILLAGER_PROFESSION.stream()
.filter(it -> !((AccessorPoiType) it.getJobPoiType()).hex$matchingStates().isEmpty()) .filter(it -> !((AccessorPoiType) it.getJobPoiType()).hex$matchingStates().isEmpty())
.map(it -> atLevelOrHigher(new VillagerIngredient(Registry.VILLAGER_PROFESSION.getKey(it), .map(it -> atLevelOrHigher(new VillagerIngredient(Registry.VILLAGER_PROFESSION.getKey(it),
ingredient.biome(), ingredient.minLevel()), true)) ingredient.biome(), ingredient.minLevel()), true))
.toList()); .toList());
} }
VillagerEmiStack stack = new VillagerEmiStack(ingredient).orHigher(true); VillagerEmiStack stack = new VillagerEmiStack(ingredient).orHigher(true);
if (remainder) { if (remainder) {
stack.setRemainder(new VillagerEmiStack(ingredient, true)); stack.setRemainder(new VillagerEmiStack(ingredient, true));
} }
return stack; return stack;
} }
private boolean orHigher = false; private boolean orHigher = false;
public VillagerEmiStack orHigher(boolean orHigher) { public VillagerEmiStack orHigher(boolean orHigher) {
this.orHigher = orHigher; this.orHigher = orHigher;
return this; return this;
} }
@Override @Override
public EmiStack copy() { public EmiStack copy() {
VillagerEmiStack e = new VillagerEmiStack(ingredient, mindless, amount); VillagerEmiStack e = new VillagerEmiStack(ingredient, mindless, amount);
e.orHigher(orHigher).setRemainder(getRemainder().copy()); e.orHigher(orHigher).setRemainder(getRemainder().copy());
e.comparison = comparison; e.comparison = comparison;
return e; return e;
} }
@Override @Override
public boolean isEmpty() { public boolean isEmpty() {
return amount == 0; return amount == 0;
} }
@Override @Override
public CompoundTag getNbt() { public CompoundTag getNbt() {
return null; return null;
} }
@Override @Override
public Object getKey() { public Object getKey() {
return id; return id;
} }
@Override @Override
public Entry<?> getEntry() { public Entry<?> getEntry() {
return entry; return entry;
} }
@Override @Override
public ResourceLocation getId() { public ResourceLocation getId() {
return id; return id;
} }
@Override @Override
public List<Component> getTooltipText() { public List<Component> getTooltipText() {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
boolean advanced = mc.options.advancedItemTooltips; boolean advanced = mc.options.advancedItemTooltips;
if (mindless) { if (mindless) {
List<Component> tooltip = new ArrayList<>(); List<Component> tooltip = new ArrayList<>();
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.product")); tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.product"));
if (advanced) { if (advanced) {
if (ingredient.biome() != null) { if (ingredient.biome() != null) {
tooltip.add(new TextComponent(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY)); tooltip.add(Component.literal(ingredient.biome().toString()).withStyle(ChatFormatting.DARK_GRAY));
} }
ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(), () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER)); ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(),
tooltip.add(new TextComponent(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY)); () -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER));
} tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY));
}
tooltip.add(ingredient.getModNameComponent()); tooltip.add(ingredient.getModNameComponent());
return tooltip; return tooltip;
} }
return ingredient.getTooltip(advanced, orHigher); return ingredient.getTooltip(advanced, orHigher);
} }
@Override @Override
public List<ClientTooltipComponent> getTooltip() { public List<ClientTooltipComponent> getTooltip() {
List<ClientTooltipComponent> list = getTooltipText().stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create) List<ClientTooltipComponent> list = getTooltipText().stream()
.collect(Collectors.toList()); .map(Component::getVisualOrderText)
if (!getRemainder().isEmpty()) { .map(ClientTooltipComponent::create)
list.add(EmiTooltipComponents.getRemainderTooltipComponent(this)); .collect(Collectors.toList());
} if (!getRemainder().isEmpty()) {
return list; list.add(EmiTooltipComponents.getRemainderTooltipComponent(this));
} }
return list;
}
@Override @Override
public Component getName() { public Component getName() {
return ingredient.name(); return ingredient.name();
} }
@Override @Override
public void render(PoseStack poseStack, int x, int y, float delta, int flags) { public void render(PoseStack poseStack, int x, int y, float delta, int flags) {
if ((flags & RENDER_ICON) != 0) { if ((flags & RENDER_ICON) != 0) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
ClientLevel level = mc.level; ClientLevel level = mc.level;
if (level != null) { if (level != null) {
Villager villager = RenderLib.prepareVillagerForRendering(ingredient, level); Villager villager = RenderLib.prepareVillagerForRendering(ingredient, level);
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0, renderEntity(poseStack, villager, level, x + 8, y + 16, ClientTickCounter.getTotal(), 8, 0,
mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it); mindless ? (it) -> new FakeBufferSource(it, HexRenderTypes::getGrayscaleLayer) : it -> it);
} }
} }
if ((flags & RENDER_REMAINDER) != 0) { if ((flags & RENDER_REMAINDER) != 0) {
EmiRender.renderRemainderIcon(this, poseStack, x, y); EmiRender.renderRemainderIcon(this, poseStack, x, y);
} }
} }
public static class VillagerEntry extends EmiStack.Entry<VillagerVariant> { public static class VillagerEntry extends EmiStack.Entry<VillagerVariant> {
public VillagerEntry(VillagerVariant variant) { public VillagerEntry(VillagerVariant variant) {
super(variant); super(variant);
} }
@Override @Override
public Class<? extends VillagerVariant> getType() { public Class<? extends VillagerVariant> getType() {
return VillagerVariant.class; return VillagerVariant.class;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if(!(obj instanceof VillagerEntry e)) { if (!(obj instanceof VillagerEntry e)) {
return false; return false;
} }
VillagerVariant self = getValue(); VillagerVariant self = getValue();
VillagerVariant other = e.getValue(); VillagerVariant other = e.getValue();
ResourceLocation selfBiome = self.ingredient().biome(); ResourceLocation selfBiome = self.ingredient().biome();
ResourceLocation otherBiome = other.ingredient().biome(); ResourceLocation otherBiome = other.ingredient().biome();
if (selfBiome != null && otherBiome != null && !selfBiome.equals(otherBiome)) { if (selfBiome != null && otherBiome != null && !selfBiome.equals(otherBiome)) {
return false; return false;
} }
ResourceLocation selfProfession = self.ingredient().profession(); ResourceLocation selfProfession = self.ingredient().profession();
ResourceLocation otherProfession = other.ingredient().profession(); ResourceLocation otherProfession = other.ingredient().profession();
if (selfProfession != null && otherProfession != null && !selfProfession.equals(otherProfession)) { if (selfProfession != null && otherProfession != null && !selfProfession.equals(otherProfession)) {
return false; return false;
} }
return self.ingredient().minLevel() == other.ingredient().minLevel() && self.mindless() == other.mindless(); return self.ingredient().minLevel() == other.ingredient().minLevel() && self.mindless() == other.mindless();
} }
} }
} }

View file

@ -1,6 +1,6 @@
package at.petrak.hexcasting.fabric.interop.gravity; package at.petrak.hexcasting.fabric.interop.gravity;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.spell.math.HexDir; import at.petrak.hexcasting.api.spell.math.HexDir;
import at.petrak.hexcasting.api.spell.math.HexPattern; import at.petrak.hexcasting.api.spell.math.HexPattern;
@ -9,11 +9,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class GravityApiInterop { public class GravityApiInterop {
public static void init() { public static void init() {
try { try {
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST), PatternRegistry.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST),
modLoc("interop/gravity/get"), OpGetGravity.INSTANCE); modLoc("interop/gravity/get"), OpGetGravity.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST), PatternRegistry.mapPattern(HexPattern.fromAngles("wdwdwaaqw", HexDir.NORTH_WEST),
modLoc("interop/gravity/set"), OpChangeGravity.INSTANCE); modLoc("interop/gravity/set"), OpChangeGravity.INSTANCE);
} catch (PatternRegistryBak.RegisterPatternException e) { } catch (PatternRegistry.RegisterPatternException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View file

@ -3,7 +3,7 @@ package at.petrak.hexcasting.fabric.interop.gravity
import at.petrak.hexcasting.api.spell.* import at.petrak.hexcasting.api.spell.*
import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.iota.Iota
import me.andrew.gravitychanger.api.GravityChangerAPI import com.fusionflux.gravity_api.api.GravityChangerAPI
import net.minecraft.core.Direction import net.minecraft.core.Direction
import net.minecraft.world.entity.Entity import net.minecraft.world.entity.Entity
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3

View file

@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.asActionResult
import at.petrak.hexcasting.api.spell.casting.CastingContext import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.spell.getEntity import at.petrak.hexcasting.api.spell.getEntity
import at.petrak.hexcasting.api.spell.iota.Iota import at.petrak.hexcasting.api.spell.iota.Iota
import me.andrew.gravitychanger.api.GravityChangerAPI import com.fusionflux.gravity_api.api.GravityChangerAPI
import net.minecraft.world.phys.Vec3 import net.minecraft.world.phys.Vec3
object OpGetGravity : ConstManaAction { object OpGetGravity : ConstManaAction {

View file

@ -1,75 +0,0 @@
package at.petrak.hexcasting.fabric.interop.rei;
import com.mojang.blaze3d.systems.RenderSystem;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.Renderer;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class BrainsweepRecipeCategory implements DisplayCategory<BrainsweepRecipeDisplay> {
private final ResourceLocation OVERLAY = modLoc("textures/gui/brainsweep.png");
private final Renderer icon;
private final Component localizedName;
public BrainsweepRecipeCategory() {
var brainsweep = modLoc("brainsweep");
localizedName = new TranslatableComponent("hexcasting.spell." + brainsweep);
icon = new PatternRendererREI(brainsweep, 16, 16);
}
@Override
public Renderer getIcon() {
return icon;
}
@Override
public @NotNull Component getTitle() {
return localizedName;
}
@Override
public List<Widget> setupDisplay(BrainsweepRecipeDisplay display, Rectangle bounds) {
List<Widget> widgets = new ArrayList<>();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createDrawableWidget(((helper, matrices, mouseX, mouseY, delta) -> {
RenderSystem.enableBlend();
RenderSystem.setShaderTexture(0, OVERLAY);
GuiComponent.blit(matrices, bounds.getMinX(), bounds.getMinY(), 0, 0, 118, 85, 128, 128);
RenderSystem.disableBlend();
})));
widgets.add(new VillagerWidget(display.recipe.villagerIn(), bounds.getMinX(), bounds.getMinY()));
widgets.add(Widgets.createSlot(new Point(bounds.getMinX() + 12, bounds.getMinY() + 35)).entries(display.getInputEntries().get(0)).disableBackground());
widgets.add(Widgets.createSlot(new Point(bounds.getMinX() + 87, bounds.getMinY() + 35)).entries(display.getOutputEntries().get(0)).disableBackground());
return widgets;
}
@Override
public CategoryIdentifier<? extends BrainsweepRecipeDisplay> getCategoryIdentifier() {
return HexREIPlugin.BRAINSWEEP;
}
@Override
public int getDisplayHeight() {
return 85;
}
@Override
public int getDisplayWidth(BrainsweepRecipeDisplay display) {
return 118;
}
}

View file

@ -1,45 +0,0 @@
package at.petrak.hexcasting.fabric.interop.rei;
import at.petrak.hexcasting.common.recipe.BrainsweepRecipe;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.resources.ResourceLocation;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
public class BrainsweepRecipeDisplay implements Display {
protected final BrainsweepRecipe recipe;
protected EntryIngredient inputs;
protected EntryIngredient outputs;
public BrainsweepRecipeDisplay(BrainsweepRecipe recipe) {
this.recipe = recipe;
this.inputs = EntryIngredients.ofItemStacks(recipe.blockIn().getDisplayedStacks());
this.outputs = EntryIngredients.of(recipe.result().getBlock());
}
@Override
public @Nonnull List<EntryIngredient> getInputEntries() {
return Collections.singletonList(this.inputs);
}
@Override
public @Nonnull List<EntryIngredient> getOutputEntries() {
return Collections.singletonList(this.outputs);
}
@Override
public @Nonnull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(this.recipe).map(BrainsweepRecipe::getId);
}
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return HexREIPlugin.BRAINSWEEP;
}
}

View file

@ -1,46 +0,0 @@
package at.petrak.hexcasting.fabric.interop.rei;
import at.petrak.hexcasting.common.lib.HexItems;
import at.petrak.hexcasting.common.recipe.BrainsweepRecipe;
import com.google.common.collect.ImmutableSet;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.ItemLike;
import java.util.Set;
import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class HexREIPlugin implements REIClientPlugin {
public static final ResourceLocation UID = modLoc("brainsweep");
public static final CategoryIdentifier<BrainsweepRecipeDisplay> BRAINSWEEP = CategoryIdentifier.of(UID);
@Override
public void registerCategories(CategoryRegistry registry) {
registry.add(new BrainsweepRecipeCategory());
Set<ItemLike> wands = ImmutableSet.of(
HexItems.STAFF_OAK,
HexItems.STAFF_SPRUCE,
HexItems.STAFF_BIRCH,
HexItems.STAFF_JUNGLE,
HexItems.STAFF_ACACIA,
HexItems.STAFF_DARK_OAK,
HexItems.STAFF_CRIMSON,
HexItems.STAFF_WARPED,
HexItems.STAFF_EDIFIED);
for (ItemLike wand : wands) {
registry.addWorkstations(BRAINSWEEP, EntryStacks.of(wand));
}
registry.removePlusButton(BRAINSWEEP);
}
@Override
public void registerDisplays(DisplayRegistry helper) {
helper.registerFiller(BrainsweepRecipe.class, BrainsweepRecipeDisplay::new);
}
}

View file

@ -1,65 +0,0 @@
package at.petrak.hexcasting.fabric.interop.rei;
import at.petrak.hexcasting.api.PatternRegistryBak;
import at.petrak.hexcasting.api.spell.math.HexCoord;
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
import at.petrak.hexcasting.interop.utils.PatternEntry;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.datafixers.util.Pair;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.Renderer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec2;
import java.util.List;
public class PatternRendererREI implements Renderer {
private final long startTime = System.currentTimeMillis();
private final int width;
private final int height;
private final boolean strokeOrder;
private final List<PatternEntry> patterns;
private final List<Vec2> pathfinderDots;
public PatternRendererREI(ResourceLocation pattern, int w, int h) {
var entry = PatternRegistryBak.lookupPattern(pattern);
this.strokeOrder = !entry.isPerWorld();
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
this.patterns = data.patterns();
this.pathfinderDots = data.pathfinderDots();
this.width = w;
this.height = h;
}
@Environment(EnvType.CLIENT)
private int blitOffset;
@Override
@Environment(EnvType.CLIENT)
public int getZ() {
return blitOffset;
}
@Override
@Environment(EnvType.CLIENT)
public void setZ(int z) {
this.blitOffset = z;
}
@Override
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
long time = (System.currentTimeMillis() - startTime) / 50;
matrices.pushPose();
matrices.translate(bounds.getMinX() - 0.5f + width / 2f, bounds.getMinY() + height / 2f, blitOffset);
matrices.scale(width / 64f, height / 64f, 1f);
PatternDrawingUtil.drawPattern(matrices, 0, 0, this.patterns, this.pathfinderDots, this.strokeOrder, time,
0xff_333030, 0xff_191818, 0xc8_0c0a0c, 0x80_666363);
matrices.popPose();
}
}

View file

@ -1,66 +0,0 @@
package at.petrak.hexcasting.fabric.interop.rei;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.client.RenderLib;
import at.petrak.hexcasting.common.recipe.ingredient.VillagerIngredient;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.math.Point;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.world.entity.npc.Villager;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.List;
import static at.petrak.hexcasting.client.RenderLib.renderEntity;
public class VillagerWidget extends Widget {
protected final VillagerIngredient villager;
private final int x;
private final int y;
public VillagerWidget(VillagerIngredient villager, int x, int y) {
this.villager = villager;
this.x = x;
this.y = y;
}
@Override
public void render(@NotNull PoseStack poseStack, int mouseX, int mouseY, float delta) {
ClientLevel level = Minecraft.getInstance().level;
if (level != null) {
Villager displayVillager = RenderLib.prepareVillagerForRendering(villager, level);
RenderSystem.enableBlend();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
renderEntity(poseStack, displayVillager, level, 50 + x, 62.5f + y, ClientTickCounter.getTotal(), 20, 0);
}
if (isMouseOver(mouseX, mouseY))
getTooltip(new Point(mouseX, mouseY)).queue();
}
@Override
public boolean containsMouse(double mouseX, double mouseY) {
double mX = mouseX - x;
double mY = mouseY - y;
return 37 <= mX && mX <= 37 + 26 && 19 <= mY && mY <= 19 + 48;
}
@NotNull
@Override
public Tooltip getTooltip(Point mouse) {
Minecraft mc = Minecraft.getInstance();
return Tooltip.create(mouse, villager.getTooltip(mc.options.advancedItemTooltips));
}
@Override
public List<? extends GuiEventListener> children() {
return Collections.emptyList();
}
}

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.forge; package at.petrak.hexcasting.forge;
import at.petrak.hexcasting.api.HexAPI; import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.api.PatternRegistryBak; import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers; import at.petrak.hexcasting.api.advancements.HexAdvancementTriggers;
import at.petrak.hexcasting.api.mod.HexConfig; import at.petrak.hexcasting.api.mod.HexConfig;
import at.petrak.hexcasting.api.mod.HexStatistics; import at.petrak.hexcasting.api.mod.HexStatistics;
@ -147,7 +147,7 @@ public class ForgeHexInitializer {
}); });
modBus.addListener((FMLLoadCompleteEvent evt) -> modBus.addListener((FMLLoadCompleteEvent evt) ->
HexAPI.LOGGER.info(PatternRegistryBak.getPatternCountInfo())); HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo()));
evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> { evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> {
var res = Brainsweeping.tradeWithVillager( var res = Brainsweeping.tradeWithVillager(

View file

@ -17,7 +17,6 @@ import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.npc.Villager; import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
@ -42,28 +41,32 @@ public class BrainsweepRecipeCategory implements IRecipeCategory<BrainsweepRecip
ResourceLocation location = modLoc("textures/gui/brainsweep_jei.png"); ResourceLocation location = modLoc("textures/gui/brainsweep_jei.png");
background = guiHelper.drawableBuilder(location, 0, 0, 118, 86).setTextureSize(128, 128).build(); background = guiHelper.drawableBuilder(location, 0, 0, 118, 86).setTextureSize(128, 128).build();
var brainsweep = modLoc("brainsweep"); var brainsweep = modLoc("brainsweep");
localizedName = new TranslatableComponent("hexcasting.spell." + brainsweep); localizedName = Component.translatable( "hexcasting.spell." + brainsweep);
icon = new PatternDrawable(brainsweep, 16, 16); icon = new PatternDrawable(brainsweep, 16, 16);
} }
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public @NotNull Component getTitle() { public @NotNull
Component getTitle() {
return localizedName; return localizedName;
} }
@Override @Override
public @NotNull IDrawable getBackground() { public @NotNull
IDrawable getBackground() {
return background; return background;
} }
@Override @Override
public @NotNull IDrawable getIcon() { public @NotNull
IDrawable getIcon() {
return icon; return icon;
} }
@Override @Override
public @NotNull List<Component> getTooltipStrings(@NotNull BrainsweepRecipe recipe, public @NotNull
List<Component> getTooltipStrings(@NotNull BrainsweepRecipe recipe,
@NotNull IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) { @NotNull IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) {
if (37 <= mouseX && mouseX <= 37 + 26 && 19 <= mouseY && mouseY <= 19 + 48) { if (37 <= mouseX && mouseX <= 37 + 26 && 19 <= mouseY && mouseY <= 19 + 48) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
@ -96,19 +99,22 @@ public class BrainsweepRecipeCategory implements IRecipeCategory<BrainsweepRecip
} }
@Override @Override
public @NotNull RecipeType<BrainsweepRecipe> getRecipeType() { public @NotNull
RecipeType<BrainsweepRecipe> getRecipeType() {
return HexJEIPlugin.BRAINSWEEPING; return HexJEIPlugin.BRAINSWEEPING;
} }
@Override @Override
@SuppressWarnings("removal") @SuppressWarnings("removal")
public @NotNull ResourceLocation getUid() { public @NotNull
ResourceLocation getUid() {
return UID; return UID;
} }
@Override @Override
@SuppressWarnings("removal") @SuppressWarnings("removal")
public @NotNull Class<? extends BrainsweepRecipe> getRecipeClass() { public @NotNull
Class<? extends BrainsweepRecipe> getRecipeClass() {
return BrainsweepRecipe.class; return BrainsweepRecipe.class;
} }
} }

View file

@ -1,17 +1,7 @@
package at.petrak.hexcasting.forge.interop.jei; package at.petrak.hexcasting.forge.interop.jei;
import at.petrak.hexcasting.api.PatternRegistryBak; /*
import at.petrak.hexcasting.api.spell.math.HexCoord;
import at.petrak.hexcasting.interop.utils.PatternDrawingUtil;
import at.petrak.hexcasting.interop.utils.PatternEntry;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.datafixers.util.Pair;
import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec2;
import java.util.List;
public class PatternDrawable implements IDrawable { public class PatternDrawable implements IDrawable {
private final long startTime = System.currentTimeMillis(); private final long startTime = System.currentTimeMillis();
@ -25,7 +15,7 @@ public class PatternDrawable implements IDrawable {
private final List<Vec2> pathfinderDots; private final List<Vec2> pathfinderDots;
public PatternDrawable(ResourceLocation pattern, int w, int h) { public PatternDrawable(ResourceLocation pattern, int w, int h) {
var entry = PatternRegistryBak.lookupPattern(pattern); var entry = PatternRegistry.lookupPattern(pattern);
this.strokeOrder = !entry.isPerWorld(); this.strokeOrder = !entry.isPerWorld();
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin()))); var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
this.patterns = data.patterns(); this.patterns = data.patterns();
@ -55,3 +45,4 @@ public class PatternDrawable implements IDrawable {
poseStack.popPose(); poseStack.popPose();
} }
} }
*/

View file

@ -8,15 +8,20 @@ buildscript {
} }
} }
import com.diluv.schoomp.Webhook
import com.diluv.schoomp.message.Message
plugins { plugins {
id 'java' id 'java'
id "org.jetbrains.kotlin.jvm" id "org.jetbrains.kotlin.jvm"
id 'idea' id 'idea'
// This needs to be in the root
// https://github.com/FabricMC/fabric-loom/issues/612#issuecomment-1198444120
// Also it looks like property lookups don't work this early
id 'fabric-loom' version '1.0-SNAPSHOT' apply false
} }
import com.diluv.schoomp.Webhook
import com.diluv.schoomp.message.Message
def isRelease() { def isRelease() {
try { try {
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()