Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ dependencies {
include(modImplementation("com.github.pavatus:sakitus:${project.sakitus_version}")) {
exclude(group: "net.fabricmc.fabric-api")
}
include(modImplementation("com.github.duzos:animation-mc:${project.anim_version}")) {
exclude(group: "net.fabricmc.fabric-api")
}
}

processResources {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ mod_id = squid

# Dependencies
fabric_version=0.92.3+1.20.1
sakitus_version = v1.0.2-1.20
sakitus_version = v1.0.2-1.20
anim_version = 1.0.0.16-1.20.1-release
9 changes: 8 additions & 1 deletion src/main/java/dev/pavatus/squid/SquidMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.minecraft.util.Identifier;

import dev.pavatus.squid.core.SquidBlockEntities;
import dev.pavatus.squid.core.SquidBlocks;
import dev.pavatus.squid.core.SquidEntities;
import dev.pavatus.squid.core.SquidItems;

public class SquidMod implements ModInitializer {
public static final String MOD_ID = "squid_mod";
public static final String MOD_ID = "squid";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

@Override
public void onInitialize() {
RegistryContainer.register(SquidItems.class, MOD_ID);
RegistryContainer.register(SquidItems.Groups.class, MOD_ID);
RegistryContainer.register(SquidBlocks.class, MOD_ID);
RegistryContainer.register(SquidBlockEntities.class, MOD_ID);
RegistryContainer.register(SquidEntities.class, MOD_ID);
}

public static Identifier id(String path) {
return new Identifier(MOD_ID, path);
}
}
10 changes: 0 additions & 10 deletions src/main/java/dev/pavatus/squid/client/ClientSquidMod.java

This file was deleted.

20 changes: 20 additions & 0 deletions src/main/java/dev/pavatus/squid/client/SquidModClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.pavatus.squid.client;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;

import dev.pavatus.squid.client.renderers.CoffinEntityRenderer;
import dev.pavatus.squid.core.SquidEntities;

public class SquidModClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
registerEntityRenderers();
HudRenderCallback.EVENT.register(new SquidOverlay());
}

public void registerEntityRenderers() {
EntityRendererRegistry.register(SquidEntities.COFFIN_ENTITY_TYPE, CoffinEntityRenderer::new);
}
}
32 changes: 32 additions & 0 deletions src/main/java/dev/pavatus/squid/client/SquidOverlay.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package dev.pavatus.squid.client;

import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.util.Identifier;

import dev.pavatus.squid.SquidMod;
import dev.pavatus.squid.core.items.wearables.MaskItem;

