Files
neoLegacy/Minecraft.World/MaterialColor.cpp
T
Tranqlmao 9abd52985e TU53 + Bug Fixes (Many)
Patch Notes:
Blocks
+ Colored shulker boxes
+ Concrete powder
+ Concrete
+ Glazed terracotta
Items
+ Shulker shell
+ Iron nugget
UI Changes
+ Added Custom Controls to Keyboard & Mouse, as well as Controller
+ Added Custom SuperFlat
+ Added Edit Server Menu
+ Added Firework Crafting
Feature Changes
+ Host Options
+ Added Pick Block
+ Added off-hand slot for maps and arrows.
Bug Fixes & changes
+ TU47: Banner hitbox wrong (and inventory model fixed)
+ TU47/48: Ice not melting properly
+ TU48: Dead bushes not dropping sticks
+ TU48: Guardians and polar bears not dropping cooked fish when on fire
+ TU48: Bonus chest missing saplings and seeds
+ TU48: Frosted ice obtainable
+ TU48: Hoppers not collecting items
+ TU48: Wither skeletons spawning in 2-high gaps
+ TU48: End crystals exploding with “TNT Explodes” off
+ TU48: Tamed ocelots staying hostile
+ TU48: Signs not placing on tall grass
+ TU51: Skeleton hitbox wrong
+ TU53: Fall damage in shallow water
+ TU53: Squids not spawning in man-made pools
+ Elytra has been improved to be more accurate to the source material
+ Removed Spectral Arrow from crafting
+ Fixed several broken item descriptions
+ You can no longer cook Pufferfish or Clownfish
+ Fixed scaling issue with paperdoll and chat
+ Iron and gold armor can now be smelted into nuggets.
+ More items can now be used as fuel in a furnace.
+ Using a firework rocket while gliding with elytra will now give the player a boost.
+ Changed the color of dyes, wool, carpets, and banners.
+ Reordered all colored blocks and items in the Creative inventory. Banners now have the same order of colors as all other colored blocks and items.
+ Fishing rods can now hook on entities without causing knockback or pseudo-damage.
+ Fixed banner crafting
+ Fixed Map colors for certain blocks
+ Fixed Path block height
+ Fixed String block issues
+ Fixed Item frame culling.
+ Fixed Tutorial world NBT/Block State issues
+ Fixed World Slider
+ Fixed Enderman AI
+ Fixed Player animation bug
+ HUD Flash text changes
+ Generation accuracy changes
+ Many other small accuracy changes and fixes
2026-11-24 13:44:06 -05:00

208 lines
11 KiB
C++

