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.
*/
@FunctionalInterface
interface SpecialHandler {
public interface SpecialHandler {
@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.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
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 java.util.EnumSet;
import java.util.Random;
// Facing dir is the direction it starts searching for slates in to start
public abstract class BlockAbstractImpetus extends BlockCircleComponent implements EntityBlock {
@ -56,7 +56,7 @@ public abstract class BlockAbstractImpetus extends BlockCircleComponent implemen
}
@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)) {
tile.stepCircle();
}

View file

@ -24,7 +24,6 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
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)));
} else {
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));
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) {
if (this.mana < 0)
if (this.mana < 0) {
return 0;
}
return ManaHelper.extractMana(stack, remainingManaCapacity(), true, simulate);
}
@ -571,8 +571,9 @@ public abstract class BlockEntityAbstractImpetus extends HexBlockEntity implemen
}
public int remainingManaCapacity() {
if (this.mana < 0)
if (this.mana < 0) {
return 0;
}
return MAX_CAPACITY - this.mana;
}
}

View file

@ -8,8 +8,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
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.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
@ -32,7 +30,8 @@ public interface IotaHolderItem {
*/
String TAG_OVERRIDE_VISUALLY = "VisualOverride";
@Nullable CompoundTag readIotaTag(ItemStack stack);
@Nullable
CompoundTag readIotaTag(ItemStack stack);
@Nullable
default Iota readIota(ItemStack stack, ServerLevel world) {
@ -72,14 +71,14 @@ public interface IotaHolderItem {
var datumTag = self.readIotaTag(stack);
if (datumTag != null) {
var cmp = HexIotaTypes.getDisplay(datumTag);
components.add(new TranslatableComponent("hexcasting.spelldata.onitem", cmp));
components.add(Component.translatable("hexcasting.spelldata.onitem", cmp));
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)) {
components.add(new TranslatableComponent("hexcasting.spelldata.onitem",
new TranslatableComponent("hexcasting.spelldata.anything").withStyle(ChatFormatting.LIGHT_PURPLE)));
components.add(Component.translatable("hexcasting.spelldata.onitem",
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() {
override fun performEffect(harness: CastingHarness): Boolean {
harness.ctx.caster.sendMessage(
"hexcasting.message.cant_great_spell".asTranslatedComponent,
Util.NIL_UUID
)
harness.ctx.caster.sendSystemMessage("hexcasting.message.cant_great_spell".asTranslatedComponent)
if (awardStat)
HexAdvancementTriggers.FAIL_GREAT_SPELL_TRIGGER.trigger(harness.ctx.caster)
@ -37,7 +34,11 @@ sealed class OperatorSideEffect {
}
/** 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() {
override fun performEffect(harness: CastingHarness): Boolean {
this.spell.cast(harness.ctx)
@ -52,10 +53,7 @@ sealed class OperatorSideEffect {
val overcastOk = harness.ctx.canOvercast
val leftoverMana = harness.withdrawMana(this.amount, overcastOk)
if (leftoverMana > 0 && !overcastOk) {
harness.ctx.caster.sendMessage(
"hexcasting.message.cant_overcast".asTranslatedComponent,
Util.NIL_UUID
)
harness.ctx.caster.sendSystemMessage("hexcasting.message.cant_overcast".asTranslatedComponent)
}
return leftoverMana > 0
}
@ -80,7 +78,7 @@ sealed class OperatorSideEffect {
}
} else {
// for now
harness.ctx.caster.sendMessage(msg, Util.NIL_UUID)
harness.ctx.caster.sendSystemMessage(msg)
}
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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -67,6 +66,6 @@ public class DoubleIota extends Iota {
}
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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.Entity;
import org.jetbrains.annotations.NotNull;
@ -30,7 +29,8 @@ public class EntityIota extends Iota {
}
@Override
public @NotNull Tag serialize() {
public @NotNull
Tag serialize() {
var out = new CompoundTag();
out.putUUID("uuid", this.getEntity().getUUID());
out.putString("name", Component.Serializer.toJson(this.getEntity().getName()));
@ -62,10 +62,10 @@ public class EntityIota extends Iota {
@Override
public Component display(Tag tag) {
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)) {
return new TranslatableComponent("hexcasting.spelldata.entity.whoknows");
return Component.translatable("hexcasting.spelldata.entity.whoknows");
}
var nameJson = ctag.getString("name");
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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.FastColor;
import org.jetbrains.annotations.NotNull;
@ -19,7 +18,7 @@ import java.util.Random;
public class GarbageIota extends Iota {
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);
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.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.FormattedCharSequence;
import org.jetbrains.annotations.NotNull;
@ -98,7 +97,7 @@ public class ListIota extends Iota {
@Override
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);
for (int i = 0; i < list.size(); i++) {
Tag sub = list.get(i);
@ -110,7 +109,7 @@ public class ListIota extends Iota {
out.append(",");
}
}
out.append(new TextComponent("]").withStyle(ChatFormatting.DARK_PURPLE));
out.append(Component.literal("]").withStyle(ChatFormatting.DARK_PURPLE));
return out;
}

View file

@ -5,7 +5,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -16,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
public class NullIota extends Iota {
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);
public NullIota() {

View file

@ -7,7 +7,6 @@ import net.minecraft.ChatFormatting;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -68,6 +67,6 @@ public class PatternIota extends Iota {
bob.append(sig);
}
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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull;
@ -63,7 +62,7 @@ public class Vec3Iota extends Iota {
}
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);
}

View file

@ -167,10 +167,10 @@ operator fun MutableComponent.plusAssign(component: Component) {
append(component)
}
val String.asTextComponent get() = TextComponent(this)
val String.asTranslatedComponent get() = TranslatableComponent(this)
val String.asTextComponent: MutableComponent get() = Component.literal(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.

View file

@ -26,9 +26,9 @@ import net.minecraft.client.color.item.ItemColor;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -166,11 +166,11 @@ public class RegisterClientStuff {
lines.add(new Pair<>(
new ItemStack(Items.MUSIC_DISC_CHIRP),
new TextComponent(String.valueOf(instrument.ordinal()))
Component.literal(String.valueOf(instrument.ordinal()))
.withStyle(color(instrumentColor(instrument)))));
lines.add(new Pair<>(
new ItemStack(Items.NOTE_BLOCK),
new TextComponent(String.valueOf(note))
Component.literal(String.valueOf(note))
.withStyle(color(noteColor))));
});
@ -190,22 +190,21 @@ public class RegisterClientStuff {
int comparatorValue = ScryingLensOverlayRegistry.getComparatorValue(true);
lines.add(new Pair<>(
new ItemStack(Items.REDSTONE),
new TextComponent(comparatorValue == -1 ? "" : String.valueOf(comparatorValue))
Component.literal(comparatorValue == -1 ? "" : String.valueOf(comparatorValue))
.withStyle(redstoneColor(comparatorValue))));
boolean compare = state.getValue(ComparatorBlock.MODE) == ComparatorMode.COMPARE;
lines.add(new Pair<>(
new ItemStack(Items.REDSTONE_TORCH),
new TextComponent(
compare ? ">=" : "-")
Component.literal(compare ? ">=" : "-")
.withStyle(redstoneColor(compare ? 0 : 15))));
});
ScryingLensOverlayRegistry.addDisplayer(Blocks.REPEATER,
(lines, state, pos, observer, world, direction, lensHand) -> lines.add(new Pair<>(
new ItemStack(Items.CLOCK),
new TextComponent(String.valueOf(state.getValue(RepeaterBlock.DELAY)))
Component.literal(String.valueOf(state.getValue(RepeaterBlock.DELAY)))
.withStyle(ChatFormatting.YELLOW))));
ScryingLensOverlayRegistry.addPredicateDisplayer(
@ -223,7 +222,7 @@ public class RegisterClientStuff {
lines.add(0, new Pair<>(
new ItemStack(Items.REDSTONE),
new TextComponent(String.valueOf(signalStrength))
Component.literal(String.valueOf(signalStrength))
.withStyle(redstoneColor(signalStrength))));
});
@ -234,7 +233,7 @@ public class RegisterClientStuff {
lines.add(
new Pair<>(
new ItemStack(Items.COMPARATOR),
new TextComponent(comparatorValue == -1 ? "" : String.valueOf(comparatorValue))
Component.literal(comparatorValue == -1 ? "" : String.valueOf(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.renderer.GameRenderer
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.client.resources.sounds.SoundInstance
import net.minecraft.nbt.CompoundTag
import net.minecraft.sounds.SoundSource
import net.minecraft.util.FormattedCharSequence
@ -51,6 +52,8 @@ class GuiSpellcasting constructor(
private var ambianceSoundInstance: GridSoundInstance? = null
private val randSrc = SoundInstance.createUnseededRandom()
init {
for ((pattern, origin) in patterns) {
this.usedSpots.addAll(pattern.positions(origin))
@ -71,6 +74,7 @@ class GuiSpellcasting constructor(
SoundSource.PLAYERS,
0.5f,
1f + (Math.random().toFloat() - 0.5f) * 0.1f,
randSrc,
this.ambianceSoundInstance!!.x,
this.ambianceSoundInstance!!.y,
this.ambianceSoundInstance!!.z,
@ -147,6 +151,7 @@ class GuiSpellcasting constructor(
SoundSource.PLAYERS,
0.25f,
1f,
randSrc,
this.ambianceSoundInstance!!.x,
this.ambianceSoundInstance!!.y,
this.ambianceSoundInstance!!.z,
@ -222,6 +227,7 @@ class GuiSpellcasting constructor(
SoundSource.PLAYERS,
0.25f,
1f + (Math.random().toFloat() - 0.5f) * 0.1f,
randSrc,
this.ambianceSoundInstance!!.x,
this.ambianceSoundInstance!!.y,
this.ambianceSoundInstance!!.z,

View file

@ -1,7 +1,7 @@
package at.petrak.hexcasting.client.gui;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.api.spell.math.HexPattern;
import at.petrak.hexcasting.client.ClientTickCounter;
import at.petrak.hexcasting.client.RenderLib;
import com.mojang.blaze3d.platform.GlStateManager;
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, SIZE, SIZE, 0.0F).uv(1.0F, 1.0f).endVertex();
buffer.vertex(neo, SIZE, 0, 0.0F).uv(1.0F, 0.0F).endVertex();
buffer.end();
BufferUploader.end(buffer);
BufferUploader.draw(buffer.end());
}
@Override

View file

@ -11,7 +11,11 @@ import net.minecraft.world.entity.player.Player
import net.minecraft.world.phys.Vec3
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 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.Direction;
import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.util.RandomSource;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
@ -20,7 +21,6 @@ import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import java.util.EnumSet;
import java.util.Random;
public class BlockRedstoneDirectrix extends BlockCircleComponent {
public static final DirectionProperty FACING = BlockStateProperties.FACING;
@ -84,7 +84,7 @@ public class BlockRedstoneDirectrix extends BlockCircleComponent {
@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)) {
for (int i = 0; i < 2; i++) {
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.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
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 org.jetbrains.annotations.Nullable;
import java.util.Random;
public class BlockStoredPlayerImpetus extends BlockAbstractImpetus {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
@ -72,7 +71,7 @@ public class BlockStoredPlayerImpetus extends BlockAbstractImpetus {
}
@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);
if (pLevel.getBlockEntity(pPos) instanceof BlockEntityStoredPlayerImpetus tile) {
tile.updatePlayerProfile();

View file

@ -4,6 +4,7 @@ import at.petrak.hexcasting.common.particles.ConjureParticleOptions;
import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
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.VoxelShape;
import java.util.Random;
public class BlockSconce extends AmethystBlock {
protected static VoxelShape AABB = Block.box(4, 0, 4, 12, 1, 12);
@ -27,14 +26,14 @@ public class BlockSconce extends AmethystBlock {
}
@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) {
var cx = pPos.getX() + 0.5;
var cy = pPos.getY() + 0.5;
var cz = pPos.getZ() + 0.5;
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,
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) {
pLevel.playLocalSound(cx, cy, cz,
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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
@ -44,11 +43,13 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
}
@Override
protected @Nullable Player getPlayer() {
protected @Nullable
Player getPlayer() {
return this.storedPlayer == null ? null : this.level.getPlayerByUUID(this.storedPlayer);
}
protected @Nullable GameProfile getPlayerName() {
protected @Nullable
GameProfile getPlayerName() {
Player player = getStoredPlayer();
if (player != null) {
return player.getGameProfile();
@ -75,7 +76,8 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
}
// just feels wrong to use the protected method
public @Nullable Player getStoredPlayer() {
public @Nullable
Player getStoredPlayer() {
return this.getPlayer();
}
@ -95,10 +97,10 @@ public class BlockEntityStoredPlayerImpetus extends BlockEntityAbstractImpetus {
cachedDisplayStack = head;
}
lines.add(new Pair<>(cachedDisplayStack,
new TranslatableComponent("hexcasting.tooltip.lens.impetus.storedplayer", name.getName())));
Component.translatable("hexcasting.tooltip.lens.impetus.storedplayer", name.getName())));
} else {
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;
import at.petrak.hexcasting.api.PatternRegistryBak;
import at.petrak.hexcasting.api.PatternRegistry;
import at.petrak.hexcasting.api.misc.ManaConstants;
import at.petrak.hexcasting.api.spell.Action;
import at.petrak.hexcasting.api.spell.iota.DoubleIota;
@ -52,267 +52,267 @@ public class RegisterPatterns {
// - CW is the special or destruction version
// == 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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("get_entity_pos"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aa", HexDir.EAST), modLoc("get_entity_pos"),
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);
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wq", HexDir.EAST), modLoc("get_entity_velocity"),
OpEntityVelocity.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaawdd", HexDir.EAST), modLoc("raycast"),
OpBlockRaycast.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"),
PatternRegistry.mapPattern(HexPattern.fromAngles("weddwaa", HexDir.EAST), modLoc("raycast/axis"),
OpBlockAxisRaycast.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"),
PatternRegistry.mapPattern(HexPattern.fromAngles("weaqa", HexDir.EAST), modLoc("raycast/entity"),
OpEntityRaycast.INSTANCE);
// == 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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("eaqwqaewede", HexDir.SOUTH_WEST),
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("aqwqawaaqa", HexDir.WEST),
modLoc("circle/bounds/max"), new OpCircleBounds(true));
// == Modify Stack ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aadaa", HexDir.EAST), modLoc("duplicate"),
OpDuplicate.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aadaadaa", HexDir.EAST), modLoc("duplicate_n"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), OpSwap.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aawdd", HexDir.EAST), modLoc("swap"), OpSwap.INSTANCE);
PatternRegistry.mapPattern(HexPattern.fromAngles("ddad", HexDir.WEST), modLoc("fisherman"),
OpFisherman.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qaawdde", HexDir.SOUTH_EAST), modLoc("swizzle"),
OpAlwinfyHasAscendedToABeingOfPureMath.INSTANCE);
// == Math ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"),
PatternRegistry.mapPattern(HexPattern.fromAngles("waaw", HexDir.NORTH_EAST), modLoc("add"),
OpAdd.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wddw", HexDir.NORTH_WEST), modLoc("sub"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wdedw", HexDir.NORTH_EAST), modLoc("div_cross"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wedew", HexDir.NORTH_WEST), modLoc("pow_proj"),
OpPowProj.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"),
PatternRegistry.mapPattern(HexPattern.fromAngles("ewq", HexDir.EAST), modLoc("floor"),
OpFloor.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qwe", HexDir.EAST), modLoc("ceil"),
OpCeil.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"),
PatternRegistry.mapPattern(HexPattern.fromAngles("eqqqqq", HexDir.EAST), modLoc("construct_vec"),
OpConstructVec.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qeeeee", HexDir.EAST), modLoc("deconstruct_vec"),
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);
// == Logic ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wdw", HexDir.NORTH_EAST), modLoc("and"),
OpBoolAnd.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"),
PatternRegistry.mapPattern(HexPattern.fromAngles("waw", HexDir.SOUTH_EAST), modLoc("or"),
OpBoolOr.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"),
PatternRegistry.mapPattern(HexPattern.fromAngles("dwa", HexDir.NORTH_WEST), modLoc("xor"),
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));
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));
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));
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"),
PatternRegistry.mapPattern(HexPattern.fromAngles("ad", HexDir.EAST), modLoc("equals"),
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"),
PatternRegistry.mapPattern(HexPattern.fromAngles("dw", HexDir.NORTH_WEST), modLoc("not"),
OpBoolNot.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("identity"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aw", HexDir.NORTH_EAST), modLoc("identity"),
OpBoolIdentityKindOf.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"),
PatternRegistry.mapPattern(HexPattern.fromAngles("eqqq", HexDir.NORTH_WEST), modLoc("random"),
OpRandom.INSTANCE);
// == Advanced Math ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaa", HexDir.SOUTH_EAST), modLoc("sin"),
OpSin.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqad", HexDir.SOUTH_EAST), modLoc("cos"),
OpCos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wqqqqqadq", HexDir.SOUTH_WEST), modLoc("tan"),
OpTan.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"),
PatternRegistry.mapPattern(HexPattern.fromAngles("ddeeeee", HexDir.SOUTH_EAST), modLoc("arcsin"),
OpArcSin.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"),
PatternRegistry.mapPattern(HexPattern.fromAngles("adeeeee", HexDir.NORTH_EAST), modLoc("arccos"),
OpArcCos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"),
PatternRegistry.mapPattern(HexPattern.fromAngles("eadeeeeew", HexDir.NORTH_EAST), modLoc("arctan"),
OpArcTan.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"),
PatternRegistry.mapPattern(HexPattern.fromAngles("eqaqe", HexDir.NORTH_WEST), modLoc("logarithm"),
OpLog.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"),
PatternRegistry.mapPattern(HexPattern.fromAngles("addwaad", HexDir.NORTH_EAST), modLoc("modulo"),
OpModulo.INSTANCE);
// == 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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"),
PatternRegistry.mapPattern(HexPattern.fromAngles("waweaqa", HexDir.SOUTH_EAST), modLoc("or_bit"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"),
PatternRegistry.mapPattern(HexPattern.fromAngles("dweaqa", HexDir.NORTH_WEST), modLoc("not_bit"),
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);
// == Spells ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"),
PatternRegistry.mapPattern(HexPattern.fromAngles("de", HexDir.NORTH_EAST), modLoc("print"),
OpPrint.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aawaawaa", HexDir.EAST), modLoc("explode"),
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"),
PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaqw", HexDir.SOUTH_WEST), modLoc("add_motion"),
OpAddMotion.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"),
PatternRegistry.mapPattern(HexPattern.fromAngles("awqqqwaq", HexDir.SOUTH_WEST), modLoc("blink"),
OpBlink.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qaqqqqq", HexDir.EAST), modLoc("break_block"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("awddwqawqwawq", HexDir.EAST),
modLoc("colorize"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("dedwedade", HexDir.SOUTH_WEST),
modLoc("destroy_water"),
OpDestroyWater.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aaqawawa", HexDir.SOUTH_EAST), modLoc("ignite"),
OpIgnite.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"),
PatternRegistry.mapPattern(HexPattern.fromAngles("ddedwdwd", HexDir.SOUTH_WEST), modLoc("extinguish"),
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));
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwawqaqw", HexDir.NORTH_EAST), modLoc("bonemeal"),
OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST),
modLoc("recharge"),
OpRecharge.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qdqawwaww", HexDir.EAST), modLoc("erase"),
new OpErase());
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"),
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaqwd", HexDir.NORTH_EAST), modLoc("edify"),
OpEdifySapling.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"),
PatternRegistry.mapPattern(HexPattern.fromAngles("adaa", HexDir.WEST), modLoc("beep"),
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("wwaqqqqqeaqeaeqqqeaeq", HexDir.EAST),
modLoc("craft/trinket"),
new OpMakePackagedSpell<>(HexItems.TRINKET, 5 * ManaConstants.CRYSTAL_UNIT));
PatternRegistryBak.mapPattern(
PatternRegistry.mapPattern(
HexPattern.fromAngles("wwaqqqqqeawqwqwqwqwqwwqqeadaeqqeqqeadaeqq", HexDir.EAST),
modLoc("craft/artifact"),
new OpMakePackagedSpell<>(HexItems.ARTIFACT, 10 * ManaConstants.CRYSTAL_UNIT));
PatternRegistryBak.mapPattern(
PatternRegistry.mapPattern(
HexPattern.fromAngles("aqqqaqwwaqqqqqeqaqqqawwqwqwqwqwqw", HexDir.SOUTH_WEST),
modLoc("craft/battery"),
OpMakeBattery.INSTANCE,
true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqaqwawaw", HexDir.NORTH_WEST),
modLoc("potion/weakness"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
new OpCreateSentinel(false));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qdwdqdw", HexDir.NORTH_EAST),
modLoc("sentinel/destroy"),
OpDestroySentinel.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaede", HexDir.EAST),
modLoc("sentinel/get_pos"),
OpGetSentinelPos.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaedwa", HexDir.EAST),
modLoc("sentinel/wayfind"),
OpGetSentinelWayfind.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("waadwawdaaweewq", HexDir.EAST),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("eaqawqadaqd", HexDir.EAST),
modLoc("create_lava"), OpCreateLava.INSTANCE, true);
PatternRegistryBak.mapPattern(
PatternRegistry.mapPattern(
HexPattern.fromAngles("wwwqqqwwwqqeqqwwwqqwqqdqqqqqdqq", HexDir.EAST),
modLoc("teleport"), OpTeleport.INSTANCE, true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("waeawaeqqqwqwqqwq", HexDir.EAST),
modLoc("sentinel/create/great"),
new OpCreateSentinel(true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("eeewwweeewwaqqddqdqd", HexDir.EAST),
modLoc("dispel_rain"),
new OpWeather(false), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("wwweeewwweewdawdwad", HexDir.WEST),
modLoc("summon_rain"),
new OpWeather(true), true);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qeqwqwqwqwqeqaeqeaqeqaeqaqded", HexDir.NORTH_EAST),
modLoc("brainsweep"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"),
PatternRegistry.mapPattern(HexPattern.fromAngles("eeeweeeeede", HexDir.EAST), modLoc("akashic/write"),
OpAkashicWrite.INSTANCE);
// == Meta stuff ==
@ -322,155 +322,155 @@ public class RegisterPatterns {
// http://www.toroidalsnark.net/mkss3-pix/CalderheadJMM2014.pdf
// 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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aqdee", HexDir.SOUTH_WEST), modLoc("halt"),
OpHalt.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqq", HexDir.EAST), modLoc("read"),
OpRead.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"),
PatternRegistry.mapPattern(HexPattern.fromAngles("deeeee", HexDir.EAST), modLoc("write"),
OpWrite.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aqqqqqe", HexDir.EAST), modLoc("readable"),
OpReadable.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"),
PatternRegistry.mapPattern(HexPattern.fromAngles("deeeeeq", HexDir.EAST), modLoc("writable"),
OpWritable.INSTANCE);
// lorge boyes
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqw", HexDir.EAST),
modLoc("read/entity"), OpTheCoolerRead.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("wawqwqwqwqwqwew", HexDir.EAST),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("eqqwawqaaw", HexDir.NORTH_WEST),
modLoc("write/local"), OpPushLocal.INSTANCE);
// == 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()));
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))));
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))));
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))));
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))));
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))));
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))));
// 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))));
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)));
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)));
// 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)));
// == 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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawa", HexDir.SOUTH_EAST),
modLoc("get_entity/animal"),
new OpGetEntityAt(OpGetEntitiesBy::isAnimal));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawq", HexDir.SOUTH_EAST),
modLoc("get_entity/monster"),
new OpGetEntityAt(OpGetEntitiesBy::isMonster));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaaww", HexDir.SOUTH_EAST),
modLoc("get_entity/item"),
new OpGetEntityAt(OpGetEntitiesBy::isItem));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawe", HexDir.SOUTH_EAST),
modLoc("get_entity/player"),
new OpGetEntityAt(OpGetEntitiesBy::isPlayer));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqdaqaawd", HexDir.SOUTH_EAST),
modLoc("get_entity/living"),
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));
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqqqwdeddwa", HexDir.SOUTH_EAST),
modLoc("zone_entity/animal"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
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"),
new OpGetEntitiesBy(OpGetEntitiesBy::isLiving, true));
// == Lists ==
PatternRegistryBak.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"),
PatternRegistry.mapPattern(HexPattern.fromAngles("edqde", HexDir.SOUTH_WEST), modLoc("append"),
OpAppend.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaq", HexDir.NORTH_WEST), modLoc("concat"),
OpConcat.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"),
PatternRegistry.mapPattern(HexPattern.fromAngles("deeed", HexDir.NORTH_WEST), modLoc("index"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aqaeaq", HexDir.EAST), modLoc("list_size"),
OpListSize.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"),
PatternRegistry.mapPattern(HexPattern.fromAngles("adeeed", HexDir.EAST), modLoc("singleton"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qqqaede", HexDir.EAST), modLoc("reverse_list"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qwaeawq", HexDir.NORTH_WEST), modLoc("splat"),
OpSplat.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"),
PatternRegistry.mapPattern(HexPattern.fromAngles("dedqde", HexDir.EAST), modLoc("index_of"),
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);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"),
PatternRegistry.mapPattern(HexPattern.fromAngles("qaeaqwded", HexDir.NORTH_WEST), modLoc("slice"),
OpSlice.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("wqaeaqw", HexDir.NORTH_WEST),
modLoc("modify_in_place"),
OpModifyInPlace.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"),
PatternRegistry.mapPattern(HexPattern.fromAngles("ddewedd", HexDir.SOUTH_EAST), modLoc("construct"),
OpCons.INSTANCE);
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"),
PatternRegistry.mapPattern(HexPattern.fromAngles("aaqwqaa", HexDir.SOUTH_WEST), modLoc("deconstruct"),
OpUnCons.INSTANCE);
} catch (PatternRegistryBak.RegisterPatternException exn) {
} catch (PatternRegistry.RegisterPatternException exn) {
exn.printStackTrace();
}
// Add zilde->number
PatternRegistryBak.addSpecialHandler(modLoc("number"), pat -> {
PatternRegistry.addSpecialHandler(modLoc("number"), pat -> {
var sig = pat.anglesSignature();
if (sig.startsWith("aqaa") || 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();
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.iota.Iota
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
import net.minecraft.Util
// TODO should this dump the whole stack
object OpPrint : Action {
@ -31,10 +30,7 @@ object OpPrint : Action {
private data class Spell(val datum: Iota) : RenderedSpell {
override fun cast(ctx: CastingContext) {
ctx.caster.sendMessage(
datum.display(),
Util.NIL_UUID
)
ctx.caster.sendSystemMessage(datum.display())
}
}
}

View file

@ -1,33 +1,33 @@
package at.petrak.hexcasting.common.command;
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.Commands;
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;
public class BrainsweepCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(Commands.literal("hexcasting:brainsweep")
public static void add(LiteralArgumentBuilder<CommandSourceStack> cmd) {
cmd.then(Commands.literal("brainsweep")
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS))
.then(Commands.argument("villager", EntityArgument.entity()).executes(ctx -> {
var target = EntityArgument.getEntity(ctx, "villager");
if (target instanceof Villager v) {
if (Brainsweeping.isBrainswept(v)) {
ctx.getSource().sendFailure(
new TranslatableComponent("command.hexcasting.brainsweep.fail.already",
Component.translatable("command.hexcasting.brainsweep.fail.already",
v.getDisplayName()));
return 0;
}
Brainsweeping.brainsweep(v);
ctx.getSource().sendSuccess(
new TranslatableComponent("command.hexcasting.brainsweep", v.getDisplayName()), true);
Component.translatable("command.hexcasting.brainsweep", v.getDisplayName()), true);
return 1;
} else {
ctx.getSource().sendFailure(
new TranslatableComponent("command.hexcasting.brainsweep.fail.badtype",
Component.translatable("command.hexcasting.brainsweep.fail.badtype",
target.getDisplayName()));
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.common.items.ItemScroll;
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.Commands;
import net.minecraft.commands.arguments.ResourceLocationArgument;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
public class ListPatternsCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(Commands.literal("hexcasting:patterns")
public static void add(LiteralArgumentBuilder<CommandSourceStack> cmd) {
cmd.then(Commands.literal("patterns")
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS))
.then(Commands.literal("list").executes(ctx -> {
@ -28,10 +27,10 @@ public class ListPatternsCommand {
.sorted((a, b) -> compareResLoc(a.getValue().getFirst(), b.getValue().getFirst()))
.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) {
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(PatternIota.display(hexPattern)), false);
}
@ -56,7 +55,7 @@ public class ListPatternsCommand {
stack.setTag(tag);
ctx.getSource().sendSuccess(
new TranslatableComponent(
Component.translatable(
"command.hexcasting.pats.specific.success",
stack.getDisplayName(),
targetId),
@ -99,7 +98,7 @@ public class ListPatternsCommand {
});
ctx.getSource().sendSuccess(
new TranslatableComponent("command.hexcasting.pats.all", lookup.size()), true);
Component.translatable("command.hexcasting.pats.all", lookup.size()), true);
return lookup.size();
} else {
return 0;

View file

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

View file

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

View file

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

View file

@ -1,11 +1,9 @@
package at.petrak.hexcasting.common.items;
import at.petrak.hexcasting.common.lib.HexSounds;
import net.minecraft.Util;
import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.network.chat.ChatType;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
@ -67,8 +65,7 @@ public class ItemLoreFragment extends Item {
}
if (unfoundLore == null) {
splayer.sendMessage(new TranslatableComponent("item.hexcasting.lore_fragment.all"), ChatType.GAME_INFO,
Util.NIL_UUID);
splayer.displayClientMessage(Component.translatable("item.hexcasting.lore_fragment.all"), true);
splayer.giveExperiencePoints(20);
level.playSound(null, player.position().x, player.position().y, player.position().z,
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.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.EntityType;
@ -50,7 +49,8 @@ public class ItemScroll extends Item implements IotaHolderItem {
}
@Override
public @Nullable CompoundTag readIotaTag(ItemStack stack) {
public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
CompoundTag pattern = NBTHelper.getCompound(stack, TAG_PATTERN);
if (pattern == null) {
return null;
@ -119,12 +119,12 @@ public class ItemScroll extends Item implements IotaHolderItem {
var descID = this.getDescriptionId(pStack);
var ancientId = NBTHelper.getString(pStack, TAG_OP_ID);
if (ancientId != null) {
return new TranslatableComponent(descID + ".of",
new TranslatableComponent("hexcasting.spell." + ResourceLocation.tryParse(ancientId)));
return Component.translatable(descID + ".of",
Component.translatable( "hexcasting.spell." + ResourceLocation.tryParse(ancientId)));
} else if (NBTHelper.hasCompound(pStack, TAG_PATTERN)) {
return new TranslatableComponent(descID);
return Component.translatable(descID);
} 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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
@ -38,7 +37,7 @@ public class ItemSlate extends BlockItem implements IotaHolderItem {
@Override
public Component getName(ItemStack pStack) {
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) {
@ -66,7 +65,8 @@ public class ItemSlate extends BlockItem implements IotaHolderItem {
}
@Override
public @Nullable CompoundTag readIotaTag(ItemStack stack) {
public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
var bet = NBTHelper.getCompound(stack, "BlockEntityTag");
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.Tag;
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.world.entity.Entity;
import net.minecraft.world.item.Item;
@ -52,15 +50,15 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
int highest = highestPage(stack);
if (highest != 0) {
if (sealed) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page.sealed",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.page.sealed",
Component.literal(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
Component.literal(String.valueOf(highest)).withStyle(ChatFormatting.WHITE),
Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY));
} else {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(highest)).withStyle(ChatFormatting.WHITE))
tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.page",
Component.literal(String.valueOf(pageIdx)).withStyle(ChatFormatting.WHITE),
Component.literal(String.valueOf(highest)).withStyle(ChatFormatting.WHITE))
.withStyle(ChatFormatting.GRAY));
}
} else {
@ -74,16 +72,16 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
boolean overridden = NBTHelper.hasString(stack, TAG_OVERRIDE_VISUALLY);
if (sealed) {
if (overridden) {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(
tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(
ChatFormatting.GOLD));
} else {
tooltip.add(new TranslatableComponent("hexcasting.tooltip.spellbook.empty.sealed",
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
tooltip.add(Component.translatable("hexcasting.tooltip.spellbook.empty.sealed",
Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD))
.withStyle(ChatFormatting.GRAY));
}
} else if (!overridden) {
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
public @Nullable CompoundTag readIotaTag(ItemStack stack) {
public @Nullable
CompoundTag readIotaTag(ItemStack stack) {
int idx = getPage(stack, 1);
var key = String.valueOf(idx);
var tag = NBTHelper.getCompound(stack, TAG_PAGES);
@ -125,7 +124,8 @@ public class ItemSpellbook extends Item implements IotaHolderItem {
}
@Override
public @Nullable Iota emptyIota(ItemStack stack) {
public @Nullable
Iota emptyIota(ItemStack stack) {
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.common.lib.HexItems;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.advancements.Advancement;
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.ServerPlayer;
import net.minecraft.util.Mth;
@ -39,9 +40,9 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
String prefix = "item.hexcasting.creative_unlocker.";
String emphasis = Language.getInstance().getOrDefault(prefix + "for_emphasis");
MutableComponent emphasized = new TextComponent("");
MutableComponent emphasized = Component.literal("");
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;
@ -106,17 +107,17 @@ public class ItemCreativeUnlocker extends Item implements MediaHolderItem {
NBTHelper.remove(stack, TAG_EXTRACTIONS);
for (int i : arr) {
if (i < 0) {
entity.sendMessage(new TranslatableComponent("hexcasting.debug.mana_withdrawn",
entity.sendSystemMessage(Component.translatable("hexcasting.debug.mana_withdrawn",
stack.getDisplayName(),
new TranslatableComponent("hexcasting.debug.all_mana").withStyle(ChatFormatting.GRAY))
.withStyle(ChatFormatting.LIGHT_PURPLE), Util.NIL_UUID);
Component.translatable("hexcasting.debug.all_mana").withStyle(ChatFormatting.GRAY))
.withStyle(ChatFormatting.LIGHT_PURPLE));
} else {
entity.sendMessage(new TranslatableComponent("hexcasting.debug.mana_withdrawn.with_dust",
entity.sendSystemMessage(Component.translatable("hexcasting.debug.mana_withdrawn.with_dust",
stack.getDisplayName(),
new TextComponent("" + i).withStyle(ChatFormatting.WHITE),
new TextComponent(String.format("%.2f", i * 1.0 / ManaConstants.DUST_UNIT)).withStyle(
Component.literal("" + i).withStyle(ChatFormatting.WHITE),
Component.literal(String.format("%.2f", i * 1.0 / ManaConstants.DUST_UNIT)).withStyle(
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);
MutableComponent modName = new TranslatableComponent(prefix + "mod_name").withStyle(
MutableComponent modName = Component.translatable(prefix + "mod_name").withStyle(
(s) -> s.withColor(HEX_COLOR));
tooltipComponents.add(
new TranslatableComponent(prefix + "tooltip.0", emphasized).withStyle(ChatFormatting.GRAY));
tooltipComponents.add(new TranslatableComponent(prefix + "tooltip.1", modName).withStyle(ChatFormatting.GRAY));
Component.translatable(prefix + "tooltip.0", emphasized).withStyle(ChatFormatting.GRAY));
tooltipComponents.add(Component.translatable(prefix + "tooltip.1", modName).withStyle(ChatFormatting.GRAY));
}
private static void addChildren(Advancement root, List<Advancement> out) {

View file

@ -30,7 +30,7 @@ public class ItemMediaBattery extends ItemMediaHolder {
@Override
public void fillItemCategory(@NotNull CreativeModeTab tab, @NotNull NonNullList<ItemStack> items) {
// who was drunk at the wheel when they named this
if (allowdedIn(tab)) {
if (allowedIn(tab)) {
var manamounts = new int[]{
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 net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -77,7 +76,7 @@ public abstract class ItemMediaHolder extends Item implements MediaHolderItem {
TooltipFlag pIsAdvanced) {
if (pIsAdvanced.isAdvanced() && getMaxMedia(pStack) > 0) {
pTooltipComponents.add(
new TranslatableComponent("item.hexcasting.manaholder.amount",
Component.translatable("item.hexcasting.manaholder.amount",
String.format("%,d", getMedia(pStack)),
String.format("%,d", getMaxMedia(pStack)),
100f * getManaFullness(pStack)).withStyle(ChatFormatting.GRAY));

View file

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

View file

@ -5,11 +5,16 @@ import at.petrak.hexcasting.common.command.ListPatternsCommand;
import at.petrak.hexcasting.common.command.RecalcPatternsCommand;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
public class HexCommands {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
ListPatternsCommand.register(dispatcher);
RecalcPatternsCommand.register(dispatcher);
BrainsweepCommand.register(dispatcher);
var mainCmd = Commands.literal("hexcasting");
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.Tag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.FormattedCharSequence;
@ -136,11 +135,11 @@ public class HexIotaTypes {
public static Component getDisplay(CompoundTag tag) {
var type = getTypeFromTag(tag);
if (type == null) {
return TextComponent.EMPTY;
return Component.empty();
}
var data = tag.get(KEY_DATA);
if (data == null) {
return TextComponent.EMPTY;
return Component.empty();
}
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 void lootLoad(ResourceLocation id,
Consumer<LootPool> addPool) {
public static void lootLoad(ResourceLocation id, Consumer<LootPool.Builder> addPool) {
if (id.equals(Blocks.AMETHYST_CLUSTER.getLootTable())) {
addPool.accept(getInjectPool(TABLE_INJECT_AMETHYST_CLUSTER));
} else {
@ -32,11 +31,10 @@ public class HexLootHandler {
}
}
public static LootPool getInjectPool(ResourceLocation entry) {
public static LootPool.Builder getInjectPool(ResourceLocation entry) {
return LootPool.lootPool()
.add(getInjectEntry(entry, 1))
.setBonusRolls(UniformGenerator.between(0, 1))
.build();
.setBonusRolls(UniformGenerator.between(0, 1));
}
private static LootPoolEntryContainer.Builder<?> getInjectEntry(ResourceLocation table, int weight) {

View file

@ -1,6 +1,6 @@
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.common.items.ItemScroll;
import at.petrak.hexcasting.common.lib.HexLootFunctions;
@ -22,14 +22,14 @@ public class PatternScrollFunc extends LootItemConditionalFunction {
@Override
protected ItemStack run(ItemStack stack, LootContext ctx) {
var rand = ctx.getRandom();
var worldLookup = PatternRegistryBak.getPerWorldPatterns(ctx.getLevel());
var worldLookup = PatternRegistry.getPerWorldPatterns(ctx.getLevel());
var keys = worldLookup.keySet().stream().toList();
var sig = keys.get(rand.nextInt(keys.size()));
var entry = worldLookup.get(sig);
var opId = entry.component1();
var startDir = entry.component2();
var opId = entry.getFirst();
var startDir = entry.getSecond();
var tag = new CompoundTag();
tag.putString(ItemScroll.TAG_OP_ID, opId.toString());
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 net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.util.RandomSource;
import net.minecraft.util.valueproviders.ConstantInt;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.grower.AbstractTreeGrower;
@ -19,7 +20,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.OptionalInt;
import java.util.Random;
public class AkashicTreeGrower extends AbstractTreeGrower {
public static final AkashicTreeGrower INSTANCE = new AkashicTreeGrower();
@ -48,7 +48,7 @@ public class AkashicTreeGrower extends AbstractTreeGrower {
@Nullable
@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()));
}
}

View file

@ -9,9 +9,8 @@ import at.petrak.hexcasting.common.lib.HexSounds;
import io.netty.buffer.ByteBuf;
import net.minecraft.ChatFormatting;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
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.server.MinecraftServer;
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
* 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");
@Override
@ -84,30 +84,30 @@ public record MsgShiftScrollSyn(double mainHandDelta, double offHandDelta, boole
MutableComponent component;
if (hand == InteractionHand.OFF_HAND && stack.hasCustomHoverName()) {
if (sealed) {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name.sealed",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TextComponent("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC)
component = Component.translatable("hexcasting.tooltip.spellbook.page_with_name.sealed",
Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
Component.literal("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC)
.append(stack.getHoverName()),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
} else {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page_with_name",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TextComponent("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC)
component = Component.translatable("hexcasting.tooltip.spellbook.page_with_name",
Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
Component.literal("").withStyle(stack.getRarity().color, ChatFormatting.ITALIC)
.append(stack.getHoverName()));
}
} else {
if (sealed) {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page.sealed",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
new TranslatableComponent("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
component = Component.translatable("hexcasting.tooltip.spellbook.page.sealed",
Component.literal(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
Component.literal(String.valueOf(len)).withStyle(ChatFormatting.WHITE),
Component.translatable("hexcasting.tooltip.spellbook.sealed").withStyle(ChatFormatting.GOLD));
} else {
component = new TranslatableComponent("hexcasting.tooltip.spellbook.page",
new TextComponent(String.valueOf(newIdx)).withStyle(ChatFormatting.WHITE),
new TextComponent(String.valueOf(len)).withStyle(ChatFormatting.WHITE));
component = Component.translatable("hexcasting.tooltip.spellbook.page",
Component.literal(String.valueOf(newIdx)).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) {
var popup = HexIotaTypes.getDisplay(datumTag);
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.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
@ -67,7 +66,7 @@ public class StateIngredientBlockState implements StateIngredient {
@SuppressWarnings({"unchecked", "rawtypes"})
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;
}

View file

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

View file

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

View file

@ -81,9 +81,4 @@ public class HexBlockTagProvider extends PaucalBlockTagProvider {
tag(BlockTags.WOODEN_BUTTONS)
.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.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;
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.HexPattern;
import com.google.gson.annotations.SerializedName;
@ -23,9 +23,9 @@ public class LookupPatternComponent extends AbstractPatternComponent {
@Override
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();
return List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin()));
return List.of(new Pair<>(entry.prototype(), HexCoord.getOrigin()));
}
@Override

View file

@ -1,6 +1,6 @@
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.HexPattern;
import net.minecraft.world.entity.Entity;
@ -10,11 +10,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class PehkuiInterop {
public static void init() {
try {
PatternRegistryBak.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST),
PatternRegistry.mapPattern(HexPattern.fromAngles("aawawwawwa", HexDir.NORTH_WEST),
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);
} catch (PatternRegistryBak.RegisterPatternException e) {
} catch (PatternRegistry.RegisterPatternException e) {
e.printStackTrace();
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
@ -16,16 +17,14 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Random;
@Mixin(ClientLevel.class)
public abstract class MixinClientLevel {
@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)
public void addBuddingAmethystParticles(int baseX, int baseY, int baseZ, int range, Random rand, Block marked, BlockPos.MutableBlockPos pos, CallbackInfo ci,
int trueX, int trueY, int trueZ, BlockState state) {
public void addBuddingAmethystParticles(int $$0, int $$1, int $$2, int $$3, RandomSource rand, Block $$5,
BlockPos.MutableBlockPos pos, CallbackInfo ci, int trueX, int trueY, int trueZ, BlockState state) {
ClientLevel self = ((ClientLevel) (Object) this);
if (state.is(Blocks.BUDDING_AMETHYST)) {

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version "$loomVersion"
id 'fabric-loom' // version "1.0-SNAPSHOT"
}
archivesBaseName = getArtifactID("fabric")
@ -74,9 +74,9 @@ dependencies {
modImplementation "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
// modImplementation "io.github.tropheusj:serialization-hooks:$serializationHooksVersion"
// include "io.github.tropheusj:serialization-hooks:$serializationHooksVersion"
// apparently the 1.18 version Just Works on 1.19
modImplementation "io.github.tropheusj:serialization-hooks:$serializationHooksVersion"
include "io.github.tropheusj:serialization-hooks:$serializationHooksVersion"
// Optional integrations

View file

@ -1,10 +1,9 @@
loomVersion=0.11-SNAPSHOT
fabricVersion=0.64.0+1.19.2
fabricLoaderVersion=0.14.10
fiberVersion=0.23.0-2
cardinalComponentsVersion=5.0.2
serializationHooksVersion=0.3.24
emiVersion=0.4.0+1.19
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 io.github.tropheusj.serialization_hooks.ingredient.IngredientDeserializer
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.player.AttackBlockCallback
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.minecraft.commands.synchronization.ArgumentTypes
import net.minecraft.commands.synchronization.EmptyArgumentSerializer
import net.minecraft.commands.synchronization.SingletonArgumentInfo
import net.minecraft.core.Registry
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.InteractionResult
@ -43,10 +43,10 @@ object FabricHexInitializer : ModInitializer {
initRegistries()
ArgumentTypes.register(
"hexcasting:pattern",
ArgumentTypeRegistry.registerArgumentType(
modLoc("pattern"),
PatternResLocArgument::class.java,
EmptyArgumentSerializer { PatternResLocArgument.id() }
SingletonArgumentInfo.contextFree { PatternResLocArgument.id() }
)
RegisterPatterns.registerPatterns()
HexAdvancementTriggers.registerTriggers()
@ -73,12 +73,10 @@ object FabricHexInitializer : ModInitializer {
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, _ ->
HexLootHandler.lootLoad(
id,
) { supplier.withPool(it) }
LootTableEvents.MODIFY.register { _, _, id, supplier, _ ->
HexLootHandler.lootLoad(id, supplier::withPool)
}
}

View file

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

View file

@ -19,8 +19,6 @@ import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
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.world.entity.EntityType;
import net.minecraft.world.entity.npc.Villager;
@ -121,15 +119,16 @@ public class VillagerEmiStack extends EmiStack {
if (mindless) {
List<Component> tooltip = new ArrayList<>();
tooltip.add(new TranslatableComponent("hexcasting.tooltip.brainsweep.product"));
tooltip.add(Component.translatable("hexcasting.tooltip.brainsweep.product"));
if (advanced) {
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));
tooltip.add(new TextComponent(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY));
ResourceLocation displayId = Objects.requireNonNullElseGet(ingredient.profession(),
() -> Registry.ENTITY_TYPE.getKey(EntityType.VILLAGER));
tooltip.add(Component.literal(displayId.toString()).withStyle(ChatFormatting.DARK_GRAY));
}
tooltip.add(ingredient.getModNameComponent());
@ -141,7 +140,9 @@ public class VillagerEmiStack extends EmiStack {
@Override
public List<ClientTooltipComponent> getTooltip() {
List<ClientTooltipComponent> list = getTooltipText().stream().map(Component::getVisualOrderText).map(ClientTooltipComponent::create)
List<ClientTooltipComponent> list = getTooltipText().stream()
.map(Component::getVisualOrderText)
.map(ClientTooltipComponent::create)
.collect(Collectors.toList());
if (!getRemainder().isEmpty()) {
list.add(EmiTooltipComponents.getRemainderTooltipComponent(this));

View file

@ -1,6 +1,6 @@
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.HexPattern;
@ -9,11 +9,11 @@ import static at.petrak.hexcasting.api.HexAPI.modLoc;
public class GravityApiInterop {
public static void init() {
try {
PatternRegistryBak.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST),
PatternRegistry.mapPattern(HexPattern.fromAngles("wawawddew", HexDir.NORTH_EAST),
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);
} catch (PatternRegistryBak.RegisterPatternException e) {
} catch (PatternRegistry.RegisterPatternException e) {
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.casting.CastingContext
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.world.entity.Entity
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.getEntity
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
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;
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.mod.HexConfig;
import at.petrak.hexcasting.api.mod.HexStatistics;
@ -147,7 +147,7 @@ public class ForgeHexInitializer {
});
modBus.addListener((FMLLoadCompleteEvent evt) ->
HexAPI.LOGGER.info(PatternRegistryBak.getPatternCountInfo()));
HexAPI.LOGGER.info(PatternRegistry.getPatternCountInfo()));
evBus.addListener((PlayerInteractEvent.EntityInteract evt) -> {
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.multiplayer.ClientLevel;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.item.ItemStack;
@ -42,28 +41,32 @@ public class BrainsweepRecipeCategory implements IRecipeCategory<BrainsweepRecip
ResourceLocation location = modLoc("textures/gui/brainsweep_jei.png");
background = guiHelper.drawableBuilder(location, 0, 0, 118, 86).setTextureSize(128, 128).build();
var brainsweep = modLoc("brainsweep");
localizedName = new TranslatableComponent("hexcasting.spell." + brainsweep);
localizedName = Component.translatable( "hexcasting.spell." + brainsweep);
icon = new PatternDrawable(brainsweep, 16, 16);
}
@Override
@OnlyIn(Dist.CLIENT)
public @NotNull Component getTitle() {
public @NotNull
Component getTitle() {
return localizedName;
}
@Override
public @NotNull IDrawable getBackground() {
public @NotNull
IDrawable getBackground() {
return background;
}
@Override
public @NotNull IDrawable getIcon() {
public @NotNull
IDrawable getIcon() {
return icon;
}
@Override
public @NotNull List<Component> getTooltipStrings(@NotNull BrainsweepRecipe recipe,
public @NotNull
List<Component> getTooltipStrings(@NotNull BrainsweepRecipe recipe,
@NotNull IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) {
if (37 <= mouseX && mouseX <= 37 + 26 && 19 <= mouseY && mouseY <= 19 + 48) {
Minecraft mc = Minecraft.getInstance();
@ -96,19 +99,22 @@ public class BrainsweepRecipeCategory implements IRecipeCategory<BrainsweepRecip
}
@Override
public @NotNull RecipeType<BrainsweepRecipe> getRecipeType() {
public @NotNull
RecipeType<BrainsweepRecipe> getRecipeType() {
return HexJEIPlugin.BRAINSWEEPING;
}
@Override
@SuppressWarnings("removal")
public @NotNull ResourceLocation getUid() {
public @NotNull
ResourceLocation getUid() {
return UID;
}
@Override
@SuppressWarnings("removal")
public @NotNull Class<? extends BrainsweepRecipe> getRecipeClass() {
public @NotNull
Class<? extends BrainsweepRecipe> getRecipeClass() {
return BrainsweepRecipe.class;
}
}

View file

@ -1,17 +1,7 @@
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 net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec2;
import java.util.List;
public class PatternDrawable implements IDrawable {
private final long startTime = System.currentTimeMillis();
@ -25,7 +15,7 @@ public class PatternDrawable implements IDrawable {
private final List<Vec2> pathfinderDots;
public PatternDrawable(ResourceLocation pattern, int w, int h) {
var entry = PatternRegistryBak.lookupPattern(pattern);
var entry = PatternRegistry.lookupPattern(pattern);
this.strokeOrder = !entry.isPerWorld();
var data = PatternDrawingUtil.loadPatterns(List.of(new Pair<>(entry.getPrototype(), HexCoord.getOrigin())));
this.patterns = data.patterns();
@ -55,3 +45,4 @@ public class PatternDrawable implements IDrawable {
poseStack.popPose();
}
}
*/

View file

@ -8,15 +8,20 @@ buildscript {
}
}
import com.diluv.schoomp.Webhook
import com.diluv.schoomp.message.Message
plugins {
id 'java'
id "org.jetbrains.kotlin.jvm"
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() {
try {
def stdout = new ByteArrayOutputStream()