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

Howdy

Yes it is

Here's a working example of texturing an item with a custom quad

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe15_item_dynamic_item_model

DynamicTexture is suitable for creating an image in code.

If you search this forum for DynamicTexture you'll find some recents posts about dynamic textures (Elytra, wolves)

 

-TGG

 

 

 

  • Author

It seems that AtlasTexture and ModelLoader.instance().getSpriteMap... is no longer the same as your guide. Do you know how accessing those things have changed?

7 minutes ago, BeardlessBrady said:

It seems that AtlasTexture and ModelLoader.instance().getSpriteMap... is no longer the same as your guide. Do you know how accessing those things have changed?

It seems to still be correct for me

 

// we have previously registered digitsTexture in StartupClientOnly::onTextureStitchEvent
AtlasTexture blocksStitchedTextures = ModelLoader.instance().getSpriteMap().getAtlasTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
TextureAtlasSprite digitsTextures = blocksStitchedTextures.getSprite(digitsTextureRL);

These compile fine

 

Check you build.gradle?

 

mappings channel: 'snapshot', version: '20200514-1.15.1'
minecraft 'net.minecraftforge:forge:1.15.2-31.2.0'

 

@OnlyIn(Dist.CLIENT)
public class AtlasTexture extends Texture implements ITickable {
   private static final Logger LOGGER = LogManager.getLogger();
   @Deprecated
   public static final ResourceLocation LOCATION_BLOCKS_TEXTURE = PlayerContainer.LOCATION_BLOCKS_TEXTURE;
   @Deprecated
   public static final ResourceLocation LOCATION_PARTICLES_TEXTURE = new ResourceLocation("textures/atlas/particles.png");
   private final List<TextureAtlasSprite> listAnimatedSprites = Lists.newArrayList();
   private final Set<ResourceLocation> sprites = Sets.newHashSet();
   private final Map<ResourceLocation, TextureAtlasSprite> mapUploadedSprites = Maps.newHashMap();
   private final ResourceLocation textureLocation;
   private final int maximumTextureSize;

   public AtlasTexture(ResourceLocation textureLocationIn) {
      this.textureLocation = textureLocationIn;
      this.maximumTextureSize = RenderSystem.maxSupportedTextureSize();
   }

and

ModelBakery::

public SpriteMap getSpriteMap() {
   return this.spriteMap;
}

  • Author

One last thing... I am having trouble properly coloring the quads:

 

https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe15_item_dynamic_item_model/ChessboardFinalisedModel.java#L287-L290

 

On these specific lines you can set a parameter to a color, if I change any of them from white to anything else it just turns teal, any ideas?

  • Author

Also I just want to make sure I'm doing this efficiently. I'm trying to dynamically create a texture in game. Is the best way to do it like your example where instead of filling a chess board with diamond blocks (I'll use a blank texture), the blocks will represent each individual pixel.

 

If you get what I mean would adding these many quads cause any lag or am I doing this wrong/not efficiently?

Edited by BeardlessBrady

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.