#include "stdafx.h"
#include "MaterialColor.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.material.h"
MaterialColor **MaterialColor::colors;
MaterialColor *MaterialColor::none = nullptr;
MaterialColor *MaterialColor::grass = nullptr;
MaterialColor *MaterialColor::sand = nullptr;
MaterialColor *MaterialColor::cloth = nullptr;
MaterialColor *MaterialColor::fire = nullptr;
MaterialColor *MaterialColor::ice = nullptr;
MaterialColor *MaterialColor::metal = nullptr;
MaterialColor *MaterialColor::plant = nullptr;
MaterialColor *MaterialColor::snow = nullptr;
MaterialColor *MaterialColor::clay = nullptr;
MaterialColor *MaterialColor::dirt = nullptr;
MaterialColor *MaterialColor::stone = nullptr;
MaterialColor *MaterialColor::water = nullptr;
MaterialColor *MaterialColor::wood = nullptr;
MaterialColor *MaterialColor::emerald = nullptr;
MaterialColor *MaterialColor::quartz = nullptr;
MaterialColor *MaterialColor::colorOrange = nullptr;
MaterialColor *MaterialColor::colorMagenta = nullptr;
MaterialColor *MaterialColor::colorLightBlue = nullptr;
MaterialColor *MaterialColor::colorYellow = nullptr;
MaterialColor *MaterialColor::colorLightGreen = nullptr;
MaterialColor *MaterialColor::colorPink = nullptr;
MaterialColor *MaterialColor::colorGrey = nullptr;
MaterialColor *MaterialColor::colorSilver = nullptr;
MaterialColor *MaterialColor::colorCyan = nullptr;
MaterialColor *MaterialColor::colorPurple = nullptr;
MaterialColor *MaterialColor::colorBlue = nullptr;
MaterialColor *MaterialColor::colorBrown = nullptr;
MaterialColor *MaterialColor::colorGreen = nullptr;
MaterialColor *MaterialColor::colorRed = nullptr;
MaterialColor *MaterialColor::colorBlack = nullptr;
MaterialColor *MaterialColor::gold = nullptr;
MaterialColor *MaterialColor::diamond = nullptr;
MaterialColor *MaterialColor::lapis = nullptr;
MaterialColor *MaterialColor::podzol = nullptr;
MaterialColor *MaterialColor::nether = nullptr;
MaterialColor *MaterialColor::terracottaWhite = nullptr;
MaterialColor *MaterialColor::terracottaOrange = nullptr;
MaterialColor *MaterialColor::terracottaMagenta = nullptr;
MaterialColor *MaterialColor::terracottaLightBlue = nullptr;
MaterialColor *MaterialColor::terracottaYellow = nullptr;
MaterialColor *MaterialColor::terracottaLightGreen = nullptr;
MaterialColor *MaterialColor::terracottaPink = nullptr;
MaterialColor *MaterialColor::terracottaGrey = nullptr;
MaterialColor *MaterialColor::terracottaSilver = nullptr;
MaterialColor *MaterialColor::terracottaCyan = nullptr;
MaterialColor *MaterialColor::terracottaPurple = nullptr;
MaterialColor *MaterialColor::terracottaBlue = nullptr;
MaterialColor *MaterialColor::terracottaBrown = nullptr;
MaterialColor *MaterialColor::terracottaGreen = nullptr;
MaterialColor *MaterialColor::terracottaRed = nullptr;
MaterialColor *MaterialColor::terracottaBlack = nullptr;
void MaterialColor::staticCtor()
{
MaterialColor::colors = new MaterialColor *[64];
for (int i = 0; i < 64; i++) MaterialColor::colors[i] = nullptr;
MaterialColor::none = new MaterialColor(0, eMinecraftColour_Material_None);
MaterialColor::grass = new MaterialColor(1, eMinecraftColour_Material_Grass);
MaterialColor::sand = new MaterialColor(2, eMinecraftColour_Material_Sand);
MaterialColor::cloth = new MaterialColor(3, eMinecraftColour_Material_Cloth);
MaterialColor::fire = new MaterialColor(4, eMinecraftColour_Material_Fire);
MaterialColor::ice = new MaterialColor(5, eMinecraftColour_Material_Ice);
MaterialColor::metal = new MaterialColor(6, eMinecraftColour_Material_Metal);
MaterialColor::plant = new MaterialColor(7, eMinecraftColour_Material_Plant);
MaterialColor::snow = new MaterialColor(8, eMinecraftColour_Material_Snow);
MaterialColor::clay = new MaterialColor(9, eMinecraftColour_Material_Clay);
MaterialColor::dirt = new MaterialColor(10, eMinecraftColour_Material_Dirt);
MaterialColor::stone = new MaterialColor(11, eMinecraftColour_Material_Stone);
MaterialColor::water = new MaterialColor(12, eMinecraftColour_Material_Water);
MaterialColor::wood = new MaterialColor(13, eMinecraftColour_Material_Wood);
MaterialColor::emerald = new MaterialColor(33, eMinecraftColour_Material_Emerald);
MaterialColor::quartz = new MaterialColor(14, eMinecraftColour_Material_Quartz);
MaterialColor::colorOrange = new MaterialColor(15, eMinecraftColour_Material_Color_Orange);
MaterialColor::colorMagenta = new MaterialColor(16, eMinecraftColour_Material_Color_Magenta);
MaterialColor::colorLightBlue = new MaterialColor(17, eMinecraftColour_Material_Color_Light_Blue);
MaterialColor::colorYellow = new MaterialColor(18, eMinecraftColour_Material_Color_Yellow);
MaterialColor::colorLightGreen = new MaterialColor(19, eMinecraftColour_Material_Color_Light_Green);
MaterialColor::colorPink = new MaterialColor(20, eMinecraftColour_Material_Color_Pink);
MaterialColor::colorGrey = new MaterialColor(21, eMinecraftColour_Material_Color_Grey);
MaterialColor::colorSilver = new MaterialColor(22, eMinecraftColour_Material_Color_Silver);
MaterialColor::colorCyan = new MaterialColor(23, eMinecraftColour_Material_Color_Cyan);
MaterialColor::colorPurple = new MaterialColor(24, eMinecraftColour_Material_Color_Purple);
MaterialColor::colorBlue = new MaterialColor(25, eMinecraftColour_Material_Color_Blue);
MaterialColor::colorBrown = new MaterialColor(26, eMinecraftColour_Material_Color_Brown);
MaterialColor::colorGreen = new MaterialColor(27, eMinecraftColour_Material_Color_Green);
MaterialColor::colorRed = new MaterialColor(28, eMinecraftColour_Material_Color_Red);
MaterialColor::colorBlack = new MaterialColor(29, eMinecraftColour_Material_Color_Black);
MaterialColor::gold = new MaterialColor(30, eMinecraftColour_Material_Gold);
MaterialColor::diamond = new MaterialColor(31, eMinecraftColour_Material_Diamond);
MaterialColor::lapis = new MaterialColor(32, eMinecraftColour_Material_Lapis);
MaterialColor::podzol = new MaterialColor(34, eMinecraftColour_Material_Podzol);
MaterialColor::nether = new MaterialColor(35, eMinecraftColour_Material_Nether);
MaterialColor::terracottaWhite = new MaterialColor(36, eMinecraftColour_Material_Terracotta_White);
MaterialColor::terracottaOrange = new MaterialColor(37, eMinecraftColour_Material_Terracotta_Orange);
MaterialColor::terracottaMagenta = new MaterialColor(38, eMinecraftColour_Material_Terracotta_Magenta);
MaterialColor::terracottaLightBlue = new MaterialColor(39, eMinecraftColour_Material_Terracotta_Light_Blue);
MaterialColor::terracottaYellow = new MaterialColor(40, eMinecraftColour_Material_Terracotta_Yellow);
MaterialColor::terracottaLightGreen = new MaterialColor(41, eMinecraftColour_Material_Terracotta_Light_Green);
MaterialColor::terracottaPink = new MaterialColor(42, eMinecraftColour_Material_Terracotta_Pink);
MaterialColor::terracottaGrey = new MaterialColor(43, eMinecraftColour_Material_Terracotta_Grey);
MaterialColor::terracottaSilver = new MaterialColor(44, eMinecraftColour_Material_Terracotta_Silver);
MaterialColor::terracottaCyan = new MaterialColor(45, eMinecraftColour_Material_Terracotta_Cyan);
MaterialColor::terracottaPurple = new MaterialColor(46, eMinecraftColour_Material_Terracotta_Purple);
MaterialColor::terracottaBlue = new MaterialColor(47, eMinecraftColour_Material_Terracotta_Blue);
MaterialColor::terracottaBrown = new MaterialColor(48, eMinecraftColour_Material_Terracotta_Brown);
MaterialColor::terracottaGreen = new MaterialColor(49, eMinecraftColour_Material_Terracotta_Green);
MaterialColor::terracottaRed = new MaterialColor(50, eMinecraftColour_Material_Terracotta_Red);
MaterialColor::terracottaBlack = new MaterialColor(51, eMinecraftColour_Material_Terracotta_Black);
}
MaterialColor::MaterialColor(int id, eMinecraftColour col)
{
this->id = id;
this->col = col;
colors[id] = this;
}
MaterialColor *MaterialColor::forTile(int tile, int data)
{
if (tile <= 0 || tile >= Tile::TILE_NUM_COUNT || Tile::tiles[tile] == nullptr) return none;
MaterialColor *dyed[16] = { snow, colorOrange, colorMagenta, colorLightBlue, colorYellow, colorLightGreen, colorPink, colorGrey, colorSilver, colorCyan, colorPurple, colorBlue, colorBrown, colorGreen, colorRed, colorBlack };
MaterialColor *terracotta[16] = { terracottaWhite, terracottaOrange, terracottaMagenta, terracottaLightBlue, terracottaYellow, terracottaLightGreen, terracottaPink, terracottaGrey, terracottaSilver, terracottaCyan, terracottaPurple, terracottaBlue, terracottaBrown, terracottaGreen, terracottaRed, terracottaBlack };
MaterialColor *planks[6] = { wood, podzol, sand, dirt, colorOrange, colorBrown };
if (tile >= 219 && tile <= 234) return dyed[tile - 219];
if (tile >= 235 && tile <= 250) return dyed[tile - 235];
switch (tile)
{
case 1:
switch (data & 7) { case 1: case 2: return dirt; case 3: case 4: return quartz; default: return stone; }
case 3: return (data & 3) == 2 ? podzol : dirt;
case 5: case 125: case 126: return planks[(data & 7) < 6 ? (data & 7) : 0];
case 12: return (data & 1) ? colorOrange : sand;
case 13: return stone;
case 17:
{
int variant = data & 3;
if (((data >> 2) & 3) == 0) return planks[variant];
MaterialColor *bark[4] = { podzol, colorBrown, quartz, podzol };
return bark[variant];
}
case 162:
{
int variant = data & 1;
if (((data >> 2) & 3) == 0) return planks[4 + variant];
return variant == 0 ? stone : colorBrown;
}
case 19: return colorYellow;
case 22: return lapis;
case 24: case 128: return sand;
case 25: case 47: return wood;
case 32: return wood;
case 35: case 95: case 160: case 171: case 251: case 252: return dyed[data & 15];
case 41: case 147: return gold;
case 42: case 148: case 71: case 167: return metal;
case 43: case 44:
switch (data & 7) { case 1: return sand; case 2: return wood; case 4: return colorRed; case 6: return nether; case 7: return quartz; default: return stone; }
case 45: case 108: return colorRed;
case 46: case 152: return fire;
case 49: case 173: return colorBlack;
case 53: case 64: case 85: case 96: case 107: return wood;
case 57: return diamond;
case 60: case 208: return dirt;
case 84: return dirt;
case 86: case 91: case 172: return colorOrange;
case 87: case 112: case 113: case 114: case 153: case 213: case 215: return nether;
case 88: return colorBrown;
case 89: case 121: case 206: case 216: return sand;
case 99:
case 100:
if ((data & 15) == 15) return cloth;
if ((data & 15) == 0 || (data & 15) == 10) return sand;
return tile == 99 ? dirt : colorRed;
case 103: return colorLightGreen;
case 110: return colorPurple;
case 133: return emerald;
case 134: case 183: case 188: case 193: return podzol;
case 135: case 184: case 189: case 194: return sand;
case 136: case 185: case 190: case 195: return dirt;
case 163: case 179: case 180: case 181: case 182: case 187: case 192: case 196: return colorOrange;
case 164: case 186: case 191: case 197: return colorBrown;
case 137: return colorBrown;
case 210: return colorPurple;
case 211: return colorGreen;
case 155: case 156: case 169: return quartz;
case 159: return terracotta[data & 15];
case 165: return grass;
case 168: return (data & 3) == 0 ? colorCyan : diamond;
case 170: return colorYellow;
case 174: return ice;
case 201: case 202: case 203: case 204: case 205: return colorMagenta;
case 214: return colorRed;
}
MaterialColor *col = Tile::tiles[tile]->material->color;
return col != nullptr ? col : none;
}