Jump to content

[Forge 1.11] Rendering Irregular Block


pH7

Recommended Posts

Hey all and happy new year :)

 

I run into a problem that has been boggling my mind; I made an irregular block that extends my BlockBase class, made textures for it and a json file for its model, but it renders as the purple/black block.

 

This is its class:

public class BlockBeachTurtleShell extends BlockBase{
public BlockBeachTurtleShell() {
	super(Material.ROCK, "beach_turtle_shell");

	setHardness(3f);
	setResistance(5f);
	setHarvestLevel("pickaxe", 1);
	setCreativeTab(CreativeTabs.DECORATIONS);
	setSoundType(SoundType.STONE);
}

@Override
public boolean isOpaqueCube(IBlockState state) {
	return false;
}

@Override
public boolean isFullCube(IBlockState state) {
	return false;
}

public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn){
	addCollisionBoxToList(pos, entityBox, collidingBoxes, new AxisAlignedBB(0.0625F, 0.0F, 0.125F, 0.9375F, 0.3125F, 0.875F));

}

@Override
public BlockRenderLayer getBlockLayer(){
	return BlockRenderLayer.TRANSLUCENT;
}
    
}

 

It is there as the collision and its properties work. If I change the its json file to retrieve some random block's texture, it will succeed, leading me to believe that there is something wrong with the json file, but I can't figure out what.

 

This is it:

{
"textures": {
	"texture0": "variety:blocks/beach_turtle_shell/beach_turtle_shell0",
	"texture1": "variety:blocks/beach_turtle_shell/beach_turtle_shell1",
	"texture2": "variety:blocks/beach_turtle_shell/beach_turtle_shell2",
	"texture3": "variety:blocks/beach_turtle_shell/beach_turtle_shell3",
	"texture4": "variety:blocks/beach_turtle_shell/beach_turtle_shell4",
	"texture5": "variety:blocks/beach_turtle_shell/beach_turtle_shell5",
	"texture6": "variety:blocks/beach_turtle_shell/beach_turtle_shell6",
	"texture7": "variety:blocks/beach_turtle_shell/beach_turtle_shell7",
	"texture8": "variety:blocks/beach_turtle_shell/beach_turtle_shell8",
	"particle": "variety:blocks/beach_turtle_shell/beach_turtle_shell0"
},
"elements": [
	{
		"from": [ 2.0, -24.0, 1.0 ],
		"to": [ 14.0, -22.0, 15.0 ],
		"faces": {
			"down":	{ "uv": [ 1, 1, 13, 15  ], "texture": "#texture1"},
			"up":	{ "uv": [ 1, 1, 13, 15  ], "texture": "#texture0", "rotation": 180},
			"north":{ "uv": [ 1, 5, 13, 7  ], "texture": "#texture3", "rotation": 180},
			"south":{ "uv": [ 1, 1, 13, 3  ], "texture": "#texture3"},
			"west":	{ "uv": [ 5, 1, 7, 15  ], "texture": "#texture2", "rotation": 90},
			"east":	{ "uv": [ 1, 1, 3, 15  ], "texture": "#texture2", "rotation": 270}
		}
	},
	{
		"from": [ 5.0, -20.0, 4.0 ],
		"to": [ 11.0, -19.0, 12.0 ],
		"faces": {
			"down":	{ "uv": [ 1, 1, 7, 9  ], "texture": "#texture4"},
			"up":	{ "uv": [ 9, 1, 15, 9  ], "texture": "#texture2", "rotation": 180},
			"north":{ "uv": [ 9, 14, 15, 15  ], "texture": "#texture2", "rotation": 180},
			"south":{ "uv": [ 9, 11, 15, 12  ], "texture": "#texture2"},
			"west":	{ "uv": [ 12, 1, 13, 9  ], "texture": "#texture4", "rotation": 90},
			"east":	{ "uv": [ 9, 1, 10, 9  ], "texture": "#texture4", "rotation": 270}
		}
	},
	{
		"from": [ 3.0, -22.0, 2.0 ],
		"to": [ 13.0, -21.0, 14.0 ],
		"faces": {
			"down":	{ "uv": [ 1, 1, 11, 13  ], "texture": "#texture6"},
			"up":	{ "uv": [ 1, 1, 11, 13  ], "texture": "#texture5", "rotation": 180},
			"north":{ "uv": [ 1, 12, 11, 13  ], "texture": "#texture3", "rotation": 180},
			"south":{ "uv": [ 1, 9, 11, 10  ], "texture": "#texture3"},
			"west":	{ "uv": [ 13, 1, 14, 13  ], "texture": "#texture6", "rotation": 90},
			"east":	{ "uv": [ 13, 1, 14, 13  ], "texture": "#texture5", "rotation": 270}
		}
	},
	{
		"from": [ 4.0, -21.0, 3.0 ],
		"to": [ 12.0, -20.0, 13.0 ],
		"faces": {
			"down":	{ "uv": [ 1, 1, 9, 11  ], "texture": "#texture8"},
			"up":	{ "uv": [ 1, 1, 9, 11  ], "texture": "#texture7", "rotation": 180},
			"north":{ "uv": [ 1, 14, 9, 15  ], "texture": "#texture4", "rotation": 180},
			"south":{ "uv": [ 1, 11, 9, 12  ], "texture": "#texture4"},
			"west":	{ "uv": [ 14, 1, 15, 11  ], "texture": "#texture7", "rotation": 90},
			"east":	{ "uv": [ 11, 1, 12, 11  ], "texture": "#texture7", "rotation": 270}
		}
	}
]
}

 

