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

I'm trying to register a sprite to a Texture Atlas to draw later on.  Here is my stitching code:

@Mod.EventBusSubscriber(modid = MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
public class SymbolTextures {

    public static final ResourceLocation DEBUG = new ResourceLocation(MODID , "textures/symbols/symbol_x.png");

    @SubscribeEvent
    public static void onStitchEvent(TextureStitchEvent.Pre event)
    {
        ResourceLocation stitching = event.getMap().getTextureLocation();
        if(!stitching.equals(AtlasTexture.LOCATION_BLOCKS_TEXTURE))
        {
            return;
        }

        //TODO do this programmatically from registry
        boolean added = event.addSprite(DEBUG);

    }

}

(added ends up as true here)

 

And here is where I'm trying to grab it:

    public static void renderSymbol(DrawnSymbol symbol, MatrixStack matrix)
    {
        assert Minecraft.getInstance().world != null;


        IRenderTypeBuffer buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
        IVertexBuilder builder = buffer.getBuffer(RenderType.getTranslucent());
        TextureAtlasSprite sprite = Minecraft.getInstance().getAtlasSpriteGetter(AtlasTexture.LOCATION_BLOCKS_TEXTURE).apply(symbol.getTexture());
	}

 

in this case, symbol.getTexture() will return SymbolTextures.DEBUG.  I only ever get "minecraft:missingno" returned as sprite.  Does anybody have some experience with this?  Am I doing something wrong?

  • Author

Figured it out.  ResourceLocation is expecting "symbols/symbol_x" instead of "textures/symbols/symbol_x.png".  Apparently it knows where the textures are at.

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.