Jump to content

Where are the basic color values coded?


Drachenbauer

Recommended Posts

Most things that use the colors (excluding leather armor and such) don't use them dynamically; you'd have to actually change the textures, names, etc. to have any effect.

In any case, no. There's no reasonable way to change anything to do with DyeColor. Oh right, reflection duh.

Edited by imacatlolol
I'm dumb

I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.

Link to comment
Share on other sites

The sheep has this:

 

public static DyeColor getRandomSheepColor(Random random)
    {
        int i = random.nextInt(100);
        
        if (i < 5)
        {
            return DyeColor.BLACK;
        }
        else if (i < 10)
        {
            return DyeColor.GRAY;
        }
        else if (i < 15)
        {
            return DyeColor.LIGHT_GRAY;
        }
        else if (i < 18)
        {
            return DyeColor.BROWN;
        }
        else if (random.nextInt(500) == 0)
        {
            return DyeColor.PINK;
        }
        else
        {
            return DyeColor.WHITE;
        }
    }

 

Link to comment
Share on other sites

Yes.

I know about theese fields.

Must i extend and override the sheep to replace the stuff, shown above, with such custom colorvalues?

I don´t know, how to put stuff with custom values in theese fields, behind the "return" in this mthod there?

Edited by Drachenbauer
Link to comment
Share on other sites

At searching for "change fields with reflection" i found this:

        Class<?> clazz = Class.forName("Child");
        Object cc = clazz.newInstance();

        Field f1 = cc.getClass().getField("a_field");
        f1.set(cc, "reflecting on life");

 

But if i try to use DyeColors in there, it says things about IllegalAcessExeption.

i hat to put theese exeptionhandlings to the header of the function, i placed this in.

 

another question:

A color-field holds alot of content;

WHITE(0, "white", 16777215, MaterialColor.SNOW, 16777215, 16777215),

how do i put all this into the setter of this reflection-stuff?

Edited by Drachenbauer
Link to comment
Share on other sites

        ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.WHITE, 16777215, "colorvalue");
        ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.WHITE, 16777215, "fireworkColor");
        ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.WHITE, 16777215, "textColor");

Is this the way to do it?

 

To repeat for all 16 colors.

Edited by Drachenbauer
Link to comment
Share on other sites

In my lines there i use the clear names DyeColor and WHITE.

I taught, maybe i have to use the SRG-Names for theese things, too, in the positions for class and instance in the code-line...

 

But maybe not, because it don´t want theese names as a string, like the fieldname.

 

Another thing, yout discord-link stucks on connecting (a black page with a rotating discord-logo)...

Edited by Drachenbauer
Link to comment
Share on other sites

Now i have theese lines for all 15 colors.

 

Is this all i need to show all this stuff in the new colors?

 

Now i found the class MaterialColors, where i als want to change fields now.

What must i put there as the class-instance?

 

Edit:

The colors of banners and stuff are not changed now.

What else must i do, to make it work?

Edited by Drachenbauer
Link to comment
Share on other sites

I made a test, but the banners, sheeps and other stuff still appear in old colors.

I tried the code in common-setup and client-registries in my main-class, both the same.

 

Now my lines look like this:

        ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.RED, 0xff0000, "field_193351_w"); //colorvalue
        ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.RED, 0xff0000, "field_196067_y"); //fireworkColor
        ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.RED, 0xff0000, "field_218390_z"); //textColor

Such a stack for each color.

 

And for the material-color, i found out, that the colors there are such class-instances, zoo.

So i was able to make this:

ObfuscationReflectionHelper.setPrivateValue(MaterialColor.class, MaterialColor.RED, 0xff0000, "field_76291_p");//colorvalue

also for all theese 16 colors and terracotta-colors. (there are some more values, but i don´t want to change them.)

 

What do i miss, to get this stuff to work?

Edited by Drachenbauer
Link to comment
Share on other sites

i decided to watch a video, how to use the debugger, than try this, and than tell more here.

Like the guy in the video, i made a breakpoint at the first one of theese lines and clicked the debug-button, but it does not stop there.

 

in other mods, other code, located in common-setup and client-registries is executed.

So i´m wondering about this.

Edited by Drachenbauer
Link to comment
Share on other sites

Now i finally found the solution:

i remembered, that there is a calculation for colorComponentValues.

i placed it in a function in my main-class and passed the result of this function into another reflection-line for each color, that uses the field colorComponentValues.

now the game-stuff appears in the new colors.

Link to comment
Share on other sites

Now i noticed, there seems to be a slightly different shader, if the color comes from a texture pnr or from a colorvalue-number in the code:

