Skip to content

Commit

Permalink
0.6.2a
Browse files Browse the repository at this point in the history
Added duplicate animation option (Closes #325)
Added copy animation frame and pose options (#62)
Added 'Focus on Part' keybind

Fixed custom armor not rendering in fabric (Closes #327)
Fixed held item looking weird on 1.19.3 (Closes #326)
Fixed race condition crash with model loading and rendering (Closes #331)
Fixed Fill UV, and Mirror Element not working with multi-select
Fixed Mirror Element not working with per-face UV

Updated web editor source
Fixed language decoding error (Closes #328)
  • Loading branch information
tom5454 committed Dec 22, 2022
1 parent c151bb6 commit 3f2d792
Show file tree
Hide file tree
Showing 212 changed files with 20,904 additions and 567 deletions.
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.10/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.12/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.16/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.17/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.18/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
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.Desc;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Surrogate;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.Model;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
Expand All @@ -35,6 +36,7 @@ public HumanoidArmorLayerMixin(RenderLayerParent<LivingEntity, HumanoidModel<Liv

private @Final @Shadow HumanoidModel<LivingEntity> innerModel;
private @Final @Shadow HumanoidModel<LivingEntity> outerModel;
@Shadow abstract ResourceLocation getArmorLocation(ArmorItem armorItem, boolean bl, @Nullable String string);

@Inject(at = @At("HEAD"),
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
Expand All @@ -53,24 +55,14 @@ public void postRender(PoseStack matrixStackIn, MultiBufferSource bufferIn, int
CustomPlayerModelsClient.INSTANCE.manager.unbind(innerModel);
}

@Inject(at = @At("HEAD"),
method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
+ "ZLnet/minecraft/client/model/HumanoidModel;FFFLnet/minecraft/resources/ResourceLocation;)V", expect = 0, remap = false, require = 0)
//Optifine, forge < 39.0.57 TODO: remove
@Surrogate
private void preRenderTexture(PoseStack p_241738_1_, MultiBufferSource p_241738_2_, int p_241738_3_, boolean p_241738_5_, HumanoidModel<LivingEntity> model, float p_241738_8_, float p_241738_9_, float p_241738_10_, ResourceLocation resLoc, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(resLoc, PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
@Inject(at = @At("HEAD"), method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
+ "Lnet/minecraft/world/item/ArmorItem;ZLnet/minecraft/client/model/HumanoidModel;ZFFFLjava/lang/String;)V")
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, ArmorItem p_117110_, boolean p_117111_, HumanoidModel<LivingEntity> model, boolean p_117113_, float p_117114_, float p_117115_, float p_117116_, @Nullable String p_117117_, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(getArmorLocation(p_117110_, p_117113_, p_117117_), PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}

//Dummy if optifine doesn't exist
@Surrogate
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, ArmorItem p_117110_, boolean p_117111_, HumanoidModel<LivingEntity> p_117112_, boolean p_117113_, float p_117114_, float p_117115_, float p_117116_, @Nullable String p_117117_, CallbackInfo cbi) {}

@Inject(at = @At("HEAD"),
method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
+ "ZLnet/minecraft/client/model/Model;FFFLnet/minecraft/resources/ResourceLocation;)V", remap = false, require = 0)
@Surrogate
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, net.minecraft.client.model.Model model, float p_117114_, float p_117115_, float p_117116_, ResourceLocation resLoc, CallbackInfo cbi) {
@Inject(at = @At("HEAD"), target = @Desc(value = "renderModel", args = {PoseStack.class, MultiBufferSource.class, int.class, boolean.class, Model.class, float.class, float.class, float.class, ResourceLocation.class}), remap = false, require = 0, expect = 0)
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, Model model, float p_117114_, float p_117115_, float p_117116_, ResourceLocation resLoc, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(resLoc, PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}
}
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.19.3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ dependencies {
// http://www.gradle.org/docs/current/userguide/dependency_management.html
compileOnly files("of.jar")

compileOnly fg.deobf("com.github.Virtuoel:Pehkui:3.6.0-1.19.2-forge")
compileOnly fg.deobf("com.github.Virtuoel:Pehkui:3.6.1-1.19.3-forge")
compileOnly fg.deobf('curse.maven:vivecraft-667903:4160377')
}

Expand Down
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.19.3/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public void renderParent() {
}

public static void multiplyStacks(MatrixStack.Entry e, PoseStack stack) {
stack.last().pose().mul(new Matrix4f().set(e.getMatrixArray()));
stack.last().normal().mul(new Matrix3f().set(e.getNormalArray3()));
stack.last().pose().mul(new Matrix4f().setTransposed(e.getMatrixArray()));
stack.last().normal().mul(new Matrix3f().set(e.getNormalArray3()).transpose());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
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.Desc;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Surrogate;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.Model;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
Expand All @@ -35,6 +36,7 @@ public HumanoidArmorLayerMixin(RenderLayerParent<LivingEntity, HumanoidModel<Liv

private @Final @Shadow HumanoidModel<LivingEntity> innerModel;
private @Final @Shadow HumanoidModel<LivingEntity> outerModel;
@Shadow abstract ResourceLocation getArmorLocation(ArmorItem armorItem, boolean bl, @Nullable String string);

@Inject(at = @At("HEAD"),
method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
Expand All @@ -53,22 +55,14 @@ public void postRender(PoseStack matrixStackIn, MultiBufferSource bufferIn, int
CustomPlayerModelsClient.INSTANCE.manager.unbind(innerModel);
}

@Inject(at = @At("HEAD"),
method = "renderModel", expect = 0, remap = false, require = 0)
//Optifine, forge < 39.0.57 TODO: remove
@Surrogate
private void preRenderTexture(PoseStack p_241738_1_, MultiBufferSource p_241738_2_, int p_241738_3_, boolean p_241738_5_, HumanoidModel<LivingEntity> model, float p_241738_8_, float p_241738_9_, float p_241738_10_, ResourceLocation resLoc, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(resLoc, PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
@Inject(at = @At("HEAD"), method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
+ "Lnet/minecraft/world/item/ArmorItem;ZLnet/minecraft/client/model/HumanoidModel;ZFFFLjava/lang/String;)V")
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, ArmorItem p_117110_, boolean p_117111_, HumanoidModel<LivingEntity> model, boolean p_117113_, float p_117114_, float p_117115_, float p_117116_, @Nullable String p_117117_, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(getArmorLocation(p_117110_, p_117113_, p_117117_), PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}

//Dummy if optifine doesn't exist
@Surrogate
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, ArmorItem p_117110_, boolean p_117111_, HumanoidModel<LivingEntity> p_117112_, boolean p_117113_, float p_117114_, float p_117115_, float p_117116_, @Nullable String p_117117_, CallbackInfo cbi) {}

@Inject(at = @At("HEAD"),
method = "renderModel", remap = false, require = 0)
@Surrogate
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, net.minecraft.client.model.Model model, float p_117114_, float p_117115_, float p_117116_, ResourceLocation resLoc, CallbackInfo cbi) {
@Inject(at = @At("HEAD"), target = @Desc(value = "renderModel", args = {PoseStack.class, MultiBufferSource.class, int.class, boolean.class, Model.class, float.class, float.class, float.class, ResourceLocation.class}), remap = false, require = 0, expect = 0)
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, Model model, float p_117114_, float p_117115_, float p_117116_, ResourceLocation resLoc, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(resLoc, PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}
}
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.19/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.19.2-43.1.2'
minecraft 'net.minecraftforge:forge:1.19.2-43.2.0'

// Mixin annotation processor - generates the refmap
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
Expand Down
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.19/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
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.Desc;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Surrogate;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.Model;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer;
Expand Down Expand Up @@ -54,19 +55,14 @@ public void postRender(PoseStack matrixStackIn, MultiBufferSource bufferIn, int
CustomPlayerModelsClient.INSTANCE.manager.unbind(innerModel);
}


@Surrogate
private void preRenderTexture(PoseStack p_241738_1_, MultiBufferSource p_241738_2_, int p_241738_3_, boolean p_241738_5_, HumanoidModel<LivingEntity> model, float p_241738_8_, float p_241738_9_, float p_241738_10_, ResourceLocation resLoc, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(resLoc, PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}

@Inject(at = @At("HEAD"), method = "renderModel")
@Inject(at = @At("HEAD"), method = "renderModel(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I"
+ "Lnet/minecraft/world/item/ArmorItem;ZLnet/minecraft/client/model/HumanoidModel;ZFFFLjava/lang/String;)V")
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, ArmorItem p_117110_, boolean p_117111_, HumanoidModel<LivingEntity> model, boolean p_117113_, float p_117114_, float p_117115_, float p_117116_, @Nullable String p_117117_, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(getArmorLocation(p_117110_, p_117113_, p_117117_), PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}

@Surrogate
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, net.minecraft.client.model.Model model, float p_117114_, float p_117115_, float p_117116_, ResourceLocation resLoc, CallbackInfo cbi) {
@Inject(at = @At("HEAD"), target = @Desc(value = "renderModel", args = {PoseStack.class, MultiBufferSource.class, int.class, boolean.class, Model.class, float.class, float.class, float.class, ResourceLocation.class}), remap = false, require = 0, expect = 0)
private void preRenderTexture(PoseStack p_117107_, MultiBufferSource p_117108_, int p_117109_, boolean p_117111_, Model model, float p_117114_, float p_117115_, float p_117116_, ResourceLocation resLoc, CallbackInfo cbi) {
CustomPlayerModelsClient.mc.getPlayerRenderManager().bindSkin(model, new ModelTexture(resLoc, PlayerRenderManager.armor), model == innerModel ? TextureSheetType.ARMOR2 : TextureSheetType.ARMOR1);
}
}
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.7/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
project_type=forge
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.8/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a

project_type=forge
2 changes: 1 addition & 1 deletion CustomPlayerModels-Bukkit/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1a
mod_version=0.6.2a
2 changes: 1 addition & 1 deletion CustomPlayerModels/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.1
mod_version=0.6.2
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ public enum Direction {
UP, DOWN, NORTH, SOUTH, EAST, WEST
;
public static final Direction[] VALUES = values();

public static enum Axis {
X, Y, Z
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,14 @@ else if(g.defVal != 0)
h.animate(player.animState, time);
} catch (Exception e) {
Log.warn("Error animating model", e);
def.resetAnimationPos();
h.clear();
try {
def.resetAnimationPos();
h.clear();
} catch (Exception ex) {
ex.addSuppressed(e);
Log.error("Error animating model", e);
def.setError(ex);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.tom.cpm.shared.editor.anim.EditorAnim;
import com.tom.cpm.shared.editor.elements.ElementType;
import com.tom.cpm.shared.editor.elements.ModelElement;
import com.tom.cpm.shared.editor.elements.MultiSelector;
import com.tom.cpm.shared.editor.elements.RootGroups;
import com.tom.cpm.shared.editor.gui.ModeDisplayType;
import com.tom.cpm.shared.editor.gui.RenderUtil;
Expand Down Expand Up @@ -816,6 +817,18 @@ public ModelElement getSelectedElement() {
return selectedElement instanceof ModelElement ? (ModelElement) selectedElement : null;
}

public void forEachSeletectedElement(Consumer<TreeElement> el) {
TreeElement elem = selectedElement;
if(selectedElement instanceof TreeSettingElement) {
elem = ((TreeSettingElement) selectedElement).getParent();
}
if(elem instanceof MultiSelector) {
((MultiSelector)elem).forEachSelected(el);
} else {
el.accept(elem);
}
}

public void free() {
textures.values().forEach(ETextures::free);
definition.cleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ private void drawSelectionBox(RedirectPartRenderer renderer, MatrixStack stack,

@Override
public void render(RedirectRenderer<?> renderer, MatrixStack stack, VBuffers buf, RenderTypes<RenderMode> renderTypes, RenderedCube cube, boolean doRenderElems) {
if(cube.getCube() instanceof ModelElement) {
ModelElement me = (ModelElement) cube.getCube();
me.matrixPosition = stack.getLast().getMatrix().copy();
}
drawSelectionBox((RedirectPartRenderer) renderer, stack, buf, renderTypes, cube, doRenderElems);
if(!doRenderElems)return;
drawGizmo(cube, stack, buf, renderTypes);
Expand Down
Loading

0 comments on commit 3f2d792

Please sign in to comment.