Skip to content

Commit

Permalink
0.6.12
Browse files Browse the repository at this point in the history
1.20.2 port
Updated Chinese and Spanish translation (#490, #495)
Tag Editor beta
- Create model specific item, block, entity or biome tags
- Only available through OSC (for now)
Editor QoL:
- Added draggable Popup windows
- Health, Hunger, Air animations show the current value
- The `(2)` counts up on duplicate (Closes #491)
- Improved editor icons (Closes #485), and various other gui improvements
- Added lock part keybind
- Added paste part data to all frames
- Added display toggle: show outlines
- Added find element keybind
- Added mouse wheel scroll sensitivity to keybind options
Added reset value layer keybind (CTRL+keybind will reset all)

Fixed gizmo breaking when dragging outside of the 3d area
Fixed spyglass item not rendering in the correct place in the editor
Fixed some buttons missing translations
Fixed Open Recent not updating in some cases
Fixed head rotation animations not showing in the editor
Fixed animation editor shows frame 0 in the first frame
Fixed part locking not saving on roots

OSC:
- Fixed value layers not outputting
- Fixed log spam with certain gestures
  • Loading branch information
tom5454 committed Sep 26, 2023
1 parent 04141f1 commit 61ac86f
Show file tree
Hide file tree
Showing 291 changed files with 11,977 additions and 8,409 deletions.
13,976 changes: 7,055 additions & 6,921 deletions Blockbench/cpm_plugin.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Blockbench/cpm_plugin.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions CPM-OSC-Compat/gradle.properties
Expand Up @@ -6,10 +6,10 @@ minecraft_version=1.18.2
loader_version=0.13.3
fabric_version=0.47.8+1.18.2

mod_version=1.4.0
mod_version=1.4.1

# CPM versions
cpm_api_version=0.6.11
cpm_runtime_version=0.6.11a
cpm_api_version=0.6.12
cpm_runtime_version=0.6.12a

cpm_source=com.tom5454.cpm
6 changes: 4 additions & 2 deletions CPM-OSC-Compat/src/shared/java/com/tom/cpmoscc/CPMOSC.java
Expand Up @@ -85,15 +85,17 @@ public static void tick(Object playerIn) {
reg.forEachLayer((g, id) -> {
if(g.command)return;
String gid = g.getName().replaceAll("[^a-zA-Z0-9\\.\\-]", "");
if (gid.isEmpty())
gid = "unnamed" + id;
try {
if(st.gestureData.length > id) {
if(g.type == AnimationType.VALUE_LAYER)
transmit.send("/cpm/layer/" + gid + "/value", st.gestureData[id]);
transmit.send("/cpm/layer/" + gid + "/value", Integer.valueOf(st.gestureData[id]));
else
transmit.send("/cpm/layer/" + gid + "/toggle", st.gestureData[id] != 0);
} else {
if(g.type == AnimationType.VALUE_LAYER)
transmit.send("/cpm/layer/" + gid + "/value", g.defVal);
transmit.send("/cpm/layer/" + gid + "/value", Integer.valueOf(g.defVal));
else
transmit.send("/cpm/layer/" + gid + "/toggle", g.defVal != 0);
}
Expand Down
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.10/gradle.properties
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.11a
mod_version=0.6.12a
Expand Up @@ -20,11 +20,13 @@
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

Expand All @@ -42,11 +44,13 @@
import com.tom.cpl.gui.elements.FileChooserPopup;
import com.tom.cpl.gui.elements.TextField;
import com.tom.cpl.gui.elements.TextField.ITextField;
import com.tom.cpl.item.Stack;
import com.tom.cpl.math.Box;
import com.tom.cpl.math.Vec2i;
import com.tom.cpl.text.IText;
import com.tom.cpl.util.AWTChooser;
import com.tom.cpm.CustomPlayerModels;
import com.tom.cpm.common.ItemStackHandlerImpl;
import com.tom.cpm.shared.gui.panel.Panel3d;
import com.tom.cpm.shared.util.Log;

Expand Down Expand Up @@ -615,4 +619,22 @@ public void openURL0(String url) {
public void onOpened() {
vanillaScale = -1;
}

@Override
public void drawStack(int x, int y, Stack stack) {
x += getOffset().x;
y += getOffset().y;
ItemStack s = ItemStackHandlerImpl.impl.unwrap(stack);
GlStateManager.enableDepth();
RenderHelper.enableGUIStandardItemLighting();
this.itemRender.renderItemAndEffectIntoGUI(this.mc.thePlayer, s, x, y);
this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, s, x, y, null);
GlStateManager.disableDepth();
}

@Override
public void drawStackTooltip(int mx, int my, Stack stack) {
ItemStack s = ItemStackHandlerImpl.impl.unwrap(stack);
renderToolTip(s, mx, my);
}
}
Expand Up @@ -9,18 +9,7 @@
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;

import com.tom.cpl.math.Box;
import com.tom.cpl.math.Mat4f;
Expand All @@ -29,9 +18,7 @@
import com.tom.cpl.render.RenderTypes;
import com.tom.cpl.render.VBuffers;
import com.tom.cpl.util.Image;
import com.tom.cpl.util.ItemSlot;
import com.tom.cpm.client.MinecraftObject.DynTexture;
import com.tom.cpm.shared.editor.DisplayItem;
import com.tom.cpm.shared.gui.ViewportCamera;
import com.tom.cpm.shared.gui.panel.Panel3d;
import com.tom.cpm.shared.gui.panel.Panel3d.Panel3dNative;
Expand Down Expand Up @@ -119,84 +106,6 @@ public Image takeScreenshot(Vec2i size) {
return rImg;
}

@Override
public void renderItem(MatrixStack stack, ItemSlot hand, DisplayItem item) {
renderItem(stack, getHandStack(item), hand);
}

private void renderItem(MatrixStack stack, ItemStack itemstack, ItemSlot hand) {
if (itemstack != null) {
GlStateManager.pushMatrix();

PlayerRenderManager.multiplyStacks(stack.getLast());
ItemCameraTransforms.TransformType view = ItemCameraTransforms.TransformType.FIXED;
boolean flag = false;
if(hand == ItemSlot.LEFT_HAND || hand == ItemSlot.RIGHT_HAND) {
GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
flag = hand == ItemSlot.LEFT_HAND;
view = flag ? ItemCameraTransforms.TransformType.THIRD_PERSON_LEFT_HAND : ItemCameraTransforms.TransformType.THIRD_PERSON_RIGHT_HAND;
GlStateManager.translate((flag ? -1 : 1) / 16.0F, 0.125F, -0.625F);
} else if(hand == ItemSlot.HEAD) {
Item item = itemstack.getItem();
if (item == Items.SKULL) {
GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), null, -1, 0);
GlStateManager.popMatrix();
return;
} else {
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.625F, -0.625F, -0.625F);
view = ItemCameraTransforms.TransformType.HEAD;
}
}
IBakedModel ibakedmodel = mc.getRenderItem().getItemModelWithOverrides(itemstack, (World)null, (EntityLivingBase)null);
renderItemModel(itemstack, ibakedmodel, view, flag);
GlStateManager.popMatrix();
}
}

/** Copy of {@link net.minecraft.client.renderer.RenderItem#renderItemModel}*/
private void renderItemModel(ItemStack stack, IBakedModel bakedmodel, ItemCameraTransforms.TransformType transform, boolean leftHanded) {
if (stack != null) {
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(516, 0.1F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.pushMatrix();
// TODO: check if negative scale is a thing
bakedmodel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(bakedmodel, transform, leftHanded);

mc.getRenderItem().renderItem(stack, bakedmodel);
GlStateManager.cullFace(GlStateManager.CullFace.BACK);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
}

private ItemStack getHandStack(DisplayItem item) {
switch (item) {
case BLOCK:
return new ItemStack(Blocks.STONE);
case NONE:
break;
case SWORD:
return new ItemStack(Items.DIAMOND_SWORD);
case SKULL:
return new ItemStack(Items.SKULL, 2);
default:
break;
}
return null;
}

@Override
public Mat4f getView() {
return Mat4f.map(GL11.GL_MODELVIEW_MATRIX, GL11::glGetFloat);
Expand Down
Expand Up @@ -43,7 +43,7 @@ public List<String> listTags(Biome state) {
}

@Override
public List<com.tom.cpl.block.Biome> getAllBiomes() {
public List<com.tom.cpl.block.Biome> getAllElements() {
return ForgeRegistries.BIOMES.getValues().stream().map(this::wrap).collect(Collectors.toList());
}

Expand Down Expand Up @@ -71,4 +71,9 @@ public float getHumidity(Biome state) {
public RainType getRainType(Biome state) {
return state.isSnowyBiome() ? RainType.SNOW : state.canRain() ? RainType.RAIN : RainType.NONE;
}

@Override
public boolean isAvailable() {
return true;
}
}
Expand Up @@ -91,7 +91,7 @@ public List<String> listNativeTags() {
}

@Override
public List<com.tom.cpl.block.BlockState> getAllBlocks() {
public List<com.tom.cpl.block.BlockState> getAllElements() {
return ForgeRegistries.BLOCKS.getValues().stream().map(b -> wrap(b.getDefaultState())).collect(Collectors.toList());
}

Expand Down
Expand Up @@ -5,6 +5,9 @@
import java.util.stream.Collectors;

import net.minecraft.entity.EntityList;
import net.minecraft.util.ResourceLocation;

import net.minecraftforge.fml.common.registry.ForgeRegistries;

import com.tom.cpl.block.entity.EntityType;
import com.tom.cpl.block.entity.EntityTypeHandler;
Expand Down Expand Up @@ -46,7 +49,7 @@ public List<String> listTags(Class<?> state) {
}

@Override
public List<EntityType> getAllTypes() {
public List<EntityType> getAllElements() {
return EntityList.CLASS_TO_NAME.keySet().stream().map(this::wrap).collect(Collectors.toList());
}

Expand All @@ -59,4 +62,9 @@ public boolean equals(Class<?> a, Class<?> b) {
public String getEntityId(Class<?> state) {
return EntityList.CLASS_TO_NAME.get(state);
}

@Override
public List<String> listAllActiveEffectTypes() {
return ForgeRegistries.POTIONS.getKeys().stream().map(ResourceLocation::toString).collect(Collectors.toList());
}
}
Expand Up @@ -64,11 +64,11 @@ public boolean itemEqualsFull(ItemStack a, ItemStack b) {

@Override
public List<String> listNativeTags() {
return Arrays.stream(OreDictionary.getOreNames()).map(t -> "oredict:" + t).collect(Collectors.toList());
return Arrays.stream(OreDictionary.getOreNames()).map(t -> "#oredict:" + t).collect(Collectors.toList());
}

@Override
public List<Stack> getAllItems() {
public List<Stack> getAllElements() {
List<ItemStack> stacks = new ArrayList<>();
ForgeRegistries.ITEMS.forEach(e -> e.getSubItems(e, CreativeTabs.SEARCH, stacks));
return stacks.stream().map(this::wrap).collect(Collectors.toList());
Expand Down Expand Up @@ -247,4 +247,9 @@ public String getItemId(ItemStack stack) {
public Stack emptyObject() {
return wrap(null);
}

@Override
public String getItemDisplayName(ItemStack stack) {
return stack.getDisplayName();
}
}
2 changes: 1 addition & 1 deletion CustomPlayerModels-1.12/gradle.properties
Expand Up @@ -3,4 +3,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=0.6.11a
mod_version=0.6.12a
Expand Up @@ -21,10 +21,12 @@
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

Expand All @@ -42,11 +44,13 @@
import com.tom.cpl.gui.elements.FileChooserPopup;
import com.tom.cpl.gui.elements.TextField;
import com.tom.cpl.gui.elements.TextField.ITextField;
import com.tom.cpl.item.Stack;
import com.tom.cpl.math.Box;
import com.tom.cpl.math.Vec2i;
import com.tom.cpl.text.IText;
import com.tom.cpl.util.AWTChooser;
import com.tom.cpm.CustomPlayerModels;
import com.tom.cpm.common.ItemStackHandlerImpl;
import com.tom.cpm.shared.gui.panel.Panel3d;
import com.tom.cpm.shared.util.Log;

Expand Down Expand Up @@ -615,4 +619,22 @@ public void openURL0(String url) {
public void onOpened() {
vanillaScale = -1;
}

@Override
public void drawStack(int x, int y, Stack stack) {
x += getOffset().x;
y += getOffset().y;
ItemStack s = ItemStackHandlerImpl.impl.unwrap(stack);
GlStateManager.enableDepth();
RenderHelper.enableGUIStandardItemLighting();
this.itemRender.renderItemAndEffectIntoGUI(this.mc.player, s, x, y);
this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, s, x, y, null);
GlStateManager.disableDepth();
}

@Override
public void drawStackTooltip(int mx, int my, Stack stack) {
ItemStack s = ItemStackHandlerImpl.impl.unwrap(stack);
renderToolTip(s, mx, my);
}
}

0 comments on commit 61ac86f

Please sign in to comment.