Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.12] Recolour Item Texture at Startup


Ommina
 Share

Recommended Posts

OK.  I have a greyscale texture, and an RGB value.  At startup, I would like to create an item with the texture recoloured with the RGB value.  It is a pretty simple item otherwise.  Not armor, not a tool, no durability.

 

Right now I'm using IItemColor, and it's working just fine.  BUT, I'm feeling a lot of guilt over using it, as it is called every frame, and the colour really is fixed at startup.  It is not dynamic based on conditions (biome, phase of the moon, whatever).  If it is blue now, it's going to be blue later too.  As such, I'd really like to colour the item once, at startup, and be done with it, all without feeling like I am contributing to a drop in framerate -- however slight -- unnecessarily.

 

The closest I've found to achieve this is the forge dynamic bucket, but that seems to be well more than what I'm looking for.  Maybe I'm mistaken here.

 

I COULD just recolour it manually in an image editor and get on with my day, but I'd very much like to be able to tweak the RGB values without manually recolouring the textures each time I do so.

 

Any suggestions?  Is there a simpler example than the forge bucket that I can use to light my way?  Thanks.

Link to comment
Share on other sites

I don't think you need to feel guilty about the performance impact. With a modern computer, the GPU is capable of probably billions of such calculations. I assume that your item will be reasonably rare (a lot of the time probably not even rendering the item at all), and remember that only the items being rendered (i.e. in field of view) would even have an impact. So at most you're probably going to have a couple itemstacks in an inventory (and when viewing inventory frame rate isn't really as much of an issue even if performance dips), or maybe a couple items thrown on the ground. 

 

With modern programming (assuming you're using a full computer and not some resource-strapped embedded processor) it is best to use the proper logic and only deal with perf issues when they actually are an issue. I.e. profile the code and see if there is an actual problem. Of course you should not do stupid things like big loops, recursion, and such unless necessary. But otherwise you should just code for clean, well-structured code that uses the intended interfaces. Bug-free, maintainable code is the first priority.

  • Thanks 1

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

1 hour ago, Ommina said:

Any suggestionsIs there a simpler example than the forge bucket that I can use to light my way?  Thanks.

No, there is not a simpler way to do this, though your overall code will look much simpler than forges dynamic bucket because you will only need to have one TextureAtlasSprite that applies the color to the texture. But I do agree with jabelar, it would be fine to just let the texture be generated every frame. And if it were to become a problem you could very easily switch over to the TextureAtlasSprite method.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Its likely just a vertex color operation that changes the color. Vertex color is super cheap. It's used for particle systems with hundreds of thousands of particles and it runs just fine, one or a dozen items, easy peasy.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Your model and renderer are entirely irrelevant to your entity's hitbox. You need to use EntityType.Builder#sized when creating your entity type.
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Hi I have a little trouble, idk how can I set the hitbox/bounding box of a bipedModel, bipedrenderer entity. So when entity is created I can hit her on legs but not on arms or chest or even head, anyone know how to cconfig that? anhy help it's really apreciated.    public class verructRenderer extends BipedRenderer<verructEntity, BipedModel<verructEntity>> { private static final ResourceLocation VERRUCT_LOCATION = new ResourceLocation("livinglife", "textures/entity/verructtexture.png"); public verructRenderer(EntityRendererManager manager) { super(manager, new BipedModel<verructEntity>(RenderType::entityTranslucent, 1.0F, 1.0F, 64, 64), 0.3f); } @Override public ResourceLocation getTextureLocation(verructEntity p_110775_1_) { return VERRUCT_LOCATION; } }  
    • In the future do not post in completely irrelevant threads. Downgrade Forge to version 84 for the time being.
    • bonsoir, j'ai un problème avec un serveur minecraft, quand j'essaie de le lancer il crash en me mettant ce message d'erreur   ---- Minecraft Crash Report ---- WARNING: coremods are present:   llibrary (llibrary-core-1.0.11-1.12.2.jar)   PhosphorFMLLoadingPlugin (phosphor-forge-mc1.12.2-0.2.7-universal.jar)   IvToolkit (IvToolkit-1.3.3-1.12.jar)   iceandfire (iceandfire-1.9.1-1.12.2.jar)   CTMCorePlugin (CTM-MC1.12.2-1.0.2.31.jar)   SRM-Core (Secret_Rooms_Brouillon__29_mod_fr-minecraft_PH9U.jar) Contact their authors BEFORE contacting forge // Oh - I know what I did wrong! Time: 10/16/21 7:55 PM Description: Exception in server tick loop java.lang.NoClassDefFoundError: net/minecraft/client/entity/EntityPlayerSP     at java.lang.Class.forName0(Native Method)     at java.lang.Class.forName(Class.java:348)     at net.minecraftforge.fml.common.ProxyInjector.inject(ProxyInjector.java:85)     at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:611)     at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)     at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)     at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)     at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98)     at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333)     at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)     at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: net.minecraft.client.entity.EntityPlayerSP     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     ... 34 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@14151bc5 from coremod FMLCorePlugin     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:260)     at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)     ... 36 more Caused by: java.lang.RuntimeException: Attempted to load class bud for invalid side SERVER     at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62)     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:256)     ... 38 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Linux (amd64) version 4.19.0-16-amd64     Java Version: 1.8.0_282, Oracle Corporation     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 526537296 bytes (502 MB) / 967311360 bytes (922 MB) up to 14913372160 bytes (14222 MB)     JVM Flags: 2 total; -Xms128M -Xmx16000M     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP 9.42 Powered by Forge 14.23.5.2854 42 mods loaded, 42 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     | State | ID                   | Version           | Source                                                       | Signature                                |     |:----- |:-------------------- |:----------------- |:------------------------------------------------------------ |:---------------------------------------- |     | LC    | minecraft            | 1.12.2            | minecraft.jar                                                | None                                     |     | LC    | mcp                  | 9.42              | minecraft.jar                                                | None                                     |     | LC    | FML                  | 8.0.99.99         | server.jar                                                   | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | forge                | 14.23.5.2854      | server.jar                                                   | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | ivtoolkit            | 1.3.3-1.12        | minecraft.jar                                                | None                                     |     | LC    | securitycraft        | v1.8.22.2         | [1.12.2]+SecurityCraft+v1.8.22.2.jar                         | None                                     |     | LC    | abyssaldepths        | 1.12.2-0.3.1      | AbyssalDepths-1.12.2-0.3.1.jar                               | 25e0dcff5b5a7325d7c28898af41ff8b0ba41b77 |     | LC    | additionalstructures | 1.2.0             | Additional+Structures+1.12.2++by+XxRexRaptorxX+(v.1.2.0).jar | None                                     |     | LC    | orbis-lib            | 0.2.0             | orbis-lib-1.12.2-0.2.0+build411.jar                          | db341c083b1b8ce9160a769b569ef6737b3f4cdf |     | LC    | aether               | 0.3.0             | aether_ii-1.12.2-0.3.0+build411-universal.jar                | db341c083b1b8ce9160a769b569ef6737b3f4cdf |     | LC    | appletreesrev        | v1.5              | AppleTreesRev-1.12.2-v1.5.jar                                | None                                     |     | LC    | baubles              | 1.5.2             | Baubles-1.12-1.5.2.jar                                       | None                                     |     | LC    | artifacts            | 1.12.2-1.2.2      | Artifacts-1.12.2-1.2.2.jar                                   | None                                     |     | LC    | bibliocraft          | 2.4.3             | BiblioCraft[v2.4.3][MC1.12.0].jar                            | None                                     |     | LC    | bookshelf            | 2.3.590           | Bookshelf-1.12.2-2.3.590.jar                                 | d476d1b22b218a10d845928d1665d45fce301b27 |     | LC    | chisel               | MC1.12.2-1.0.2.45 | Chisel-MC1.12.2-1.0.2.45.jar                                 | None                                     |     | LC    | complexcrops         | v4.0              | Complex+Crops+1.12.2-4.0.jar                                 | None                                     |     | LC    | customspawner        | 3.11.4            | CustomMobSpawner-3.11.5.jar                                  | None                                     |     | LC    | dawnoftimebuilder    | 1.0.7             | dawnoftime_builder_edition-1.0.7.jar                         | None                                     |     | LC    | mocreatures          | 12.0.5            | DrZharks MoCreaturesMod -12.0.5.jar                          | None                                     |     | LC    | eerieentities        | 1.0.7             | EerieEntities-1.12.2-1.0.7.jar                               | d476d1b22b218a10d845928d1665d45fce301b27 |     | LC    | erebus               | 1.0.32            | Erebus-1.0.32.jar                                            | None                                     |     | LC    | explorercraft        | 2.2.13            | Explorercraft-2.2.13.jar                                     | None                                     |     | LC    | farlanders           | 1.0.0             | farlanders-1.12.2-1.0.0.jar                                  | None                                     |     | LC    | hearthstonemod       | 0.4.7             | HearthstoneMod-1.12.2-0.4.7.jar                              | None                                     |     | LC    | huntingdim           | 1.0.42            | HuntingDimension-1.12.2-1.0.42.jar                           | d476d1b22b218a10d845928d1665d45fce301b27 |     | LC    | llibrary             | 1.7.20            | llibrary-1.7.20-1.12.2.jar                                   | b9f30a813bee3b9dd5652c460310cfcd54f6b7ec |     | LC    | iceandfire           | 1.9.1             | iceandfire-1.9.1-1.12.2.jar                                  | None                                     |     | LC    | illagers_plus        | 1.1               | IllagersPlus-1.12.2-1.1.3.jar                                | None                                     |     | LC    | ironchest            | 1.12.2-7.0.67.844 | ironchest-1.12.2-7.0.69.845.jar                              | None                                     |     | L     | kaishiweapons        | v2018.01          | Kaishi's+Weapons+REBORN+v2018.01+[1.12.2].jar                | None                                     |     | L     | moarores             | 1.1.1             | Moarores-1.1.1.jar                                           | None                                     |     | L     | gachashroom          | 1.0.0             | MushroomQuest+1.12.2+-+v1.7.jar                              | None                                     |     | L     | naturescompass       | 1.5.0             | NaturesCompass-1.12.2-1.5.0.jar                              | None                                     |     | L     | reccomplex           | 1.4.5             | RecurrentComplex-1.4.5.1.jar                                 | None                                     |     | L     | roguelike            | 1.8.0             | RoguelikeDungeons-1.12.2-1.8.0.jar                           | None                                     |     | L     | secretroomsmod       | 5.2.4             | Secret_Rooms_Brouillon__29_mod_fr-minecraft_PH9U.jar         | None                                     |     | L     | theaurorian          | 1.12.2-Release    | theaurorian-1.12.2-release-may3021.jar                       | None                                     |     | L     | torchmaster          | 1.6.1.53          | torchmaster_1.12.2-1.6.1.53.jar                              | None                                     |     | L     | xpholder             | 1.0.1             | XpHolder-1.0.1-mc1.12.x.jar                                  | None                                     |     | L     | phosphor-lighting    | 1.12.2-0.2.7      | phosphor-forge-mc1.12.2-0.2.7-universal.jar                  | None                                     |     | L     | trapexpansion        | 1.0.0             | trapexpansion-1.0.0.jar                                      | None                                     |     Loaded coremods (and transformers):  llibrary (llibrary-core-1.0.11-1.12.2.jar)   net.ilexiconn.llibrary.server.core.plugin.LLibraryTransformer   net.ilexiconn.llibrary.server.core.patcher.LLibraryRuntimePatcher PhosphorFMLLoadingPlugin (phosphor-forge-mc1.12.2-0.2.7-universal.jar)    IvToolkit (IvToolkit-1.3.3-1.12.jar)    iceandfire (iceandfire-1.9.1-1.12.2.jar)   com.github.alexthe666.iceandfire.patcher.IceAndFireRuntimePatcher CTMCorePlugin (CTM-MC1.12.2-1.0.2.31.jar)   team.chisel.ctm.client.asm.CTMTransformer SRM-Core (Secret_Rooms_Brouillon__29_mod_fr-minecraft_PH9U.jar)   com.wynprice.secretroomsmod.core.UVTransformer     Profiler Position: N/A (disabled)     Is Modded: Definitely; Server brand changed to 'fml,forge'     Type: Dedicated Server (map_server.txt)
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.