Skip to content

Commit

Permalink
Merge pull request #18 from StellarWitch7/master
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai authored Jul 16, 2024
2 parents 85a71f8 + e2725e5 commit 736b4b6
Show file tree
Hide file tree
Showing 79 changed files with 1,983 additions and 66 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ loom {
}
}

fabricApi {
configureDataGeneration()
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${property('deps.minecraft')}"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ git_branch=master
deps.fabric-api=0.100.1+1.21
deps.owo-lib=0.12.10+1.21
deps.lavender=0.1.10+1.21
deps.cicada=0.8.0+1.21-and-above
deps.cicada=0.8.3+1.21-and-above
deps.cardinal-components-api=6.1.0
deps.modmenu=11.0.1

Expand Down
7 changes: 5 additions & 2 deletions src/client/java/dev/enjarai/trickster/ModKeyBindings.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import dev.enjarai.trickster.net.MladyPacket;
import dev.enjarai.trickster.net.ModNetworking;
import dev.enjarai.trickster.net.ScrollInGamePacket;
import io.wispforest.accessories.api.slot.SlotReference;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
Expand All @@ -22,9 +23,11 @@ public static void register() {
var player = client.player;
if (player != null && client.currentScreen == null) {
if (TAKE_HAT.wasPressed()) {
if (player.getEquippedStack(EquipmentSlot.HEAD).isIn(ModItems.HOLDABLE_HAT) && player.getEquippedStack(EquipmentSlot.OFFHAND).isEmpty()) {
var hat = SlotReference.of(player, "hat", 0);
var hatStack = hat.getStack();
if (((hatStack != null && hatStack.isIn(ModItems.HOLDABLE_HAT)) || player.getEquippedStack(EquipmentSlot.HEAD).isIn(ModItems.HOLDABLE_HAT)) && player.getEquippedStack(EquipmentSlot.OFFHAND).isEmpty()) {
ModNetworking.CHANNEL.clientHandle().send(new MladyPacket(true));
} else if (player.getEquippedStack(EquipmentSlot.HEAD).isEmpty() && player.getOffHandStack().isIn(ModItems.HOLDABLE_HAT)) {
} else if (((hatStack != null && hatStack.isEmpty()) || player.getEquippedStack(EquipmentSlot.HEAD).isEmpty()) && player.getOffHandStack().isIn(ModItems.HOLDABLE_HAT)) {
ModNetworking.CHANNEL.clientHandle().send(new MladyPacket(false));
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/client/java/dev/enjarai/trickster/TricksterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@

import dev.enjarai.trickster.block.ModBlocks;
import dev.enjarai.trickster.cca.ModEntityCumponents;
import dev.enjarai.trickster.item.ModItems;
import dev.enjarai.trickster.item.ScrollAndQuillItem;
import dev.enjarai.trickster.net.IsEditingScrollPacket;
import dev.enjarai.trickster.net.ModClientNetworking;
import dev.enjarai.trickster.net.ModNetworking;
import dev.enjarai.trickster.particle.ModParticles;
import dev.enjarai.trickster.particle.ProtectedBlockParticle;
import dev.enjarai.trickster.render.HoldableHatRenderer;
import dev.enjarai.trickster.render.SpellCircleBlockEntityRenderer;
import dev.enjarai.trickster.screen.ModHandledScreens;
import dev.enjarai.trickster.screen.ScrollAndQuillScreen;
import dev.enjarai.trickster.screen.SignScrollScreen;
import dev.enjarai.trickster.screen.owo.GlyphComponent;
import io.wispforest.accessories.api.client.AccessoriesRendererRegistry;
import io.wispforest.owo.ui.parsing.UIParsing;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;

public class TricksterClient implements ClientModInitializer {
Expand All @@ -39,6 +44,10 @@ public void onInitializeClient() {

ParticleFactoryRegistry.getInstance().register(ModParticles.PROTECTED_BLOCK, ProtectedBlockParticle.Factory::new);

AccessoriesRendererRegistry.registerRenderer(ModItems.TOP_HAT, HoldableHatRenderer::new);

BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.SPELL_RESONATOR, RenderLayer.getCutout());

ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (client.player != null) {
var editing = client.currentScreen instanceof ScrollAndQuillScreen;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package dev.enjarai.trickster.render;

import io.wispforest.accessories.api.client.AccessoryRenderer;
import io.wispforest.accessories.api.client.Side;
import io.wispforest.accessories.api.slot.SlotReference;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;

public class HoldableHatRenderer implements AccessoryRenderer {
@Override
public <M extends LivingEntity> void render(ItemStack stack, SlotReference reference, MatrixStack matrices, EntityModel<M> model, VertexConsumerProvider multiBufferSource, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
if (!(model instanceof BipedEntityModel<? extends LivingEntity> humanoidModel)) return;

AccessoryRenderer.transformToFace(matrices, humanoidModel.head, Side.TOP);
matrices.translate(0.0, -0.3, 0.0);

MinecraftClient.getInstance().getItemRenderer().renderItem(
stack, ModelTransformationMode.HEAD, light, OverlayTexture.DEFAULT_UV,
matrices, multiBufferSource, reference.entity().getWorld(), 0
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// 1.21 2024-07-15T21:34:42.9793041 Trickster/Model Definitions
b9b893ec0a8cd31d7398651d871e15a392ea76b2 assets\trickster\models\item\spell_resonator.json
9d5d343103d621d1a2f492cec156c06274efdc15 assets\trickster\blockstates\spell_resonator.json
Loading

0 comments on commit 736b4b6

Please sign in to comment.