public class SquidOverlay implements HudRenderCallback {

private static final Identifier OVERLAY = new Identifier(SquidMod.MOD_ID, "textures/gui/overlays/mask_moire.png");

@Override
public void onHudRender(DrawContext drawContext, float tickDelta) {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player == null) return;

boolean hasMaskOn = client.player.getEquippedStack(EquipmentSlot.HEAD).getItem() instanceof MaskItem;
if (hasMaskOn && client.options.getPerspective().isFirstPerson()) {
RenderSystem.depthMask(false);
drawContext.setShaderColor(1.0F, 1.0F, 1.0F, 1.0f);
drawContext.drawTexture(OVERLAY, 0, 0, -200, 0, 0, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight(), drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight());
RenderSystem.depthMask(true);
drawContext.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package dev.pavatus.squid.client.animations;// Save this class in your mod and generate all required imports

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;

public class MP5GunAnimations {
public static final Animation MP5_RELOAD = Animation.Builder.create(2.7917F).looping()
.addBoneAnimation("gun", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 4.5217F), Transformation.Interpolations.CUBIC),
new Keyframe(0.125F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 7.5F), Transformation.Interpolations.CUBIC),
new Keyframe(0.375F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, 7.5F), Transformation.Interpolations.CUBIC),
new Keyframe(0.5417F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, -25.0F), Transformation.Interpolations.CUBIC),
new Keyframe(0.7917F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, -32.5F), Transformation.Interpolations.CUBIC),
new Keyframe(0.9583F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, -25.0F), Transformation.Interpolations.CUBIC),
new Keyframe(1.125F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, -25.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.125F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, -25.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.2917F, AnimationHelper.createRotationalVector(-49.665F, -34.3552F, -25.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.4583F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, 7.5F), Transformation.Interpolations.CUBIC),
new Keyframe(2.5833F, AnimationHelper.createRotationalVector(-19.665F, -34.3552F, 7.5F), Transformation.Interpolations.CUBIC),
new Keyframe(2.7917F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC)
))
.addBoneAnimation("gun", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC)
))
.addBoneAnimation("mag", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(0.875F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -35.0F), Transformation.Interpolations.CUBIC),
new Keyframe(1.7917F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -35.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC)
))
.addBoneAnimation("mag", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(0.875F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, -1.0F), Transformation.Interpolations.CUBIC),
new Keyframe(1.25F, AnimationHelper.createTranslationalVector(9.4525F, -20.9035F, -1.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.5417F, AnimationHelper.createTranslationalVector(9.4525F, -20.9035F, -1.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.7917F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, -1.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC)
))
.addBoneAnimation("mag", new Transformation(Transformation.Targets.SCALE,
new Keyframe(1.2083F, AnimationHelper.createScalingVector(1.0F, 1.0F, 1.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.25F, AnimationHelper.createScalingVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.5F, AnimationHelper.createScalingVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(1.5417F, AnimationHelper.createScalingVector(1.0F, 1.0F, 1.0F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("release", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(0.875F, AnimationHelper.createRotationalVector(-20.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.0F, AnimationHelper.createRotationalVector(-20.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.125F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC)
))
.addBoneAnimation("rack", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 4.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.2917F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 4.0F), Transformation.Interpolations.CUBIC),
new Keyframe(2.4583F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC)
))
.addBoneAnimation("leftArm", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.75F, AnimationHelper.createRotationalVector(-0.5319F, 2.5814F, -8.1826F), Transformation.Interpolations.LINEAR),
new Keyframe(0.9583F, AnimationHelper.createRotationalVector(-8.1182F, -10.3339F, -11.4164F), Transformation.Interpolations.LINEAR),
new Keyframe(1.125F, AnimationHelper.createRotationalVector(35.2248F, -26.3865F, -25.927F), Transformation.Interpolations.LINEAR),
new Keyframe(1.5417F, AnimationHelper.createRotationalVector(39.9833F, -3.4241F, -14.8976F), Transformation.Interpolations.LINEAR),
new Keyframe(1.7917F, AnimationHelper.createRotationalVector(-5.1991F, -14.7593F, 1.3833F), Transformation.Interpolations.LINEAR),
new Keyframe(2.0F, AnimationHelper.createRotationalVector(-10.0167F, -3.4241F, -14.8976F), Transformation.Interpolations.LINEAR),
new Keyframe(2.125F, AnimationHelper.createRotationalVector(-5.1991F, -14.7593F, 1.3833F), Transformation.Interpolations.LINEAR),
new Keyframe(2.2917F, AnimationHelper.createRotationalVector(-10.0167F, -3.4241F, -14.8976F), Transformation.Interpolations.LINEAR)
))
.addBoneAnimation("leftArm", new Transformation(Transformation.Targets.TRANSLATE,
new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR),
new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-0.0403F, -5.8938F, 3.3552F), Transformation.Interpolations.LINEAR),
new Keyframe(0.9583F, AnimationHelper.createTranslationalVector(-0.0403F, -5.8938F, 3.3552F), Transformation.Interpolations.LINEAR),
new Keyframe(1.125F, AnimationHelper.createTranslationalVector(1.0579F, -7.3438F, 4.1869F), Transformation.Interpolations.LINEAR),
new Keyframe(1.2083F, AnimationHelper.createTranslationalVector(2.6726F, -9.568F, 5.3812F), Transformation.Interpolations.LINEAR),
new Keyframe(1.6667F, AnimationHelper.createTranslationalVector(2.1564F, -8.7898F, 5.0234F), Transformation.Interpolations.LINEAR),
new Keyframe(1.7917F, AnimationHelper.createTranslationalVector(-0.0403F, -5.8938F, 3.3552F), Transformation.Interpolations.LINEAR),
new Keyframe(2.0F, AnimationHelper.createTranslationalVector(-0.0403F, -5.8938F, 3.3552F), Transformation.Interpolations.LINEAR),
new Keyframe(2.125F, AnimationHelper.createTranslationalVector(0.6299F, 1.8851F, 5.1205F), Transformation.Interpolations.LINEAR),
new Keyframe(2.2917F, AnimationHelper.createTranslationalVector(0.3598F, 2.7038F, 2.5509F), Transformation.Interpolations.LINEAR),
new Keyframe(2.5833F, AnimationHelper.createTranslationalVector(-0.0403F, -5.8938F, 3.3552F), Transformation.Interpolations.LINEAR),
new Keyframe(2.7917F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();

public static final Animation MP5_SPRINT = Animation.Builder.create(0.0F).looping()
.addBoneAnimation("gun", new Transformation(Transformation.Targets.ROTATE,
new Keyframe(0.0F, AnimationHelper.createRotationalVector(22.5F, -60.0F, 0.0F), Transformation.Interpolations.LINEAR)
))
.build();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package dev.pavatus.squid.client.models;

import net.minecraft.client.model.*;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;

@SuppressWarnings({"rawtypes", "unused"})
public class CoffinEntityModel extends SinglePartEntityModel {
public final ModelPart coffin;
public final ModelPart lid;
public final ModelPart casing;
public final ModelPart organ_marker;
public CoffinEntityModel(ModelPart root) {
this.coffin = root.getChild("coffin");
this.lid = this.coffin.getChild("lid");
this.casing = this.coffin.getChild("casing");
this.organ_marker = this.coffin.getChild("organ_marker");
}
public static TexturedModelData getTexturedModelData() {
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
ModelPartData coffin = modelPartData.addChild("coffin", ModelPartBuilder.create(), ModelTransform.pivot(0.0F, 18.0F, 0.0F));

ModelPartData lid = coffin.addChild("lid", ModelPartBuilder.create().uv(0, 0).cuboid(-8.0F, -0.5F, -16.0F, 16.0F, 1.0F, 32.0F, new Dilation(0.0F))
.uv(0, 34).cuboid(-8.0F, -0.5F, -16.0F, 16.0F, 1.0F, 32.0F, new Dilation(0.5F)), ModelTransform.pivot(0.0F, -4.5F, 0.0F));

ModelPartData casing = coffin.addChild("casing", ModelPartBuilder.create().uv(97, 0).cuboid(7.0F, -10.0F, -16.0F, 1.0F, 9.0F, 32.0F, new Dilation(0.0F))
.uv(97, 84).cuboid(-7.0F, -10.0F, -16.0F, 14.0F, 9.0F, 1.0F, new Dilation(0.0F))
.uv(97, 95).cuboid(-7.0F, -10.0F, 15.0F, 14.0F, 9.0F, 1.0F, new Dilation(0.0F))
.uv(97, 42).cuboid(-8.0F, -10.0F, -16.0F, 1.0F, 9.0F, 32.0F, new Dilation(0.0F))
.uv(0, 68).cuboid(-8.0F, -1.0F, -16.0F, 16.0F, 1.0F, 32.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 6.0F, 0.0F));

ModelPartData organ_marker = coffin.addChild("organ_marker", ModelPartBuilder.create().uv(0, -3).cuboid(-1.0F, -2.0F, -2.0F, 0.0F, 4.0F, 3.0F, new Dilation(0.002F)), ModelTransform.pivot(9.1F, -2.0F, 14.0F));
return TexturedModelData.of(modelData, 256, 256);
}
@Override
public void setAngles(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
coffin.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
}

@Override
public ModelPart getPart() {
return coffin;
}
}
36 changes: 36 additions & 0 deletions src/main/java/dev/pavatus/squid/client/models/GuardMaskModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package dev.pavatus.squid.client.models;

import net.minecraft.client.model.*;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.SinglePartEntityModel;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;

@SuppressWarnings({"rawtypes", "unused"})
public class GuardMaskModel extends SinglePartEntityModel {
private final ModelPart mask;
public GuardMaskModel(ModelPart root) {
this.mask = root.getChild("wearables");
}
public static TexturedModelData getTexturedModelData() {
ModelData modelData = new ModelData();
ModelPartData modelPartData = modelData.getRoot();
ModelPartData mask = modelPartData.addChild("wearables", ModelPartBuilder.create().uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.0F))
.uv(0, 16).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.5F)), ModelTransform.pivot(0.0F, 0.0F, 0.0F));
return TexturedModelData.of(modelData, 32, 32);
}
@Override
public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, float red, float green, float blue, float alpha) {
mask.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
}

@Override
public ModelPart getPart() {
return mask;
}

@Override
public void setAngles(Entity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {

}
}
Loading
Loading