update: 1.4.0

This commit is contained in:
nimsolated
2026-03-05 20:37:41 -08:00
parent ffb0f8d129
commit ec6005769b
17 changed files with 436 additions and 77 deletions

View File

@@ -1,7 +1,6 @@
package net.mcreator.nimsrandombullshit.client.model;
import net.minecraft.world.entity.Entity;
import net.minecraft.util.Mth;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
@@ -65,11 +64,5 @@ public class Modelpeguin<T extends Entity> extends EntityModel<T> {
}
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
this.LeftLeg.xRot = Mth.cos(limbSwing * 1.0F) * -1.0F * limbSwingAmount;
this.RightArm.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * limbSwingAmount;
this.Head.yRot = netHeadYaw / (180F / (float) Math.PI);
this.Head.xRot = headPitch / (180F / (float) Math.PI);
this.RightLeg.xRot = Mth.cos(limbSwing * 1.0F) * 1.0F * limbSwingAmount;
this.LeftArm.xRot = Mth.cos(limbSwing * 0.6662F) * limbSwingAmount;
}
}

View File

@@ -0,0 +1,56 @@
package net.mcreator.nimsrandombullshit.client.model.animations;
import net.minecraft.client.animation.KeyframeAnimations;
import net.minecraft.client.animation.Keyframe;
import net.minecraft.client.animation.AnimationDefinition;
import net.minecraft.client.animation.AnimationChannel;
// Save this class in your mod and generate all required imports
/**
* Made with Blockbench 5.0.7 Exported for Minecraft version 1.19 or later with
* Mojang mappings
*
* @author Author
*/
public class tuxModelAnimation {
public static final AnimationDefinition walking = AnimationDefinition.Builder.withLength(1.0F).looping()
.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.75F, KeyframeAnimations.degreeVec(0.0F, -5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(1.0F, KeyframeAnimations.degreeVec(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.25F, KeyframeAnimations.degreeVec(0.0F, 7.5F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.addAnimation("RightArm",
new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.degreeVec(-27.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.75F, KeyframeAnimations.degreeVec(-27.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.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.25F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.75F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.addAnimation("BodySegment",
new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 12.5F, 0.0F), AnimationChannel.Interpolations.LINEAR), new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, -12.5F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.83F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.build();
public static final AnimationDefinition jumpUp = AnimationDefinition.Builder.withLength(0.25F)
.addAnimation("root",
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, 5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.addAnimation("RightArm",
new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.degreeVec(-67.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.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.25F, KeyframeAnimations.degreeVec(65.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.build();
public static final AnimationDefinition JumpDown = AnimationDefinition.Builder.withLength(0.25F)
.addAnimation("root",
new AnimationChannel(AnimationChannel.Targets.POSITION, new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.addAnimation("RightArm",
new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(-67.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION, new Keyframe(0.0F, KeyframeAnimations.degreeVec(65.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)))
.build();
}

View File

@@ -4,15 +4,19 @@ package net.mcreator.nimsrandombullshit.client.renderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.HierarchicalModel;
import net.mcreator.nimsrandombullshit.procedures.TuxPlaybackConditionWalkingProcedure;
import net.mcreator.nimsrandombullshit.entity.TuxEntity;
import net.mcreator.nimsrandombullshit.client.model.animations.tuxModelAnimation;
import net.mcreator.nimsrandombullshit.client.model.Modelpeguin;
import com.mojang.blaze3d.vertex.PoseStack;
public class TuxRenderer extends MobRenderer<TuxEntity, Modelpeguin<TuxEntity>> {
public TuxRenderer(EntityRendererProvider.Context context) {
super(context, new Modelpeguin<TuxEntity>(context.bakeLayer(Modelpeguin.LAYER_LOCATION)), 0.5f);
super(context, new AnimatedModel(context.bakeLayer(Modelpeguin.LAYER_LOCATION)), 0.5f);
}
@Override
@@ -24,4 +28,34 @@ public class TuxRenderer extends MobRenderer<TuxEntity, Modelpeguin<TuxEntity>>
public ResourceLocation getTextureLocation(TuxEntity entity) {
return new ResourceLocation("nims_random_bullshit:textures/entities/tux.png");
}
private static final class AnimatedModel extends Modelpeguin<TuxEntity> {
private final ModelPart root;
private final HierarchicalModel animator = new HierarchicalModel<TuxEntity>() {
@Override
public ModelPart root() {
return root;
}
@Override
public void setupAnim(TuxEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
this.root().getAllParts().forEach(ModelPart::resetPose);
if (TuxPlaybackConditionWalkingProcedure.execute(entity))
this.animateWalk(tuxModelAnimation.walking, limbSwing, limbSwingAmount, 1f, 1f);
this.animate(entity.animationState1, tuxModelAnimation.jumpUp, ageInTicks, 1f);
this.animate(entity.animationState2, tuxModelAnimation.JumpDown, ageInTicks, 1f);
}
};
public AnimatedModel(ModelPart root) {
super(root);
this.root = root;
}
@Override
public void setupAnim(TuxEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
animator.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
}
}
}

View File

@@ -23,6 +23,7 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.AnimationState;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.sounds.SoundEvent;
@@ -33,9 +34,13 @@ import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.chat.Component;
import net.mcreator.nimsrandombullshit.procedures.TuxPlaybackConditionJumpUpProcedure;
import net.mcreator.nimsrandombullshit.procedures.TuxPlaybackConditionFallingProcedure;
import net.mcreator.nimsrandombullshit.init.NimsRandomBullshitModEntities;
public class TuxEntity extends Monster {
public final AnimationState animationState1 = new AnimationState();
public final AnimationState animationState2 = new AnimationState();
private final ServerBossEvent bossInfo = new ServerBossEvent(this.getDisplayName(), ServerBossEvent.BossBarColor.BLUE, ServerBossEvent.BossBarOverlay.PROGRESS);
public TuxEntity(PlayMessages.SpawnEntity packet, Level world) {
@@ -108,6 +113,15 @@ public class TuxEntity extends Monster {
return super.hurt(damagesource, amount);
}
@Override
public void tick() {
super.tick();
if (this.level().isClientSide()) {
this.animationState1.animateWhen(TuxPlaybackConditionJumpUpProcedure.execute(this), this.tickCount);
this.animationState2.animateWhen(TuxPlaybackConditionFallingProcedure.execute(this), this.tickCount);
}
}
@Override
public boolean canChangeDimensions() {
return false;

View File

@@ -64,7 +64,7 @@ public class LabelCopyMachineGUIButtonMessage {
return;
if (buttonID == 0) {
LabelCopyMachineCopyButtonPressedProcedure.execute(entity);
LabelCopyMachineCopyButtonPressedProcedure.execute(world, entity);
}
}

View File

@@ -1,5 +1,6 @@
package net.mcreator.nimsrandombullshit.procedures;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.entity.player.Player;
@@ -11,73 +12,75 @@ import java.util.function.Supplier;
import java.util.Map;
public class LabelCopyMachineCopyButtonPressedProcedure {
public static void execute(Entity entity) {
public static void execute(LevelAccessor world, Entity entity) {
if (entity == null)
return;
if ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).getItem() == NimsRandomBullshitModItems.SHIPPING_LABEL
.get() && new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
if (!world.isClientSide()) {
if ((entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY)
.getItem() == NimsRandomBullshitModItems.SHIPPING_LABEL.get() && new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}
return 0;
}
return 0;
}
}.getAmount(1) > 0 && new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}.getAmount(1) > 0 && new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}
return 0;
}
return 0;
}
}.getAmount(2) > 0) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(1)).getItem() : ItemStack.EMPTY).copy();
_setstack.setCount((int) (new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}.getAmount(2) > 0) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(1)).getItem() : ItemStack.EMPTY).copy();
_setstack.setCount((int) (new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}
return 0;
}
return 0;
}
}.getAmount(1) - 1));
((Slot) _slots.get(1)).set(_setstack);
_player.containerMenu.broadcastChanges();
}
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(2)).getItem() : ItemStack.EMPTY).copy();
_setstack.setCount((int) (new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}.getAmount(1) - 1));
((Slot) _slots.get(1)).set(_setstack);
_player.containerMenu.broadcastChanges();
}
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(2)).getItem() : ItemStack.EMPTY).copy();
_setstack.setCount((int) (new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}
return 0;
}
return 0;
}
}.getAmount(2) - 1));
((Slot) _slots.get(2)).set(_setstack);
_player.containerMenu.broadcastChanges();
}
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).copy();
_setstack.setCount((int) (new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}.getAmount(2) - 1));
((Slot) _slots.get(2)).set(_setstack);
_player.containerMenu.broadcastChanges();
}
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack _setstack = (entity instanceof Player _plrSlotItem && _plrSlotItem.containerMenu instanceof Supplier _splr && _splr.get() instanceof Map _slt ? ((Slot) _slt.get(0)).getItem() : ItemStack.EMPTY).copy();
_setstack.setCount((int) (new Object() {
public int getAmount(int sltid) {
if (entity instanceof Player _player && _player.containerMenu instanceof Supplier _current && _current.get() instanceof Map _slots) {
ItemStack stack = ((Slot) _slots.get(sltid)).getItem();
if (stack != null)
return stack.getCount();
}
return 0;
}
return 0;
}
}.getAmount(3) + 1));
((Slot) _slots.get(3)).set(_setstack);
_player.containerMenu.broadcastChanges();
}.getAmount(3) + 1));
((Slot) _slots.get(3)).set(_setstack);
_player.containerMenu.broadcastChanges();
}
}
}
}

View File

@@ -0,0 +1,14 @@
package net.mcreator.nimsrandombullshit.procedures;
import net.minecraft.world.entity.Entity;
public class TuxPlaybackConditionFallingProcedure {
public static boolean execute(Entity entity) {
if (entity == null)
return false;
if (entity.getDeltaMovement().y() < 0) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,14 @@
package net.mcreator.nimsrandombullshit.procedures;
import net.minecraft.world.entity.Entity;
public class TuxPlaybackConditionJumpUpProcedure {
public static boolean execute(Entity entity) {
if (entity == null)
return false;
if (entity.getDeltaMovement().y() > 0) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,14 @@
package net.mcreator.nimsrandombullshit.procedures;
import net.minecraft.world.entity.Entity;
public class TuxPlaybackConditionWalkingProcedure {
public static boolean execute(Entity entity) {
if (entity == null)
return false;
if (entity.getDeltaMovement().x() > 0 || entity.getDeltaMovement().z() > 0) {
return true;
}
return false;
}
}