diff --git a/Minecraft.Client/ClockTexture.cpp b/Minecraft.Client/ClockTexture.cpp index 340cc0d3..ab16da0b 100644 --- a/Minecraft.Client/ClockTexture.cpp +++ b/Minecraft.Client/ClockTexture.cpp @@ -23,8 +23,12 @@ ClockTexture::ClockTexture(int iPad, ClockTexture *dataTexture) : StitchedTextur void ClockTexture::cycleFrames() { - Minecraft *mc = Minecraft::GetInstance(); + int frameCount = getFrames(); + if (frameCount <= 0) + { + return; + } double rott = 0; if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr) @@ -57,10 +61,10 @@ void ClockTexture::cycleFrames() // 4J Stu - We share data with another texture if(m_dataTexture != nullptr) { - int newFrame = static_cast((rot + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + int newFrame = static_cast((rot + 1.0) * frameCount) % frameCount; while (newFrame < 0) { - newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + newFrame = (newFrame + frameCount) % frameCount; } if (newFrame != frame) { @@ -70,10 +74,10 @@ void ClockTexture::cycleFrames() } else { - int newFrame = static_cast((rot + 1.0) * frames->size()) % frames->size(); + int newFrame = static_cast((rot + 1.0) * frameCount) % frameCount; while (newFrame < 0) { - newFrame = (newFrame + frames->size()) % frames->size(); + newFrame = (newFrame + frameCount) % frameCount; } if (newFrame != frame) { diff --git a/Minecraft.Client/CompassTexture.cpp b/Minecraft.Client/CompassTexture.cpp index dd5f5213..78d3e5fa 100644 --- a/Minecraft.Client/CompassTexture.cpp +++ b/Minecraft.Client/CompassTexture.cpp @@ -77,13 +77,19 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double rot += rota; } + int frameCount = getFrames(); + if (frameCount <= 0) + { + return; + } + // 4J Stu - We share data with another texture if(m_dataTexture != nullptr) { - int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * frameCount) % frameCount; while (newFrame < 0) { - newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size(); + newFrame = (newFrame + frameCount) % frameCount; } if (newFrame != frame) { @@ -93,10 +99,10 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double } else { - int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size(); + int newFrame = static_cast(((rot / (PI * 2)) + 1.0) * frameCount) % frameCount; while (newFrame < 0) { - newFrame = (newFrame + frames->size()) % frames->size(); + newFrame = (newFrame + frameCount) % frameCount; } if (newFrame != frame) { diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index 6247483a..2f990f6e 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -200,6 +200,8 @@ void PreStitchedTextureMap::stitch() void PreStitchedTextureMap::makeTextureAnimated(TexturePack *texturePack, StitchedTexture *tex) { + + if(!tex->hasOwnData()) { animatedTextures.push_back(tex); @@ -212,15 +214,18 @@ void PreStitchedTextureMap::makeTextureAnimated(TexturePack *texturePack, Stitch if(!animString.empty()) { + wstring filename = path + textureFileName + extension; // TODO: [EB] Put the frames into a proper object, not this inside out hack - vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap); + vector *frames = TextureManager::getInstance()->createTextures(filename, m_mipMap, true); if (frames == nullptr || frames->empty()) { return; // Couldn't load a texture, skip it } + + Texture *first = frames->at(0); #ifndef _CONTENT_PACKAGE @@ -259,7 +264,10 @@ void PreStitchedTextureMap::cycleAnimationFrames() { for(StitchedTexture* texture : animatedTextures) { - texture->cycleFrames(); + if (texture != nullptr && texture->getFrames() > 0) + { + texture->cycleFrames(); + } } } diff --git a/Minecraft.Client/StitchedTexture.cpp b/Minecraft.Client/StitchedTexture.cpp index 88ab3e56..aca2c7cc 100644 --- a/Minecraft.Client/StitchedTexture.cpp +++ b/Minecraft.Client/StitchedTexture.cpp @@ -192,6 +192,11 @@ int StitchedTexture::getSourceHeight() const void StitchedTexture::cycleFrames() { + if (frames == nullptr || frames->empty()) + { + return; + } + if (frameOverride != nullptr) { pair current = frameOverride->at(frame); diff --git a/Minecraft.Client/TextureManager.cpp b/Minecraft.Client/TextureManager.cpp index 173f4578..eeba43bd 100644 --- a/Minecraft.Client/TextureManager.cpp +++ b/Minecraft.Client/TextureManager.cpp @@ -80,10 +80,13 @@ Stitcher *TextureManager::createStitcher(const wstring &name) return new Stitcher(name, maxTextureSize, maxTextureSize, true); } -vector *TextureManager::createTextures(const wstring &filename, bool mipmap) +vector *TextureManager::createTextures(const wstring &filename, bool mipmap, bool forceAnimation) { vector *result = new vector(); TexturePack *texturePack = Minecraft::GetInstance()->skins->getSelected(); + TexturePack *imagePack = texturePack; + + //try { int mode = Texture::TM_CONTAINER; // Most important -- so it doesn't get uploaded to videoram int clamp = Texture::WM_WRAP; // 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader //Texture::WM_CLAMP; @@ -95,9 +98,9 @@ vector *TextureManager::createTextures(const wstring &filename, bool wstring drive = L""; - if(texturePack->hasFile(L"res/" + filename,false)) + if(imagePack->hasFile(L"res/" + filename,false)) { - drive = texturePack->getPath(true); + drive = imagePack->getPath(true); } else { @@ -108,31 +111,39 @@ vector *TextureManager::createTextures(const wstring &filename, bool char *pchUsrDir = app.GetBDUsrDirPath(pchTextureName); wstring wstr (pchUsrDir, pchUsrDir+strlen(pchUsrDir)); drive= wstr + L"\\Common\\res\\TitleUpdate\\"; + imagePack = texturePack; } else #endif { - drive = Minecraft::GetInstance()->skins->getDefault()->getPath(true); + imagePack = Minecraft::GetInstance()->skins->getDefault(); + drive = imagePack->getPath(true); } } + + //BufferedImage *image = new BufferedImage(texturePack->getResource(L"/" + filename),false,true,drive); //ImageIO::read(texturePack->getResource(L"/" + filename)); - BufferedImage *image = texturePack->getImageResource(filename, false, true, drive); + BufferedImage *image = imagePack->getImageResource(filename, false, true, drive); MemSect(0); + + int height = image->getHeight(); int width = image->getWidth(); wstring texName = getTextureNameFromPath(filename); - if (isAnimation(filename, texturePack)) + if (forceAnimation || isAnimation(filename, texturePack)) { + // TODO: Read this information from the animation file later int frameWidth = width; int frameHeight = width; // This could end as 0 frames int frameCount = height / frameWidth; + for (int i = 0; i < frameCount; i++) { BufferedImage *subImage = image->getSubimage(0, frameHeight * i, frameWidth, frameHeight); @@ -140,6 +151,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool delete subImage; result->push_back(texture); } + } else { @@ -147,6 +159,7 @@ vector *TextureManager::createTextures(const wstring &filename, bool if (width == height) { result->push_back(createTexture(texName, mode, width, height, clamp, format, minFilter, magFilter, mipmap || image->getData(1) != nullptr, image)); + } else { @@ -158,6 +171,8 @@ vector *TextureManager::createTextures(const wstring &filename, bool } delete image; + + //return result; //} catch (FileNotFoundException e) { @@ -178,7 +193,10 @@ bool TextureManager::isAnimation(const wstring &filename, TexturePack *texturePa { wstring dataFileName = L"/" + filename.substr(0, filename.find_last_of(L'.')) + L".txt"; bool hasOriginalImage = texturePack->hasFile(L"/" + filename, false); - return Minecraft::GetInstance()->skins->getSelected()->hasFile(dataFileName, !hasOriginalImage); + + + + return texturePack->hasFile(dataFileName, !hasOriginalImage); } Texture *TextureManager::createTexture(const wstring &name, int mode, int width, int height, int wrap, int format, int minFilter, int magFilter, bool mipmap, BufferedImage *image) diff --git a/Minecraft.Client/TextureManager.h b/Minecraft.Client/TextureManager.h index b1d71d2d..c256db1b 100644 --- a/Minecraft.Client/TextureManager.h +++ b/Minecraft.Client/TextureManager.h @@ -29,7 +29,7 @@ public: void registerTexture(Texture *texture); void unregisterTexture(const wstring &name, Texture *texture); Stitcher *createStitcher(const wstring &name); - vector *createTextures(const wstring &filename, bool mipmap); // 4J added mipmap param + vector *createTextures(const wstring &filename, bool mipmap, bool forceAnimation = false); // 4J added mipmap param private: wstring getTextureNameFromPath(const wstring &filename); diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/item/armorstand/wood.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/item/armorstand/wood.png new file mode 100644 index 00000000..7d8d75ed Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/item/armorstand/wood.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/items.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/items.png index cdfcda76..468e56b2 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/items.png and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/items.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/endermite.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/endermite.png new file mode 100644 index 00000000..e7bd50cf Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/endermite.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian.png new file mode 100644 index 00000000..c2342cbd Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian_beam.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian_beam.png new file mode 100644 index 00000000..22689bc4 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian_beam.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian_elder.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian_elder.png new file mode 100644 index 00000000..784e5258 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/guardian_elder.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/black.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/black.png new file mode 100644 index 00000000..bb792efc Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/black.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/brown.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/brown.png new file mode 100644 index 00000000..95b35d14 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/brown.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/caerbannog.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/caerbannog.png new file mode 100644 index 00000000..4a9523e9 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/caerbannog.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/gold.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/gold.png new file mode 100644 index 00000000..3e4da4f4 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/gold.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/salt.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/salt.png new file mode 100644 index 00000000..925a34dd Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/salt.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/toast.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/toast.png new file mode 100644 index 00000000..51f86cda Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/toast.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/white.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/white.png new file mode 100644 index 00000000..f5a90206 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/white.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/white_splotched.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/white_splotched.png new file mode 100644 index 00000000..f0e0fa58 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/mob/rabbit/white_splotched.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrain.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrain.png index d1114a52..da301a2f 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrain.png and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrain.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel2.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel2.png index c44977ec..09eb854e 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel2.png and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel2.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel3.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel3.png index 1183375e..9c402cdd 100644 Binary files a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel3.png and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/terrainMipMapLevel3.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/glowstone.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/glowstone.png new file mode 100644 index 00000000..6f79309a Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/glowstone.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/log_jungle.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/log_jungle.png new file mode 100644 index 00000000..8642223a Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/log_jungle.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/prismarine_rough.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/prismarine_rough.png new file mode 100644 index 00000000..1edae985 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/prismarine_rough.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/redstoneLight_lit.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/redstoneLight_lit.png new file mode 100644 index 00000000..26b47aa7 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/redstoneLight_lit.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/sea_lantern.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/sea_lantern.png new file mode 100644 index 00000000..b3e7930c Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/sea_lantern.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vine.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vine.png new file mode 100644 index 00000000..0eac18f7 Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vine.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vineMipMapLevel2.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vineMipMapLevel2.png new file mode 100644 index 00000000..26a8ca5a Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vineMipMapLevel2.png differ diff --git a/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vineMipMapLevel3.png b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vineMipMapLevel3.png new file mode 100644 index 00000000..9c0d262b Binary files /dev/null and b/Minecraft.Client/Windows64Media/DLC/Festive/Data/x16Data/res/textures/blocks/vineMipMapLevel3.png differ