Jump to content

Having some trouble with the items tied to blocks. All assets are correctly formatted.


Recommended Posts

Posted (edited)

The issue I'm having is quite simple. I have registered some blocks and they render properly, however the item models + inventory icons are not showing properly. 

 

Here is an image of what's happening. The checkerboard block is a dropped item.

eAzVswP.png

 

 

Here's the respective assets for the "Arcane Stone" block.

xanblocks/blockstates/arcanestone.json

{
    "variants": {
        "normal": { "model": "xanblocks:arcanestone" }
    }
}

 

xanblocks/models/block/arcanestone.json

{
    "parent": "block/cube_all",
    "textures": {
        "all": "xanblocks:blocks/arcanestone"
    }
}

 

xanblocks/models/item/arcanestone.json

{
	"parent": "xanblocks:block/arcanestone",
	"display": {
		"thirdperson": {
			"rotation": [ 10, -45, 170 ],
			"translation": [ 0, 1.5, -2.75 ],
			"scale": [ 0.375, 0.375, 0.375 ]
		}
	}
}

 

The java code for this block:

//Cut out imports and stuff to save space.
public class BlockArcaneStone extends XanBlockSuperclass {
	
	public BlockArcaneStone() {
		super(Material.ROCK);
		name = "arcanestone";
		//Cut out setHardness, setResistance, setSoundType, setLightLevel, setLightOpacity, and setCreativeTab to save space
		setUnlocalizedName(name);
		setRegistryName(name);
		thisItem = new ItemBlock(this).setRegistryName(name);
	}
}

 

XanBlockSuperClass (This was done for ease of registering blocks)

//Cut out imports and stuff to save space.
public class XanBlockSuperclass extends Block {
	
	protected String name = null;
	protected Item thisItem = null;
	
	public XanBlockSuperclass(Material materialIn) {
		super(materialIn);
	}
	
	public Item getItemForThisBlock() {
		return thisItem;
	}
}

 

And my registry code.

//Cut out imports and stuff to save space.
@Mod.EventBusSubscriber
public class MainBlockRegistry {
	
	public static XanBlockSuperclass[] blocks = null;
	public static Item[] items = null;
	
	public static void createData() {
		//Create an array storing all of my blocks.
		blocks = new XanBlockSuperclass[] {
			new BlockLightCrystal(),
			new BlockHardLight(),
			new BlockArcaneStone(),
			new BlockLightArcaneStone(),
			new BlockShadowStone(),
			new BlockLightShadowStone()
		};
		
		//Iterate through this array to get the respective Item.
		items = new Item[blocks.length];
		for (int idx = 0; idx < items.length; idx++) {
			XanBlockSuperclass block = blocks[idx];
			items[idx] = block.getItemForThisBlock();
		}
	}
	
	@SubscribeEvent
	public static void registerAllBlocks(RegistryEvent.Register<Block> event) {
		if (blocks == null) {
			XanBlockMod.logger.info("NOTE: The internal array for blocks/items was null! Calling creation method.");
			createData();
		}
		event.getRegistry().registerAll(blocks);
	}
	
	@SubscribeEvent
	public static void registerItemBlocks(RegistryEvent.Register<Item> event) {
		if (blocks == null) {
			//Items is guaranteed to be null in the same case. Checking for blocks being null is okay.
			XanBlockMod.logger.info("NOTE: The internal array for blocks/items was null! Calling creation method.");
			createData();
		}
		event.getRegistry().registerAll(items);
	}
}

 

I've looked over my code a few times and I'm uncertain as to what I'm missing. Unfortunately my own lack of knowledge for the API is likely where I'm tripping up.

 

Thanks for your time.

Edited by Xan the Dragon
Clarity on the image.

Check out my website!

Posted

There's no errors I saw the log. I would have brought it up if I had seen one. Here it is.

 

