Skip to content

Commit

Permalink
Update?? Already???
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed Mar 9, 2025
1 parent 98d4ea5 commit 79648aa
Show file tree
Hide file tree
Showing 14 changed files with 136 additions and 29 deletions.
27 changes: 3 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
- Added Levitating Blocks. (@enjarai)
- A block can now be levitated by applying a Featherweight Ploy to it.
- These levitated blocks can be kept levitating by continually applying Featherweight Ploy.
- Levitated blocks can be moved around using Kinetic Ploy, as if they were normal entities.
- They may impart significant damage when striking living creatures at high velocity.
- A levitated block will revert to its normal form when on solid ground and no longer affected by Featherweight.
- It can be forced to convert back in midair by applying a Featherweight of 1 to it.
- If a levitated block is inside a block that isn't naturally replaceable, it will never revert.
- Added Displacement. (@StellarWitch7 and @enjarai)
- Displacement is a delayed means of teleportation.
- When applying displacement to an entity, the mana cost scales exponentially with distance.
- After the displacement is applied, and a few seconds of delay, the target entity will teleport by the given offset.
- During the delay window, more displacements can be applied to the entity to modify its final destination.
- If the entity takes damage from any source, the displacement is cancelled.
- Added Astral Knots. (@enjarai and @StellarWitch7)
- This type of Knot is made from a Nether Star.
- It does not regenerate mana from moonlight, but has a truly massive buffer, and has a unique mechanic associated with it.
- Improved block conversions. (Heating, Cooling and Weathering) (@Awakened-Redstone)
- Fixed issues with waterlogging.
- Fixed issues with blockstates not being preserved.
- Added the Acolyte's Bindings and the Archmage's Tether. (@StellarWitch7 and @enjarai)
- Thanks for the textures Crephan!
- Improved Knot tooltips displaying merlin gain and drain. (@StellarWitch7)
- Updated changelog. (@enjarai)
- Added a model for the Acolyte's Bindings. (@enjarai)
- Added a bell sound for the Acolyte's Bindings. (@enjarai)
- Fixed a naming error. (@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.11
mod_version=2.0.0-beta.12
maven_group=dev.enjarai
archives_base_name=trickster

Expand Down
2 changes: 1 addition & 1 deletion src/client/java/dev/enjarai/trickster/TricksterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public void onInitializeClient() {
AccessoriesRendererRegistry.registerRenderer(ModItems.TOP_HAT, HoldableHatRenderer::new);
AccessoriesRendererRegistry.registerRenderer(ModItems.WITCH_HAT, HoldableHatRenderer::new);
AccessoriesRendererRegistry.registerRenderer(ModItems.FEZ, HoldableHatRenderer::new);
AccessoriesRendererRegistry.registerRenderer(ModItems.COLLAR, CollarRenderer::new);
AccessoriesRendererRegistry.registerNoRenderer(ModItems.MACRO_RING);
AccessoriesRendererRegistry.registerNoRenderer(ModItems.AMETHYST_WHORL);
AccessoriesRendererRegistry.registerNoRenderer(ModItems.COLLAR);

BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.SPELL_RESONATOR, RenderLayer.getCutout());
BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.LIGHT, RenderLayer.getTranslucent());
Expand Down
80 changes: 80 additions & 0 deletions src/client/java/dev/enjarai/trickster/render/CollarRenderer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package dev.enjarai.trickster.render;

import com.google.common.base.Suppliers;
import dev.enjarai.trickster.Trickster;
import io.wispforest.accessories.api.client.AccessoryRenderer;
import io.wispforest.accessories.api.slot.SlotReference;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.model.*;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelPartNames;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;

import java.util.function.Supplier;

// Partially adapted from Collar Trinkets by wiidotmom (https://github.com/wiidotmom/collar-trinkets)
public class CollarRenderer implements AccessoryRenderer {
private static final Identifier TEXTURE = Trickster.id("textures/entity/collar.png");
private static final Supplier<BipedEntityModel<LivingEntity>> MODEL = Suppliers.memoize(() ->
new Model(Model.createTexturedModelData().createModel()));

@Override
public <M extends LivingEntity> void render(ItemStack itemStack, SlotReference slotReference, MatrixStack matrixStack, EntityModel<M> entityModel, VertexConsumerProvider vertexConsumerProvider, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
BipedEntityModel<LivingEntity> model = MODEL.get();
model.setAngles(slotReference.entity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
model.animateModel(slotReference.entity(), limbSwing, limbSwingAmount, ageInTicks);
followBodyRotations(slotReference.entity(), model);
VertexConsumer consumer = vertexConsumerProvider.getBuffer(model.getLayer(TEXTURE));

model.render(matrixStack, consumer, light, OverlayTexture.DEFAULT_UV);

// BipedEntityModel<LivingEntity> bellModel = BELL_MODEL.get();
// bellModel.setAngles(slotReference.entity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
// bellModel.animateModel(slotReference.entity(), limbSwing, limbSwingAmount, ageInTicks);
// followBodyRotations(slotReference.entity(), bellModel);
// VertexConsumer bellConsumer = vertexConsumerProvider.getBuffer(bellModel.getLayer(TEXTURE));
// bellModel.render(matrixStack, bellConsumer, light, OverlayTexture.DEFAULT_UV, 1.0f, 1.0f, 1.0f, 1.0f);
}

private static void followBodyRotations(LivingEntity entity, BipedEntityModel<LivingEntity> model) {
EntityRenderer<? super LivingEntity> render = MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(entity);

if (render instanceof LivingEntityRenderer<?, ?> renderer && renderer.getModel() instanceof BipedEntityModel<?> entityModel) {
((BipedEntityModel<LivingEntity>) entityModel).copyBipedStateTo(model);
}
}

public static class Model extends BipedEntityModel<LivingEntity> {
public Model(ModelPart root) {
super(root);
this.setVisible(false);
this.body.visible = true;
}

public static TexturedModelData createTexturedModelData() {
ModelData modelData = new ModelData();
ModelPartData root = modelData.getRoot();
ModelPartData body = root.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.NONE);
body.addChild("collar", ModelPartBuilder.create().uv(0, 0).cuboid(-3.0F, -24.0F, -2.0F, 6.0F, 3.0F, 4.0F, new Dilation(0.3F)), ModelTransform.pivot(0.0F, 24.0F, 0.0F));
body.addChild("bell", ModelPartBuilder.create().uv(0, 7).cuboid(-0.5F, -23.0F, -2.75F, 1.0F, 1.0F, 1.0F, new Dilation(0.3F)), ModelTransform.pivot(0.0F, 24.0F, 0.0F));

root.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.NONE);
root.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.NONE);
root.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.NONE);
root.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.NONE);
root.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.NONE);
root.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.NONE);

