Skip to content

Commit

Permalink
Merge pull request #87 from enjarai/the-unduckening
Browse files Browse the repository at this point in the history
A rework of trick declaration
  • Loading branch information
enjarai authored Jan 18, 2025
2 parents ff142cf + 22180b3 commit 9ca2e95
Show file tree
Hide file tree
Showing 330 changed files with 3,716 additions and 2,676 deletions.
37 changes: 27 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
- Made the data files for conversion tricks more extensive. (@awakened-redstone)
- Added a trick for eroding blocks using water. (@awakened-redstone)
- Made vectors certain to blunder with NaN coordinates. (@StellarWitch7)
- Added messages between spells. (@StellarWitch7)
- Fixed number equality when in collections. (@StellarWitch7)
- Added a tag to exclude blocks from the Ploy of Destruction. (@StellarWitch7)
- Added a configuration for the max hardness of blocks broken by Ploy of Destruction. (@StellarWitch7)
- Generally cleaned up the config screen. (@StellarWitch7)
- Ingress of Suitability now checks whether the position is replaceable instead of air. (@StellarWitch7)
- Added a client config to stop the player from opening unsigned scrolls which are in the offhand. (@StellarWitch7)
- Massively re-worked the way tricks process input values. (@StellarWitch7 and @enjarai)
- Fixed being unable to import spells in the book to dyed scrolls. (@enjarai)
- Renamed raycast ingresses to be less like those of Hexcasting. (@enjarai and @StellarWitch7)
- Split the Impulse Ploy into the Ploy of Featherweight and Kinetic Ploy. (@enjarai)
- Made knots charge rapidly in thunderstorms. (@enjarai)
- Added missing documentation for the exponential distortion. (@StellarWitch7)
- Fixed construct state not saving consistently. (@enjarai)
- Made it possible to read/write fragments from/to arbitrary slot references. (@cotton-flower and @StellarWitch7)
- Due to this, there is now a separate ploy for clearing fragments from an item.
- Decreased the size of fragments on disk by an order of magnitude, alleviating several issues. (@enjarai)
- Added an accessory to make early game mana generation less painful. (@cotton-flower and @enjarai and @StellarWitch7)
- Fixed the Benevolent Conduit's Ploy being a method of infinite mana. (@StellarWitch7)
- Fixed the list insertion trick failing when the given index is at the end of the given list. (@Master-Bw3)
- Added a new block for more organized moonlight charging of knots. (@enjarai and @StellarWitch7)
- Hopefully fixed a small oddity in the multiplayer spell preview. (@StellarWitch7)
- Quadrupled the performance of spell circle rendering. (@enjarai)
- Removed the ability to create water in the nether and other hot dimensions. (@Awakened-Redstone)
- Made tricks which query or modify blocks blunder if the target position's chunk is not loaded. (@enjarai)
- Made the cooling ploy fill cauldrons with powdered snow completely. (@Awakened-Redstone)
- Improved the hats' offhand scroll preview. (@enjarai and @StellarWitch7)
- Added a handful of utility tricks. (@enjarai and @StellarWitch7)
- Construct blunders now wrap instead of going off the screen. (@enjarai)
- Made spell-light blocks replaceable. (@Awakened-Redstone)
- Fixed a server crash when killing a spell slot that hasn't ticked yet. (@StellarWitch7)
- Made block and item type fragments render in spell circles. (@enjarai)
- Added a timeout argument for message listeners. (@StellarWitch7)
- Made the if-else trick variadic, allowing else-if chaining. (@StellarWitch7)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ deps.yarn=1.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=2.0.0-beta.8
mod_version=2.0.0-beta.9
maven_group=dev.enjarai
archives_base_name=trickster

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import dev.enjarai.trickster.pond.QuackingInGameHud;
import dev.enjarai.trickster.render.FunnyStaticFrameBufferThing;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.Framebuffer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.render.RenderTickCounter;
Expand All @@ -28,9 +27,13 @@
public class InGameHudMixin implements QuackingInGameHud {
@Inject(method = "renderVignetteOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lnet/minecraft/util/Identifier;IIIFFIIII)V"))
private void changeColorWhenFrozen(DrawContext context, Entity entity, CallbackInfo ci) {
if (entity instanceof LivingEntity livingEntity
&& livingEntity.getAttributes().hasModifierForAttribute(EntityAttributes.GENERIC_MOVEMENT_SPEED,
Trickster.NEGATE_ATTRIBUTE.id())) {
if (
entity instanceof LivingEntity livingEntity
&& livingEntity.getAttributes().hasModifierForAttribute(
EntityAttributes.GENERIC_MOVEMENT_SPEED,
Trickster.NEGATE_ATTRIBUTE.id()
)
) {
context.setShaderColor(0.4f, 0.4f, 0f, 1f);
}
}
Expand All @@ -39,17 +42,17 @@ private void changeColorWhenFrozen(DrawContext context, Entity entity, CallbackI
private float animationOffset;

@Inject(
method = "renderHotbar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;"
method = "renderHotbar", at = @At(
value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;getValue()Ljava/lang/Object;"
)
)
private void renderHatHud(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci, @Local PlayerEntity player) {
var hatStack = player.getOffHandStack();
if (hatStack.isIn(ModItems.HOLDABLE_HAT)) {
var deltaAnimationOffset = MathHelper.lerp(tickCounter.getTickDelta(false),
animationOffset, animationOffset - animationOffset / 4);
var deltaAnimationOffset = MathHelper.lerp(
tickCounter.getTickDelta(false),
animationOffset, animationOffset - animationOffset / 4
);
int roundedAnimationOffset = deltaAnimationOffset < 0 ? MathHelper.ceil(deltaAnimationOffset) : MathHelper.floor(deltaAnimationOffset);

var matrices = context.getMatrices();
Expand Down Expand Up @@ -88,8 +91,7 @@ private void renderHatHud(DrawContext context, RenderTickCounter tickCounter, Ca
}

@Inject(
method = "tick()V",
at = @At("TAIL")
method = "tick()V", at = @At("TAIL")
)
private void tickHatHud(CallbackInfo ci) {
animationOffset -= animationOffset / 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.enjarai.trickster.mixin.client;

import dev.enjarai.trickster.cca.ModEntityComponents;
import dev.enjarai.trickster.item.ModItems;
import dev.enjarai.trickster.item.component.ModComponents;
import dev.enjarai.trickster.render.SpellCircleRenderer;
import dev.enjarai.trickster.spell.SpellPart;
Expand All @@ -27,18 +26,25 @@ public abstract class PlayerRendererMixin {
public SpellCircleRenderer trickster$renderer = new SpellCircleRenderer(false, 1);

@SuppressWarnings("resource")
@Inject(method = "render(Lnet/minecraft/client/network/AbstractClientPlayerEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"))
@Inject(
method = "render(Lnet/minecraft/client/network/AbstractClientPlayerEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(
"HEAD"
)
)
public void trickster$onRender(
AbstractClientPlayerEntity player,
float $$1,
float tickDelta,
MatrixStack matrices,
VertexConsumerProvider vertexConsumers,
int $$5,
CallbackInfo ci) {
CallbackInfo ci
) {
var spell = trickster$get_spell(player);
if (spell.isPresent() && (player != MinecraftClient.getInstance().player
|| MinecraftClient.getInstance().gameRenderer.getCamera().isThirdPerson())) {
if (
spell.isPresent() && (player != MinecraftClient.getInstance().player
|| MinecraftClient.getInstance().gameRenderer.getCamera().isThirdPerson())
) {
matrices.push();
// translate to be at eye level
matrices.translate(0f, player.getEyeHeight(player.getPose()), 0f);
Expand All @@ -51,11 +57,12 @@ public abstract class PlayerRendererMixin {
// push forward from eyes a bit
matrices.translate(0f, 0f, 1f);

var rot = new Vec3d(-1, -1, player.getRotationVector().y);
;
var rot = new Vec3d(-1, -1, player.getRotationVector().y);;

this.trickster$renderer.renderPart(matrices, vertexConsumers, spell.get(), 0, 0, 0.5f, 0, tickDelta,
size -> 1f, rot);
this.trickster$renderer.renderPart(
matrices, vertexConsumers, spell.get(), 0, 0, 0.5f, 0, tickDelta,
size -> 1f, rot
);
matrices.pop();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.particle.*;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.SimpleParticleType;
import net.minecraft.util.math.ColorHelper;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.joml.Quaternionf;
import org.joml.Vector3f;

public class SpellParticle extends SpriteBillboardParticle {
protected SpellParticle(ClientWorld world, double x, double y, double z, double dx, double dy, double dz, int color) {
super(world, x, y, z);
// maxAge = 10;
// alpha = 0.6f;
// maxAge = 10;
// alpha = 0.6f;
red = ColorHelper.Argb.getRed(color) / 255f;
green = ColorHelper.Argb.getGreen(color) / 255f;
blue = ColorHelper.Argb.getBlue(color) / 255f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ private void drawSide(MatrixStack matrices, VertexConsumerProvider vertexConsume
private static final Random glyphRandom = new LocalRandom(0);

public static void drawGlyphLine(MatrixStack matrices, VertexConsumerProvider vertexConsumers, Vector2f last, Vector2f now, float pixelSize, boolean isDrawing, float tone, float r, float g, float b, float opacity, boolean animated) {
if (last.distance(now) < pixelSize * 6) {
return;
}

var parallelVec = new Vector2f(last.y - now.y, now.x - last.x).normalize().mul(pixelSize / 2);
var directionVec = new Vector2f(last.x - now.x, last.y - now.y).normalize().mul(pixelSize * 3);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package dev.enjarai.trickster.render;

import org.joml.Matrix4f;

import dev.enjarai.trickster.spell.SpellPart;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;

import java.util.Optional;

public class SpellTooltipComponent implements TooltipComponent {

Expand Down Expand Up @@ -44,8 +43,10 @@ public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext conte
var size = 30f;

matrices.push();
renderer.renderPart(matrices, vertexConsumers, spell, x + (float) getWidth(textRenderer) / 2, y + (float) getHeight() / 2, size,
0.0, delta, a -> a/size, new Vec3d(0, 0, -1) );
renderer.renderPart(
matrices, vertexConsumers, spell, x + (float) getWidth(textRenderer) / 2, y + (float) getHeight() / 2, size,
0.0, delta, a -> a / size, new Vec3d(0, 0, -1)
);
matrices.pop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public class SpellFleckRenderer implements FleckRenderer<SpellFleck> {
private final SpellCircleRenderer renderer = new SpellCircleRenderer(false, 1);

@Override
public void render(SpellFleck fleck, SpellFleck lastFleck, WorldRenderContext context, ClientWorld world, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int color) {
public void render(
SpellFleck fleck, SpellFleck lastFleck, WorldRenderContext context, ClientWorld world, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int color
) {

matrices.push();

Expand Down Expand Up @@ -46,16 +48,16 @@ public void render(SpellFleck fleck, SpellFleck lastFleck, WorldRenderContext co
//TODO WOBBLE

renderer.renderPart(
matrices,
vertexConsumers,
spell,
0,
0,
0.5,
0,
tickDelta,
size -> 1.0f,
new Vec3d(facing.x(), facing.y(), facing.z())
matrices,
vertexConsumers,
spell,
0,
0,
0.5,
0,
tickDelta,
size -> 1.0f,
new Vec3d(facing.x(), facing.y(), facing.z())
);

matrices.pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;

import java.util.function.Function;

public class TextFleckRenderer implements FleckRenderer<TextFleck> {
@Override
public void render(TextFleck fleck, TextFleck lastFleck, WorldRenderContext context, ClientWorld world, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int color) {
Expand Down
Loading

0 comments on commit 9ca2e95

Please sign in to comment.