2020-04-13_18_20_22.png.df1ed41520fea61350e81624b9243e35.png

The leather-armour is dyed with the new shade of pink, i gave with my mod-code.

And in my skin png (Stella from Angry Birds) i used the same color value for the pink color.

So i wonder, why it looks different on almost horizontal surfaces (like the character´s face, if looking upward, like in the upper picture or the top of the body-ModelBox)

2020-04-13_18_20_09.png.4a8025ec457fd6ba4e31a56d9ed3c401.png

in this more vertical orientation, you can see, that the lighter pink in the middie of th helmet-front is exctly the same as at the face of the character.

And directly below the head, you can see the different shading between body and armour again

 

another sample:

bed and banner

2020-04-13_18_38_44.png.f8e35ebff50f5b384ba2b7a26a75185f.png

In this bed-texture png i also used the same shade of pink and the banner get´s it´s color from my mod-code.

both models are TileEntity models

The same difference at the horizontal surfaces (the narrow top of the banner looks closer to white, than the top of the bed).

 

Why it makes a difference there, if the color comes from the texture or from a value in the code?

Edited by Drachenbauer
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.
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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • A code: public class CommonProxy {     public void registerItemRenderer() {         Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(                 ModItems.YOUR_ITEM,                 0,                 new ModelResourceLocation(ModItems.YOUR_ITEM.getRegistryName(), "inventory")         );         Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(                 ModItems.YOUR_ITEM,                 0,                 new ModelResourceLocation(ModItems.YOUR_ITEM.getRegistryName(), "inventory"),                 new CustomItemRenderer(Minecraft.getMinecraft().getTextureManager(), Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getModelManager(), Minecraft.getMinecraft().getItemColors())         );     } }   In YOUR_ITEM you must specify item.
    • Selamat datang di Rajacasino88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini Rajacasino88.
    • Dalam mengikuti tren perubahan digital, Bank BRI terus berinovasi untuk memenuhi kebutuhan dan keinginan nasabahnya. Salah satu upaya terbaru yang dilakukan oleh Bank BRI adalah meluncurkan platform permainan online yang menarik, yang
    • Selamat datang di Beton88 salah satu situs slot gacor gampang menang hari ini di Indonesia yang sangat menjajikan. Slot gacor adalah adalah suatu istilah yang digunakan untuk menjelaskan sebuah permainan slot gampang menang di situs slot online. Situs slot gacor ini bisa menjadi populer walaupun terbilang baru karena RTP slot online yang disajikan begitu tinggi. Seiring dengan perkembangan zaman situs slot gacor terbaru ini juga sudah update dari segi teknologi yang menggunakan HTML5, inilah yang membuat grafis permainan terlihat begitu modern, audio lebih jernih, dan user interface yang smooth. Tidak dipungkiri grafis yang kami memiliki sudah menarik banyak sekali pendatang baru yang ingin merasakan terbawa dalam suasana tema permainan mesin slot. Kehadiran slot gacor menjadi angin segar bagi para pecinta judi online, memberikan alternatif permainan yang seru dan menguntungkan. Tak heran jika popularitas slot gacor terus meningkat, menarik minat para pemain baru untuk mencoba peruntungan mereka di situs slot gacor hari ini Beton88.
    • KLIK DISINI >>> LINK LOGIN & DAFTAR KLIK DISINI >>>   DAFTAR AKUN GACOR KLIK DISINI >>> DAFTAR AKUN VVIP KLIK DISINI >>> DAFTAR AKUN SLOT ANTI RUNGKAD KLIK DISINI >>>  LINK ALTERNATIF KLIK DISINI >>> AKUN GACOR SCATTER HITAM ULTRA88 adalah slot gacor winrate 100% dengan server thailand dan akun pro. Dapatkan akses menuju kemenangan ke puluhan sampai ratusan juta rupiah hanya dalam hitungan menit. 3 web yang kami hadirkan ini adalah yang terbaik dengan histori kemenangan tertinggi di satu Asia Tenggara. Member-member dari web ini selalu kembali karena tim admin dan CS yang profesional serta kemenangan berapapun pasti akan dibayar. RTP slot gacor juga sudah disiapkan agar kalian tidak bingung lagi mau main apa dan di jam berapa. Semua fasilitas seperti deposit dana dan pulsa sudah disiapkan juga untuk kemudahan para slotters. Jadi tunggu apalagi? Raih kemenangan kalian disini sekarang juga!
  • Topics

×
×
  • Create New...

Important Information

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