return TexturedModelData.of(modelData, 64, 64);
}
}
}
1 change: 1 addition & 0 deletions src/main/java/dev/enjarai/trickster/ModSounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class ModSounds {
public static final SoundEvent DRAW = register("draw");
public static final SoundEvent COMPLETE = register("complete");
public static final SoundEvent CAST = register("cast");
public static final SoundEvent COLLAR_BELL = register("collar_bell");

private static SoundEvent register(String path) {
var id = Trickster.id(path);
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/dev/enjarai/trickster/item/CollarItem.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package dev.enjarai.trickster.item;

import dev.enjarai.trickster.ModSounds;
import dev.enjarai.trickster.item.component.ModComponents;
import io.wispforest.accessories.api.AccessoryItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.text.Text;
Expand All @@ -21,4 +25,13 @@ public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> to

super.appendTooltip(stack, context, tooltip, type);
}

public static void playJingleQuestionMark(LivingEntity entity, boolean server) {
if (entity.accessoriesCapability() != null && entity.accessoriesCapability().isEquipped(ModItems.COLLAR)) {
entity.getWorld().playSoundFromEntity(
!server && entity instanceof PlayerEntity player ? player : null, entity, ModSounds.COLLAR_BELL,
entity.getSoundCategory(), 0.18f, 1f
);
}
}
}
22 changes: 19 additions & 3 deletions src/main/java/dev/enjarai/trickster/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
package dev.enjarai.trickster.mixin;

import dev.enjarai.trickster.ModSounds;
import dev.enjarai.trickster.cca.ModEntityComponents;
import dev.enjarai.trickster.item.CollarItem;
import dev.enjarai.trickster.item.ModItems;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Entity.class)
public class EntityMixin {
public abstract class EntityMixin {
@Shadow public abstract World getWorld();

@SuppressWarnings("ConstantValue")
@Inject(
method = "getFinalGravity",
Expand All @@ -26,10 +33,19 @@ private void applyGravityGrace(CallbackInfoReturnable<Double> cir) {
}

@Inject(
method = "playStepSounds(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)V",
method = "playStepSound",
at = @At("TAIL")
)
private void playCollarJingle(BlockPos pos, BlockState state, CallbackInfo ci) {
private void playStepSound(BlockPos pos, BlockState state, CallbackInfo ci) {
if ((Entity) (Object) this instanceof LivingEntity) {
CollarItem.playJingleQuestionMark((LivingEntity) (Object) this, false);
}
}

@Inject(method = "setSneaking", at = @At("HEAD"))
private void setSneaking(boolean sneaking, CallbackInfo ci) {
if ((Entity) (Object) this instanceof LivingEntity) {
CollarItem.playJingleQuestionMark((LivingEntity) (Object) this, true);
}
}
}
10 changes: 10 additions & 0 deletions src/main/java/dev/enjarai/trickster/mixin/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.llamalad7.mixinextras.sugar.ref.LocalDoubleRef;
import dev.enjarai.trickster.ModAttachments;
import dev.enjarai.trickster.cca.ModEntityComponents;
import dev.enjarai.trickster.item.CollarItem;
import dev.enjarai.trickster.spell.ItemTriggerHelper;
import dev.enjarai.trickster.spell.fragment.NumberFragment;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -114,4 +115,13 @@ private double modifyScale(double original) {
private float modifySpeed(float original) {
return (float) (original * ModEntityComponents.SCALE.get(this).getScale());
}

@Inject(
method = "jump",
at = @At("HEAD")
)
private void jump(CallbackInfo ci) {
LivingEntity entity = (LivingEntity) (Object) this;
CollarItem.playJingleQuestionMark(entity, false);
}
}
8 changes: 8 additions & 0 deletions src/main/resources/assets/trickster/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@
"sounds": [
"trickster:cast"
]
},
"collar_bell": {
"sounds": [
"trickster:collar_bell_1",
"trickster:collar_bell_2",
"trickster:collar_bell_3",
"trickster:collar_bell_4"
]
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 79648aa

Please sign in to comment.