Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi! I'm new to modding and I'm trying to write an upgrade for computercraft turtles. The problem is that computercraft in the ITurtleUpgrade, in the getIcon method requires an Icon for the module. It asks for a "block type" icon but I don't have any block using that texture. So how do I create an Icon object without taking it from a block that uses it? I tried giving it the Icon from the item I use for the turtle crafting but it doesn't render well. Giving it the icon from an existing block works well but obviously I don't want to create a block only to get the texture from it. Thanks in advance for any help.

  • Author

The problem is I don't really understand how the whole icons system works  :-\, what TextureMap  and TextureStitchEvent do and represent, so now I don't know how to use all of this. I can't find a place where this is explained

  • Author

I continue not understanding which classes, methods and objects I should use. I should find a TextureMap object and call something on it? What should I do with TextureStitchEvent? I don't find any documentation on this and I really can't understand from the code. To which method or class should I tell the texture file name? What I have to give to computercraft is an Icon object, the only method I've found that returns an Icon is registerIcon from the TextureMap class. but I don't know how to use it :(

  • Author

I tried registering an event in my turtle upgrade class to load the icon getting it's object:

 

@ForgeSubscribe
public void registerUpgradeIcon(TextureStitchEvent event)
{
	CRMod.logger.info("TextureStitchEvent: map type = "+event.map.textureType);
	if(event.map.textureType==0)
	{
		CRMod.logger.info("registering icon");
		icon=event.map.registerIcon("crmod:TurtleChunkLoader");
		CRMod.logger.info("icon="+icon);
	}
}

 

I added in my load method the line:

MinecraftForge.EVENT_BUS.register(new TurtleChunkyModuleUpgrade());

 

and this is the method needed by computercraft:

 

public Icon getIcon(ITurtleAccess turtle, TurtleSide side)
{
	CRMod.logger.info("CC asking for Icon: returning "+icon);
	return icon;
}

 

During the startup in the logger is written:

2014-03-15 19:14:16 [informazioni] [CRMod] Loading CRMod...
2014-03-15 19:14:17 [informazioni] [CRMod] TextureStitchEvent: map type = 0
2014-03-15 19:14:17 [informazioni] [CRMod] registering icon
2014-03-15 19:14:17 [informazioni] [CRMod] icon=TextureAtlasSprite{name='crmod:TurtleChunkLoader', frameCount=0, rotated=false, x=0, y=0, height=0, width=0, u0=0.0, u1=0.0, v0=0.0, v1=0.0}
2014-03-15 19:14:18 [informazioni] [CRMod] TextureStitchEvent: map type = 0
2014-03-15 19:14:18 [informazioni] [CRMod] registering icon
2014-03-15 19:14:18 [informazioni] [CRMod] icon=TextureAtlasSprite{name='crmod:TurtleChunkLoader', frameCount=0, rotated=false, x=208, y=168, height=16, width=16, u0=0.40626952, u1=0.43748048, v0=0.65628904, v1=0.71871096}
2014-03-15 19:14:18 [informazioni] [CRMod] TextureStitchEvent: map type = 1
2014-03-15 19:14:18 [Grave] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/items/MISSING_ICON_ITEM_4259_ccprogramdisk.png
2014-03-15 19:14:18 [informazioni] [CRMod] TextureStitchEvent: map type = 1

 

then, after some lines:

2014-03-15 19:14:18 [informazioni] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:CRmod, FMLFileResourcePack:ComputerCraft Turtles, FMLFileResourcePack:ComputerCraft
2014-03-15 19:14:18 [informazioni] [CRMod] TextureStitchEvent: map type = 1
2014-03-15 19:14:18 [Grave] [Minecraft-Client] Using missing texture, unable to load: minecraft:textures/items/MISSING_ICON_ITEM_4259_ccprogramdisk.png
2014-03-15 19:14:18 [informazioni] [CRMod] TextureStitchEvent: map type = 1
2014-03-15 19:14:18 [informazioni] [CRMod] TextureStitchEvent: map type = 0
2014-03-15 19:14:18 [informazioni] [CRMod] registering icon
2014-03-15 19:14:18 [informazioni] [CRMod] icon=TextureAtlasSprite{name='crmod:TurtleChunkLoader', frameCount=0, rotated=false, x=0, y=0, height=0, width=0, u0=0.0, u1=0.0, v0=0.0, v1=0.0}
2014-03-15 19:14:19 [informazioni] [CRMod] TextureStitchEvent: map type = 0
2014-03-15 19:14:19 [informazioni] [CRMod] registering icon
2014-03-15 19:14:19 [informazioni] [CRMod] icon=TextureAtlasSprite{name='crmod:TurtleChunkLoader', frameCount=0, rotated=false, x=208, y=168, height=16, width=16, u0=0.40626952, u1=0.43748048, v0=0.65628904, v1=0.71871096}

 

and then, once the world is loaded:

 

2014-03-15 19:14:25 [informazioni] [CRMod] CC asking for Icon: returning null
2014-03-15 19:14:25 [informazioni] [sTDOUT] computercraft: Upgrade "Chunky" has an invalid icon! It will render as a crafting table. Please take it up with the peripheral author! We will not warn again. (upgrade ID: 225)

 

And so this doesn't work... Obviously I'm not doing what i'm supposed to...

The question is: what I'm supposed to do? ???

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.