I have been trying to load a basic grass block from Minecraft, but I keep encountering an error message that says
TypeError: Cannot set properties of null (setting 'encoding')
. This error originates from line 2893 in GLTFLoader, specifically the code snippet texture.encoding = encoding;
. The strange thing is that I am not even using textures in this case, so I am unsure why this error is appearing. Below is the code used to load the grass block.
const loader = new THREE.GLTFLoader();
loader.load(
'https://cdn.glitch.global/c7ffc3e9-df32-4837-b046-23be12a0896a/minecraft_grass_block.glb?v=1664906819996',
function ( gltf ) {
scene.add( gltf.scene );
gltf.animations; // Array<THREE.AnimationClip>
var grass = gltf.scene; // THREE.Group
gltf.scenes; // Array<THREE.Group>
gltf.cameras; // Array<THREE.Camera>
gltf.asset; // Object
console.log(grass)
},
// called while loading is progressing
function ( xhr ) {
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
},
// called when loading has errors
function ( error ) {
console.log( error );
}
);
And here is the complete error message:
TypeError: Cannot set properties of null (setting 'encoding')
at GLTFLoader.js:2893:23
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async Promise.all (index 0)
THREE.GLTFLoader: Couldn't load texture blob:null/23946df4-f704-42bc-a59d-bd78afa6a4fc