Giter Club home page Giter Club logo

minerender's Introduction

Build Status Documentation Coverage

MineRender

MineRender

Quick, Easy, Interactive 3D/2D Renders of Minecraft

MineRender.org

minerender's People

Contributors

inventivetalentdev avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minerender's Issues

How to enable animation or change player's pose?

I see animated demo on https://minerender.org/demo/skin/
but where is option to enable animation? here https://minerender.org/#getting-started

I found on demo skinRender event:

document.body.addEventListener("skinRender", function (e) {
var t = (Date.now() - startTime) / 1000;
e.detail.playerModel.children[2].rotation.x = Math.sin(t * 5) / 2;
e.detail.playerModel.children[3].rotation.x = -Math.sin(t * 5) / 2;
e.detail.playerModel.children[4].rotation.x = Math.sin(t * 5) / 2;
e.detail.playerModel.children[5].rotation.x = -Math.sin(t * 5) / 2;
});

but when i'm rendering, this event never happens

My code:

var skinRender = new SkinRender({
        /* options */
        autoResize: false,      // Whether to automatically resize the canvas
        controls: {
            enabled: false,      // Toggle controls
            zoom: false,         // Toggle zooming
            rotate: false,      // Toggle rotation
            pan: false           // Toggle panning
        },
        canvas: {               // Dimensions the canvas starts off with (undefined -> use window size)
            width: 400,
            height: 400
        },
        render: {
            taa: true
        },
        pauseHidden: false
    }, document.getElementById("mySkinContainer"));

var startTime = Date.now();

document.body.addEventListener("skinRender", function (e) {
    var t = (Date.now() - startTime) / 1000;
    e.detail.playerModel.children[2].rotation.x = Math.sin(t * 5) / 2;
    e.detail.playerModel.children[3].rotation.x = -Math.sin(t * 5) / 2;
    e.detail.playerModel.children[4].rotation.x = Math.sin(t * 5) / 2;
    e.detail.playerModel.children[5].rotation.x = -Math.sin(t * 5) / 2;

});

skinRender.render(skinURL);

Any idea why event "skinRender" never happens or how to modify playerModel?

Incorrect behaviour of legacy IDs

Given the schematic viewed below (made in 1.12.2), and the provided code to load this schematic, the output is not correct as blocks are missing.
2020-05-12_18 05 07
Screenshot_2020-05-12 Screenshot

This issue is caused by problems with the legacy mapping of ID that are >= 128. This issue seems related to incorrect handling of signed and unsigned numbers (block IDs are unsigned). The browser console outputs:

  • Missing legacy mapping for -97:9 (modelConverter.js:240:25) for the cyan terracotta
  • Missing legacy mapping for -128:1 (modelConverter.js:240:25) for the sandstone stairs

Note that the ID of sandstone stairs is 128, which in the case of signed integers results in -128 (256 - 128 = 128).
Note that the ID of terracotta is 159, which in the case of signed integers results in -97 (256 - 159 = 97)

This issue seems to be related to the NBT handling, as seen in this issue of the prismarine-nbt library, which is used for this: PrismarineJS/prismarine-nbt#14.

Code used for generating the schematic:

window.modelRender = new ModelRender({
   showAxes: false,
   showGrid: false,
   autoResize: true,
   showOutlines: false,
   centerCubes: true,
   mergeModels: true,
   camera: {
      type: "perspective",
      x: 100, y: 200, z: 100,
      target: [0, 0, 0]
   },
   sendStats: true
})

let modelConverter = new ModelConverter();
modelConverter.schematicToModels({
   url: "/test.schematic"
}, function (models) {
   modelRender.render(models);
});

Is there a way to render both a skin and an item?

Thank you for the library,

I was wondering if it's possible to render skins with items equipped? For example render a skin that is holding a diamond sword or wearing armor? I feel that it may be out of scope for this library but figured I'd ask before setting out to do it from scratch

Body parts rendering in the wrong places

Hi, as I mentioned on the discord server, some body parts in the skin renderer are displayed in the wrong place, and some of the faces are flipped or rotated.

It happens with all the skins, its just unnoticeable for most of them because the legs and arms are usually almost mirrored and the flipped faces are mostly hidden.

I used the skin below to check what parts are messed up and i made a list of them, which is in the attached file.
The white parts of the skin should always be on the right and the blue parts on the left. The red letters should be displayed on the correct face and not flipped. On the bottom and top faces, the 2 red pixels should be closer to the left side and the front side of the skin.
image

