This commit is contained in:
2026-02-24 18:30:55 +01:00
parent 915db8d815
commit 21f3acba86
10 changed files with 311 additions and 11 deletions

View File

@@ -6,7 +6,7 @@ minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10 yarn_mappings=1.20.1+build.10
loader_version=0.18.3 loader_version=0.18.3
# Mod Properties # Mod Properties
mod_version=26.2.24 mod_version=26.2.24.1
maven_group=dev.tggamesyt maven_group=dev.tggamesyt
archives_base_name=szar archives_base_name=szar
# Dependencies # Dependencies

View File

@@ -0,0 +1,65 @@
// Save this class in your mod and generate all required imports
package dev.tggamesyt.szar.client;
import net.minecraft.client.render.entity.animation.Keyframe;
/**
* Made with Blockbench 5.0.7
* Exported for Minecraft version 1.19 or later with Mojang mappings
* @author Author
*/
public class CustomModelAnimation {
public static final AnimationDefinition hithand = AnimationDefinition.Builder.withLength(1.0F)
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(-150.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.75F, KeyframeAnimations.degreeVec(-150.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
public static final AnimationDefinition flip = AnimationDefinition.Builder.withLength(1.25F)
.addAnimation("Waist", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.5833F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.7917F, KeyframeAnimations.degreeVec(-180.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.degreeVec(-355.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.25F, KeyframeAnimations.degreeVec(-360.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Waist", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.5833F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.7917F, KeyframeAnimations.degreeVec(-180.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.degreeVec(-355.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.25F, KeyframeAnimations.degreeVec(-360.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.5833F, KeyframeAnimations.posVec(0.0F, 8.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.7917F, KeyframeAnimations.posVec(0.0F, 8.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.5833F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.7917F, KeyframeAnimations.degreeVec(-180.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.degreeVec(-360.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.5833F, KeyframeAnimations.posVec(0.0F, 9.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
}

View File

@@ -5,6 +5,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.render.entity.animation.Animation;
import net.minecraft.client.render.entity.model.EntityModelLayers; import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
@@ -16,7 +17,8 @@ public class KidRenderer extends MobEntityRenderer<KidEntity, PlayerEntityModel<
private static final float MAX_HEAD_SCALE = 2.0f; private static final float MAX_HEAD_SCALE = 2.0f;
private static final float MIN_BODY_SCALE = 0.3f; // starting scale for body private static final float MIN_BODY_SCALE = 0.3f; // starting scale for body
private static final float MAX_BODY_SCALE = 1.0f; // final player scale private static final float MAX_BODY_SCALE = 1.0f; // final player scale
private Animation currentAnimation;
private float animationTime = 0f; // track progress in seconds
public KidRenderer(EntityRendererFactory.Context ctx) { public KidRenderer(EntityRendererFactory.Context ctx) {
super(ctx, super(ctx,
new PlayerEntityModel<>(ctx.getPart(EntityModelLayers.PLAYER), false), new PlayerEntityModel<>(ctx.getPart(EntityModelLayers.PLAYER), false),

View File

@@ -1,34 +1,75 @@
package dev.tggamesyt.szar.client; package dev.tggamesyt.szar.client;
import dev.tggamesyt.szar.NaziEntity; import dev.tggamesyt.szar.NaziEntity;
import dev.tggamesyt.szar.client.mixin.PlayerModelMixin;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.client.render.entity.animation.AnimationHelper;
import net.minecraft.client.render.entity.feature.HeldItemFeatureRenderer; import net.minecraft.client.render.entity.feature.HeldItemFeatureRenderer;
import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.joml.Vector3f;
import java.util.Random;
public class NaziEntityRenderer public class NaziEntityRenderer
extends MobEntityRenderer<NaziEntity, PlayerEntityModel<NaziEntity>> { extends MobEntityRenderer<NaziEntity, PlayerEntityModel<NaziEntity>> {
private final Vector3f tempVec = new Vector3f();
final PlayerModelAdapter<NaziEntity> adapter;
public NaziEntityRenderer(EntityRendererFactory.Context context) { public NaziEntityRenderer(EntityRendererFactory.Context context) {
super( super(
context, context,
new PlayerEntityModel<>(context.getPart(EntityModelLayers.PLAYER), false), new PlayerEntityModel<>(context.getPart(EntityModelLayers.PLAYER), false),
0.5F 0.5F
); );
PlayerEntityModel<NaziEntity> base = (PlayerEntityModel<NaziEntity>) this.getModel();
PlayerModelAdapter<NaziEntity> a = new PlayerModelAdapter<>(base);
a.setRoot(context.getPart(EntityModelLayers.PLAYER));
this.adapter = a;
this.addFeature(new HeldItemFeatureRenderer<>( this.addFeature(new HeldItemFeatureRenderer<>(
this, this,
context.getHeldItemRenderer() context.getHeldItemRenderer()
)); ));
} }
@Override @Override
public Identifier getTexture(NaziEntity entity) { public Identifier getTexture(NaziEntity entity) {
return new Identifier("szar", "textures/entity/nazi.png"); return new Identifier("szar", "textures/entity/nazi.png");
} }
}
@Override
public void render(NaziEntity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) {
// ehh this shit doesnt work
final Vector3f tempVec = new Vector3f();
// Check if the entity is currently playing the hand animation
if (entity.isPlayingHandAnim()) {
// Apply the hand animation directly from PlayerAnimations
long elapsedMillis = (long)(entity.getAnimationProgress() * 1000f);
AnimationHelper.animate(
adapter,
PlayerAnimations.hithand,
elapsedMillis,
1.0F,
tempVec
);
}
super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light);
}
}

View File

@@ -0,0 +1,93 @@
package dev.tggamesyt.szar.client;
import net.minecraft.client.render.entity.animation.Animation;
import net.minecraft.client.render.entity.animation.AnimationHelper;
import net.minecraft.client.render.entity.animation.Keyframe;
import net.minecraft.client.render.entity.animation.Transformation;
/**
* Converted from Blockbench 5.0.7 custom animation format to Minecraft Animation API.
* Exported for Minecraft 1.19+ with Yarn mappings
* Author: Original Author
*/
public class PlayerAnimations {
public static final Animation hithand = Animation.Builder.create(1.0F)
.addBoneAnimation("left_arm", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.1667F, AnimationHelper.createRotationalVector(-150.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.75F, AnimationHelper.createRotationalVector(-150.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();
public static final Animation flip = Animation.Builder.create(1.25F)
// Waist = head + body + arms
.addBoneAnimation("body", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-180.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(-355.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.25F, AnimationHelper.createRotationalVector(-360.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("head", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-180.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(-355.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.25F, AnimationHelper.createRotationalVector(-360.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("left_arm", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-180.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(-355.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.25F, AnimationHelper.createRotationalVector(-360.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("right_arm", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-180.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(-355.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.25F, AnimationHelper.createRotationalVector(-360.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
// Body translation (jump/lift)
.addBoneAnimation("body", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.125F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
// Legs
.addBoneAnimation("right_leg", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-180.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(-355.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.25F, AnimationHelper.createRotationalVector(-360.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("right_leg", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createTranslationalVector(0.0F, 8.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createTranslationalVector(0.0F, 8.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.125F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("left_leg", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-180.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(-360.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("left_leg", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.5833F, AnimationHelper.createTranslationalVector(0.0F, 9.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.125F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();
}

View File

@@ -0,0 +1,48 @@
package dev.tggamesyt.szar.client;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import java.util.Optional;
public class PlayerModelAdapter<T extends LivingEntity>
extends SinglePartEntityModel<T> {
public ModelPart root;
private final PlayerEntityModel<T> playerModel;
public PlayerModelAdapter(PlayerEntityModel<T> playerModel) {
this.playerModel = playerModel;
}
@Override
public ModelPart getPart() {
return root;
}
public void setRoot(ModelPart root) {
this.root = root;
}
@Override
public Optional<ModelPart> getChild(String name) {
return switch (name) {
case "head" -> Optional.of(playerModel.head);
case "body" -> Optional.of(playerModel.body);
case "left_arm" -> Optional.of(playerModel.leftArm);
case "right_arm" -> Optional.of(playerModel.rightArm);
case "left_leg" -> Optional.of(playerModel.leftLeg);
case "right_leg" -> Optional.of(playerModel.rightLeg);
default -> Optional.empty();
};
}
@Override
public void setAngles(T entity, float limbSwing, float limbSwingAmount,
float ageInTicks, float netHeadYaw, float headPitch) {
playerModel.setAngles(entity, limbSwing, limbSwingAmount,
ageInTicks, netHeadYaw, headPitch);
}
}

View File

@@ -1,10 +1,7 @@
package dev.tggamesyt.szar.client; package dev.tggamesyt.szar.client;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import dev.tggamesyt.szar.NyanEntity; import dev.tggamesyt.szar.*;
import dev.tggamesyt.szar.PlaneEntity;
import dev.tggamesyt.szar.Szar;
import dev.tggamesyt.szar.PlaneAnimation;
import dev.tggamesyt.szar.ServerCosmetics.NameType; import dev.tggamesyt.szar.ServerCosmetics.NameType;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;

View File

@@ -1,11 +1,13 @@
package dev.tggamesyt.szar.client.mixin; package dev.tggamesyt.szar.client.mixin;
import dev.tggamesyt.szar.Szar; import dev.tggamesyt.szar.Szar;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

View File

@@ -2,8 +2,6 @@ package dev.tggamesyt.szar;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.ai.goal.LookAroundGoal;
import net.minecraft.entity.ai.goal.MeleeAttackGoal;
import net.minecraft.entity.ai.goal.WanderAroundFarGoal; import net.minecraft.entity.ai.goal.WanderAroundFarGoal;
import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributes;
@@ -20,6 +18,59 @@ import org.jetbrains.annotations.Nullable;
public class NaziEntity extends PathAwareEntity implements Arrestable{ public class NaziEntity extends PathAwareEntity implements Arrestable{
private boolean hithandPlaying = false;
private int hithandTimer = 0; // ticks remaining
private float hithandProgress = 0f; // 0 → 1 over animation duration
private int hithandCooldown = 0; // ticks remaining before we can roll again
// Call this to start the hand animation
public void playHithandAnimation() {
this.hithandPlaying = true;
this.hithandTimer = 20; // 20 ticks = 1 second
this.hithandProgress = 0f;
}
// Whether the animation is currently playing
public boolean isPlayingHandAnim() {
return hithandPlaying;
}
// Current animation progress (0 → 1)
public float getAnimationProgress() {
return hithandProgress;
}
@Override
public void tick() {
super.tick();
// --- Handle animation playing ---
if (hithandPlaying) {
hithandTimer--;
hithandProgress = (float)(20 - hithandTimer) / 20f;
if (hithandTimer <= 0) {
hithandPlaying = false;
hithandProgress = 0f;
// Start 2 second cooldown (40 ticks)
hithandCooldown = 40;
}
return; // don't roll while animating
}
// --- Handle cooldown ---
if (hithandCooldown > 0) {
hithandCooldown--;
return; // don't roll during cooldown
}
// --- Random roll ---
// 1/200 chance per tick ≈ once every 10 seconds on average
if (this.random.nextFloat() < 0.005f) {
playHithandAnimation();
}
}
public static boolean arrestable = false; public static boolean arrestable = false;
@Nullable @Nullable
private HitterEntity leader; private HitterEntity leader;

View File

@@ -86,6 +86,7 @@ public class Szar implements ModInitializer {
SoundEvent.of(new Identifier("szar", "merl")); SoundEvent.of(new Identifier("szar", "merl"));
public static final Identifier PLANE_ANIM_PACKET = public static final Identifier PLANE_ANIM_PACKET =
new Identifier(MOD_ID, "plane_anim"); new Identifier(MOD_ID, "plane_anim");
public static final Identifier NAZI_HAND_GESTURE = new Identifier("szar", "hit_hand");
public static final Identifier OPEN_URL = new Identifier(MOD_ID, "epsteinfiles"); public static final Identifier OPEN_URL = new Identifier(MOD_ID, "epsteinfiles");
public static final Block SZAR_BLOCK = public static final Block SZAR_BLOCK =