Those awful rotations were due to mistakes in orientation during modelling but ignore them, they are fine x)

 

From what I know of json formats, that should work. Does anyone have any idea of where the mistake should be? I'll keep working on it. Thanks in advance.

'Everyone is a genius,

But if you judge a fish by its ability to climb trees, it will live its whole life believing that it is stupid.'

 

-Albert Einstein

----------------------------------------------------------

If Arthas's horse is named "Invincible", then why can I clearly see him?

Link to comment
Share on other sites

Post the FML log (logs/fml-client-latest.log), there's almost certainly an error in it telling you what's wrong.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Do you have an "inventory" variant in your blockstate file?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

For TheSunCat: I have something like this for a blockstate and my regular blocks render fine :)

 

 

{
"forge_marker": 1,
"defaults": {
	"textures": {
		"all": "variety:blocks/brass_block"
	}
},
"variants": {
	"normal": {
		"model": "cube_all"
	},
	"inventory": {
		"model": "cube_all"
	}
}
}

 

 

 

As Draco said, do you have the inventory?

-------------------------------------------------------------------------------------------------------------

My current jsons for this block are:

 

/variety/blockstates/beach_turtle_shell.json:

 

 

{
    "variants": {
        "normal": {"model": "variety:beach_turtle_shell"}
    }
}

 

 

/variety/models/block/beach_turtle_shell.json:

original post

 

/variety/models/item/beach_turtle_shell.json:

 

 

{
    "parent": "item/generated",
    "textures": {
        "layer0": "variety:items/beach_turtle_shell"
    }
}

 

 

I have an item icon being displayed as the held item istead of the irregular block. It is what I intended to and it appears fine both in the player's hand, in the inventory and as a dropped item fine and with the correct size.

 

I noticed this in my last fml log:

 

 

[19:10:24] [Client thread/ERROR] [FML/]: Exception loading model for variant variety:beach_turtle_shell#normal for blockstate "variety:beach_turtle_shell"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model variety:beach_turtle_shell#normal with loader VariantLoader.INSTANCE, skipping
at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:241) ~[ModelLoader.class:?]
at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]
at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?]
at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[ModelLoader.class:?]
at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:539) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:385) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_111]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_111]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_111]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model variety:block/beach_turtle_shell with loader VanillaLoader.INSTANCE, skipping
at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:752) ~[ModelLoader$WeightedRandomModel.class:?]
at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
... 21 more
Caused by: com.google.gson.JsonParseException: 'from' specifier exceeds the allowed boundaries: Vector3f[2.0, -24.0, 1.0]
at net.minecraft.client.renderer.block.model.BlockPart$Deserializer.parsePositionFrom(BlockPart.java:206) ~[blockPart$Deserializer.class:?]
at net.minecraft.client.renderer.block.model.BlockPart$Deserializer.deserialize(BlockPart.java:76) ~[blockPart$Deserializer.class:?]
at net.minecraft.client.renderer.block.model.BlockPart$Deserializer.deserialize(BlockPart.java:70) ~[blockPart$Deserializer.class:?]
at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?]
at com.google.gson.Gson$1.deserialize(Gson.java:126) ~[Gson$1.class:?]
at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.getModelElements(ModelBlock.java:315) ~[ModelBlock$Deserializer.class:?]
at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.deserialize(ModelBlock.java:248) ~[ModelBlock$Deserializer.class:?]
at net.minecraft.client.renderer.block.model.ModelBlock$Deserializer.deserialize(ModelBlock.java:242) ~[ModelBlock$Deserializer.class:?]
at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
at net.minecraft.util.JsonUtils.gsonDeserialize(JsonUtils.java:453) ~[JsonUtils.class:?]
at net.minecraft.client.renderer.block.model.ModelBlock.deserialize(ModelBlock.java:51) ~[ModelBlock.class:?]
at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:338) ~[ModelBakery.class:?]
at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:118) ~[ModelLoader.class:?]
at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:868) ~[ModelLoader$VanillaLoader.class:?]
at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:752) ~[ModelLoader$WeightedRandomModel.class:?]
at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1185) ~[ModelLoader$VariantLoader.class:?]
at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
... 21 more

 

 

 

I still get purple and black blocks when placed.

 

'Everyone is a genius,

But if you judge a fish by its ability to climb trees, it will live its whole life believing that it is stupid.'

 

-Albert Einstein

----------------------------------------------------------

If Arthas's horse is named "Invincible", then why can I clearly see him?

Link to comment
Share on other sites

Exception loading model for variant variety:beach_turtle_shell#normal for blockstate "variety:beach_turtle_shell"

Caused by: com.google.gson.JsonParseException: 'from' specifier exceeds the allowed boundaries: Vector3f[2.0, -24.0, 1.0]

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

>.>

<.<

>.>

 

Indeed... I offset everything to be within bounds and now it is rendered perfectly...

I didn't notice that, thanks man :)

'Everyone is a genius,

But if you judge a fish by its ability to climb trees, it will live its whole life believing that it is stupid.'

 

-Albert Einstein

----------------------------------------------------------

If Arthas's horse is named "Invincible", then why can I clearly see him?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.