MineRender Wrong Parts.docx

skin transparency not work

Is your feature request related to a problem? Please describe.
When I go to the Demo Site (https://minerender.org/demo/skin/#Niceattack) the Skin Viewer will not show the Skin correct. The Skin uses transparency on the second skin layer.

Describe the solution you'd like
Please add the possibility that the Skin Viewer can also display skins correctly with transparent elements.

Redirects are jumping to http:// intermediately

If one requests embed/skin?skin=xxxx, it redirects back to http to add the / before the ?skin as /skin/?skin

However, this hop jumps to the http site before going to https, breaking the iframe

Was able to fix it on my end obviously by just adding the slash, but figured I'd report it.

>>> curl -vLk 'https://minerender.org/embed/skin?skin=Aikar&shadow=true&overlay=true'
*   Trying 104.27.184.162...
* Connected to minerender.org (104.27.184.162) port 443 (#0)
...
> GET /embed/skin?skin=Aikar&shadow=true&overlay=true HTTP/1.1
> Host: minerender.org
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Date: Mon, 05 Nov 2018 22:48:55 GMT
< Content-Type: text/html; charset=iso-8859-1
< Transfer-Encoding: chunked
< Connection: keep-alive
< Set-Cookie: __cfduid=d3bb405f5dde8c9b4ac2743c02bbc5dda1541458135; expires=Tue, 05-Nov-19 22:48:55 GMT; path=/; domain=.minerender.org; HttpOnly; Secure
< Set-Cookie: 300gpBAK=R4178756556; path=/; expires=Mon, 05-Nov-2018 23:56:16 GMT
< Set-Cookie: 300gp=R2224672823; path=/; expires=Mon, 05-Nov-2018 23:56:16 GMT
< Location: http://minerender.org/embed/skin/?skin=Aikar&shadow=true&overlay=true
...
< 
* Ignoring the response-body
* Connection #0 to host minerender.org left intact
* Issue another request to this URL: 'http://minerender.org/embed/skin/?skin=Aikar&shadow=true&overlay=true'
* Found bundle for host minerender.org: 0x5605bc9faf20 [can pipeline]
*   Trying 104.27.185.162...
* Connected to minerender.org (104.27.185.162) port 80 (#1)
> GET /embed/skin/?skin=Aikar&shadow=true&overlay=true HTTP/1.1
> Host: minerender.org
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Date: Mon, 05 Nov 2018 22:48:55 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: max-age=3600
< Expires: Mon, 05 Nov 2018 23:48:55 GMT
< Location: https://minerender.org/embed/skin/?skin=Aikar&shadow=true&overlay=true
< Server: cloudflare
< CF-RAY: 4752dee1e78d9f9c-IAD
< 
* Ignoring the response-body
* Connection #1 to host minerender.org left intact
* Issue another request to this URL: 'https://minerender.org/embed/skin/?skin=Aikar&shadow=true&overlay=true'
* Found bundle for host minerender.org: 0x5605bc9faf20 [can pipeline]
* Re-using existing connection! (#0) with host minerender.org
* Connected to minerender.org (104.27.184.162) port 443 (#0)
> GET /embed/skin/?skin=Aikar&shadow=true&overlay=true HTTP/1.1
> Host: minerender.org
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 200 OK
...

1.8+ Second layer skin bug

Hello, please fix bug with 1.8+ second layer.
This is skin in Minecraft:
image
and this is the same skin in MineRender:
image

Recipes not working

The Recipes are not working, i'm getting the following error: https://pastebin.com/sCFFjU39

  • First: Consol Log
  • Second: Html Code

Consol Log:

Uncaught TypeError: e.result is undefined
    MineRender 1.2.3/dist/gui.min.js:37
    <anonymous> file:///E:/Benutzer/Documents/Xampp/htdocs/P_53b1/demo.html:24
    jQuery 6
        i
        fireWith
        A
        c
        send
        ajax
    <anonymous> file:///E:/Benutzer/Documents/Xampp/htdocs/P_53b1/demo.html:22
gui.min.js:37:147395
    recipe https://cdn.jsdelivr.net/gh/InventivetalentDev/[email protected]/dist/gui.min.js:37
    <anonym> file:///E:/Benutzer/Documents/Xampp/htdocs/P_53b1/demo.html:24
    jQuery 6
        i
        fireWith
        A
        c
        (Async: EventHandlerNonNull)
    send
        ajax
    <anonym> file:///E:/Benutzer/Documents/Xampp/htdocs/P_53b1/demo.html:22

Html Code:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/96/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/InventivetalentDev/[email protected]/dist/gui.min.js"></script>


<div id="myRecipeContainer"></div>

<script type="text/javascript">
    $.ajax("https://assets.mcasset.cloud/1.13/assets/minecraft/recipes/rail.json").done(function (recipe) {
	    var guiRender = new GuiRender({/* options */}, document.getElementById("myRecipeContainer"));
	    guiRender.render(GuiRender.Helper.recipe(recipe, {
          	/* Some recipes require extra data to map the correct textures */
          	"rail": "/blocks/rail_normal"
        }))
	});
</script>

Any ETA on the TS version?

Hi, I'm really interested in using your package inside projects I work on, but it's a real pain to use it inside a headless browser;
Is there any ETA when the TS version will be released? If so, would it be possible to incorporate puppeteer into it?

Support for latest version of THREE.js

all.min.js:31 
        
Uncaught TypeError: Class constructor vn cannot be invoked without 'new'
    at new e (all.min.js:31:293575)
    at all.min.js:31:294394
    at Object.<anonymous> (all.min.js:31:310503)
    at r (all.min.js:31:158)
    at Object.<anonymous> (all.min.js:31:248199)
    at r (all.min.js:31:158)
    at Object.<anonymous> (all.min.js:31:246861)
    at r (all.min.js:31:158)
    at all.min.js:31:506
    at Object.<anonymous> (all.min.js:31:516)

It looks like that MineRender does not compatibility with the latest version of THREE.js?

Skin display bug is back

What steps will reproduce the problem?

  1. Create a skin on https://mineskin.org
  2. Open the skin in the "Your Skins" section.
  3. See the issue

What were you expecting to happen? What happened instead?

I expected the skin - namely the head - to display correctly.
Instead I got a weird display of it.

Note that the head does look normal on the overvier ("Your Skins" section).

What version of the plugin are you using? Type /version <Plugin Name>

NaN

What Spigot version are you using? Type /version

NaN

What plugins are you using? Type /plugins

NaN

Do you have an error log? Use pastebin.com. If you're not sure, upload your whole server log

NaN

Did your client crash? Upload errors in .minecraft/logs/latest.log as well

NaN

Additional information? (Are you using Bungeecord? Did it work in previous versions? etc.)

This was once fixed before but seems to have reappeared.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • Update actions/checkout action to v3
  • Update actions/setup-node action to v3

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/nodejs.yml
  • actions/checkout v1
  • actions/setup-node v1
html
demo/model/index.html
  • jquery 3.2.1@sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=
  • three.js 94@sha256-NGC9JEuTWN4GhTj091wctgjzftr+8WNDmw0H8J5YPYE=
demo/skin/index.html
  • jquery 3.2.1@sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=
  • jquery 3.2.1@sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=
  • three.js 94@sha256-NGC9JEuTWN4GhTj091wctgjzftr+8WNDmw0H8J5YPYE=
embed/model/index.html
  • jquery 3.2.1@sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=
  • three.js 94@sha256-NGC9JEuTWN4GhTj091wctgjzftr+8WNDmw0H8J5YPYE=
embed/skin/index.html
  • jquery 3.2.1@sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=
  • three.js 94@sha256-NGC9JEuTWN4GhTj091wctgjzftr+8WNDmw0H8J5YPYE=
index.html
  • materialize 0.100.1@sha256-mkKV3FUh67dtli09bVbaYyM1526XgR92cz1uKarE1jo=
  • prism 1.8.3@sha256-DJJDQyzflMYiUb2jX3gilm9m3gAkHPC4WLv9BAk4rTE=
  • prism 1.8.3@sha256-DJJDQyzflMYiUb2jX3gilm9m3gAkHPC4WLv9BAk4rTE=
  • jquery 3.2.1@sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=
  • materialize 0.100.1@sha256-3mqgTUhHNgfXgjrzjPOaW03DdQ9hgW92BApzLREoRoA=
  • three.js 94@sha256-NGC9JEuTWN4GhTj091wctgjzftr+8WNDmw0H8J5YPYE=
  • prism 1.8.3@sha256-haEv2ilTk2sXcJaGbkTtErRCHy/qGt3g+bGbgPf5OTY=
npm
package.json
  • @johh/three-effectcomposer 0.0.7
  • debug ^2.6.9
  • deepmerge ^4.0.0
  • esdoc ^1.1.0
  • esdoc-standard-plugin ^1.0.0
  • java-parser 0.3.2
  • jquery ^3.3.1
  • md5 ^2.2.1
  • nbt-js ^0.1.0
  • onscreen ^1.3.2
  • pako ^1.0.6
  • prismarine-nbt ^1.2.0
  • stats.js ^0.17.0
  • three 0.93.0
  • threejs-ext ^0.92.0
  • webworkify-webpack ^2.1.3
  • progress-bar-webpack-plugin 1.12.1
  • webpack 4.41.1
  • webpack-cli 3.0.8
  • worker-loader 2.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Bedrock Edition 128x128 Skins

MineRender does not appear to support 128x128 skins (exclusive to Bedrock Edition). An example of a 128x128 skin:
image
jake

Capes in Embedded iFrame

Is your feature request related to a problem? Please describe.
Yes, I can't have a cape texture URL in the embedded iFrame of MineRender.

Describe the solution you'd like
I want to add ?cape= parameter with a URL at the end.

Describe alternatives you've considered
Maybe ?capeUrl= or ?cape_url= instead?

Additional context
No.

Firefox: resistFingerprinting leads to wrong render

Describe the bug
When privacy.resistFingerprinting is true in about:config on Firefox

  • All of the textures of player models that have an overlay are wrong:
    minerender-firefox-skin-overlay
  • All Blocks have the wrong texture (as well as items):
    minerender-firefox-blocks
  • And all GUIs have the same problem too:
    minerender-firefox-guis-and-inventories

This is not the case with entities and skins without an overlay (for example md_5).

To Reproduce
Steps to reproduce the behavior:

  1. Go to about:config in Firefox
  2. Change privacy.resistFingerprinting from false to true
  3. Look at the website
  4. See the error on the website with the message Blocked https://minerender.org/demo/skin/ from extracting canvas data because no user input was detected. in the console.

Expected behavior
All of the textures should not be like this.

Additional context
This is because Firefox is blocking the getImageData and the toDataURL methods because the canvas was not accessed by the user at this state. The error in the console is:

Blocked https://minerender.org/demo/skin/ from extracting canvas data because no user input was detected.

This is more or like a niche bug that only happens to the people that change the about:config but is something that someone does not expect.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Documentation

After a full week spend on the documentation, i'm writting this to the support who is managing minerender. Try to give some examples in your documentation young devs are lost in your documentation. Try to implement options that you are using such auto rotation, drop shadow etc etc. On minerender.org you are using several options that aren't detailled in the documentation. So it would be cool to upgrade it and fixe some pages like entityRender ..

Hopefully i can find my answers after an update

Roy

How to add a block to an gui?

How to add a stone block to an inventory, how to change the amount of an item or how to render a players survival inventory. If you know a answer to one of these questions please post it!

Using 1.19 assets fails

Describe the bug
When using 1.19 assets (see below), it attempts to request the following URL, which does not exist:

https://assets.mcasset.cloud/1.19/assets/minecraft/models/minecraft:block/cube_all.json

However, if we rename "minecraft:block" to just "block," it works fine:

https://assets.mcasset.cloud/1.19/assets/minecraft/models/block/cube_all.json

To Reproduce
Steps to reproduce the behavior:

  1. Use the "assetRoot" option
  2. Set your asset root to the following: https://assets.mcasset.cloud/1.19
  3. Attempt to render a "netherite_block"

Expected behavior
No error

Screenshots
N/A

Additional context
I downloaded the embed/model index.html file and manually inserted the assetRoot to the options. This is the URL I used:

index.html?models=block/netherite_block&shadow=false&camera.position=26,26,26&controls=false&controls.rotate=false&controls.zoom=false&controls.pan=false

This issue begins to appear starting at Minecraft 1.16. Minecraft 1.15 works fine.

Tracing further into the code, it appears that post Minecraft 1.15 assets includes the namespace in the asset name which seems to screw up the URLs. I'm implementing a temporary fix on my fork to simply remove these namespaces, but it's definitely jank and wouldn't recommend this as a permanent solution lol

Resource pack

I've searched through the docs and am unable to figure out how to use a custom resource pack. It doesn't seem to be documented very well. I either need to be able to pass in a list of models and base64/url textures, or set up the URL endpoint for a model/texture (though I would prefer the former, as it fits better with my use case).

Could you provide any insight on how the custom resource pack system functions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.