mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
* Add PatchManager - Allows you to patch terrain.png and items.png on the fly.
This can be used for modding, since you don't need to share copyrighted Mojang assets alongside your texture patches.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "Tile.hpp"
|
||||
#include "world/level/Level.hpp"
|
||||
#include "client/renderer/PatchManager.hpp"
|
||||
|
||||
GrassTile::GrassTile(int id, Material* c) : Tile(id, c)
|
||||
{
|
||||
@@ -17,10 +18,10 @@ GrassTile::GrassTile(int id, Material* c) : Tile(id, c)
|
||||
|
||||
int GrassTile::getColor(LevelSource*, int x, int y, int z)
|
||||
{
|
||||
#ifdef MOD_DONT_COLOR_GRASS
|
||||
if (GetPatchManager()->IsGrassTinted())
|
||||
return 0x339933;
|
||||
|
||||
return 0xffffff;
|
||||
#endif
|
||||
return 0x339933;
|
||||
}
|
||||
|
||||
int GrassTile::getResource(int i, Random* random)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "Tile.hpp"
|
||||
#include "world/level/Level.hpp"
|
||||
#include "client/renderer/PatchManager.hpp"
|
||||
|
||||
LeafTile::LeafTile(int id) : TransparentTile(id, TEXTURE_LEAVES_TRANSPARENT, Material::leaves, false)
|
||||
{
|
||||
@@ -33,10 +34,10 @@ void LeafTile::die(Level* level, int x, int y, int z)
|
||||
|
||||
int LeafTile::getColor(LevelSource* level, int x, int y, int z)
|
||||
{
|
||||
#ifdef MOD_DONT_COLOR_GRASS
|
||||
if (GetPatchManager()->IsGrassTinted())
|
||||
return 0x339933;
|
||||
|
||||
return 0xffffff;
|
||||
#endif
|
||||
return 0x339933;
|
||||
}
|
||||
|
||||
int LeafTile::getTexture(int dir, int data)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "Tile.hpp"
|
||||
#include "world/level/Level.hpp"
|
||||
#include "client/renderer/PatchManager.hpp"
|
||||
|
||||
MetalTile::MetalTile(int ID, int texture, Material* pMtl) : Tile(ID, pMtl)
|
||||
{
|
||||
@@ -19,5 +20,12 @@ MetalTile::MetalTile(int ID, int texture, Material* pMtl) : Tile(ID, pMtl)
|
||||
// textures for these tiles. :)
|
||||
int MetalTile::getTexture(int dir)
|
||||
{
|
||||
return m_TextureFrame;
|
||||
int yoff = GetPatchManager()->GetMetalSideYOffset();
|
||||
if (yoff < 0)
|
||||
return m_TextureFrame;
|
||||
|
||||
if (dir == DIR_YPOS) return m_TextureFrame;
|
||||
if (dir == DIR_YNEG) return m_TextureFrame + 16 * (yoff + 1);
|
||||
|
||||
return m_TextureFrame + 16 * (yoff + 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user