2018-11-11 18:05:47,999 main WARN Disabling terminal, you're running in an unsupported environment.
[18:05:48] [main/INFO] [GradleStart]: Extra: []
[18:05:48] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/subzeroshark/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[18:05:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[18:05:48] [main/INFO] [FML]: Forge Mod Loader version 14.23.4.2705 for Minecraft 1.12.2 loading
[18:05:48] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_181, running on Windows 7:amd64:6.1, installed at F:\Program Files\Java\jre1.8.0_181
[18:05:48] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[18:05:48] [main/ERROR] [FML]: Full: F:\Users\subzeroshark\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[18:05:48] [main/ERROR] [FML]: Trimmed: f:/users/subzeroshark/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[18:05:48] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[18:05:48] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[18:05:48] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[18:05:48] [main/INFO] [FML]: Searching C:\Users\subzeroshark\Desktop\Minecraft Forge\Forge 1.12.2\run\.\mods for mods
[18:05:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[18:05:48] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[18:05:48] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[18:05:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:05:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:05:50] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[18:05:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:05:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[18:05:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[18:05:51] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[18:05:51] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[18:05:51] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[18:05:52] [main/INFO] [net.minecraft.client.Minecraft]: Setting user: Player304
[18:05:58] [main/WARN] [net.minecraft.client.settings.GameSettings]: Skipping bad option: lastServer:
[18:05:58] [main/INFO] [net.minecraft.client.Minecraft]: LWJGL Version: 2.9.4
[18:05:59] [main/INFO] [FML]: -- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 7 (amd64) version 6.1
	Java Version: 1.8.0_181, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 739561240 bytes (705 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
	JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: 
	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 411.70' Renderer: 'GeForce GTX 950/PCIe/SSE2'
[18:05:59] [main/INFO] [FML]: MinecraftForge v14.23.4.2705 Initialized
[18:05:59] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[18:05:59] [main/INFO] [FML]: Replaced 1036 ore ingredients
[18:05:59] [main/INFO] [FML]: Searching C:\Users\subzeroshark\Desktop\Minecraft Forge\Forge 1.12.2\run\.\mods for mods
[18:06:01] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[18:06:01] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 189384251 nanos
[18:06:02] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, xanblocks] at CLIENT
[18:06:02] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, xanblocks] at SERVER
[18:06:03] [main/INFO] [net.minecraft.client.resources.SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Xan's Blocks
[18:06:03] [main/INFO] [FML]: Processing ObjectHolder annotations
[18:06:03] [main/INFO] [FML]: Found 1168 ObjectHolder annotations
[18:06:03] [main/INFO] [FML]: Identifying ItemStackHolder annotations
[18:06:03] [main/INFO] [FML]: Found 0 ItemStackHolder annotations
[18:06:03] [main/INFO] [FML]: Configured a dormant chunk cache size of 0
[18:06:03] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[18:06:03] [main/INFO] [xanblocks]: NOTE: The internal array for blocks/items was null! Calling creation method.
[18:06:03] [main/INFO] [FML]: Applying holder lookups
[18:06:03] [main/INFO] [FML]: Holder lookups applied
[18:06:03] [main/INFO] [FML]: Applying holder lookups
[18:06:03] [main/INFO] [FML]: Holder lookups applied
[18:06:03] [main/INFO] [FML]: Applying holder lookups
[18:06:03] [main/INFO] [FML]: Holder lookups applied
[18:06:03] [main/INFO] [FML]: Applying holder lookups
[18:06:03] [main/INFO] [FML]: Holder lookups applied
[18:06:03] [main/INFO] [FML]: Injecting itemstacks
[18:06:03] [main/INFO] [FML]: Itemstack injection complete
[18:06:03] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: OUTDATED Target: 14.23.5.2768
[18:06:06] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager]: Starting up SoundSystem...
[18:06:06] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager]: Initializing LWJGL OpenAL
[18:06:06] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[18:06:06] [Thread-5/INFO] [net.minecraft.client.audio.SoundManager]: OpenAL initialized.
[18:06:06] [Sound Library Loader/INFO] [net.minecraft.client.audio.SoundManager]: Sound engine started
[18:06:10] [main/INFO] [FML]: Max texture size: 16384
[18:06:10] [main/INFO] [net.minecraft.client.renderer.texture.TextureMap]: Created: 512x512 textures-atlas
[18:06:12] [main/INFO] [FML]: Applying holder lookups
[18:06:12] [main/INFO] [FML]: Holder lookups applied
[18:06:12] [main/INFO] [FML]: Injecting itemstacks
[18:06:12] [main/INFO] [FML]: Itemstack injection complete
[18:06:12] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
[18:06:12] [main/WARN] [net.minecraft.client.settings.GameSettings]: Skipping bad option: lastServer:
[18:06:13] [main/INFO] [com.mojang.text2speech.NarratorWindows]: Narrator library for x64 successfully loaded
[18:06:14] [Realms Notification Availability checker #1/INFO] [com.mojang.realmsclient.client.RealmsClient]: Could not authorize you against Realms server: Invalid session id
[18:06:26] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer]: Starting integrated minecraft server version 1.12.2
[18:06:26] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer]: Generating keypair
[18:06:26] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[18:06:26] [Server thread/INFO] [FML]: Applying holder lookups
[18:06:26] [Server thread/INFO] [FML]: Holder lookups applied
[18:06:27] [Server thread/INFO] [FML]: Loading dimension 0 (Test) (net.minecraft.server.integrated.IntegratedServer@23664111)
[18:06:27] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[18:06:27] [Server thread/INFO] [FML]: Loading dimension 1 (Test) (net.minecraft.server.integrated.IntegratedServer@23664111)
[18:06:27] [Server thread/INFO] [FML]: Loading dimension -1 (Test) (net.minecraft.server.integrated.IntegratedServer@23664111)
[18:06:27] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing start region for level 0
[18:06:28] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 25%
[18:06:29] [Server thread/INFO] [FML]: Unloading dimension -1
[18:06:29] [Server thread/INFO] [FML]: Unloading dimension 1
[18:06:29] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer]: Changing view distance to 12, from 10
[18:06:31] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2
[18:06:31] [Netty Server IO #1/INFO] [FML]: Client protocol version 2
[18:06:31] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected]
[18:06:31] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[18:06:31] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[18:06:31] [Server thread/INFO] [net.minecraft.server.management.PlayerList]: Player304[local:E:003a34c1] logged in with entity id 351 at (-236.9029084561838, 71.0, 289.73684455466076)
[18:06:31] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Player304 joined the game
[18:06:32] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer]: Saving and pausing game...
[18:06:32] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'Test'/overworld
[18:06:32] [pool-2-thread-1/WARN] [com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@412f8573[id=2b98548a-5e09-3029-b082-b4c99d31d926,name=Player304,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?]
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?]
	at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3178) [Minecraft.class:?]
	at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_181]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_181]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
[18:06:32] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer]: Saving and pausing game...
[18:06:32] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'Test'/overworld
[18:06:36] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer]: Saving and pausing game...
[18:06:36] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'Test'/overworld

This is from launch all the way to me loading the world.

Check out my website!

Posted

I was able to get it working. Thanks.

 

For those who may be reading this post in the future with the same problem, just to cover this, I added a method that takes in a ModelRegistryEvent as a parameter and used the @SubscribeEvent annotation on this method. The method used the stuff shown in the docs there to register my models.

Check out my website!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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