diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index fa377ad0..6e62c3b0 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -82,6 +82,7 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::obsidian_Id) ITEM(Tile::clay) ITEM(Tile::ice_Id) + ITEM(Tile::packed_ice_Id) ITEM(Tile::snow_Id) ITEM(Tile::netherRack_Id) ITEM(Tile::soulsand_Id) diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col index ebdcf7a9..bbbdeb1e 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col and b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col differ diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index 023e5d7a..ef9faf37 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -1034,6 +1034,7 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(23, 4, L"door_spruce_upper"); ADD_ICON(23, 13, L"sea_lantern"); + ADD_ICON(23, 12, L"packed_ice"); ADD_ICON(23, 14, L"inverted_daylight_detector"); ADD_ICON(23, 15, L"iron_trapdoor"); diff --git a/Minecraft.World/ButtonTile.cpp b/Minecraft.World/ButtonTile.cpp index b05d597d..e95196a2 100644 --- a/Minecraft.World/ButtonTile.cpp +++ b/Minecraft.World/ButtonTile.cpp @@ -7,362 +7,357 @@ #include "ButtonTile.h" #include "SoundTypes.h" -ButtonTile::ButtonTile(int id, bool sensitive) : Tile(id, Material::decoration,isSolidRender()) +ButtonTile::ButtonTile(int id, bool sensitive) : Tile(id, Material::decoration, isSolidRender()) { - this->setTicking(true); - this->sensitive = sensitive; + this->setTicking(true); + this->sensitive = sensitive; } Icon *ButtonTile::getTexture(int face, int data) { - if(id == Tile::button_wood_Id) return Tile::wood->getTexture(Facing::UP); - else return Tile::stone->getTexture(Facing::UP); + if(id == Tile::button_wood_Id) return Tile::wood->getTexture(Facing::UP); + else return Tile::stone->getTexture(Facing::UP); } AABB *ButtonTile::getAABB(Level *level, int x, int y, int z) { - return nullptr; + return nullptr; } int ButtonTile::getTickDelay(Level *level) { - return sensitive ? 30 : 20; + return sensitive ? 30 : 20; } bool ButtonTile::blocksLight() { - return false; + return false; } bool ButtonTile::isSolidRender(bool isServerLevel) { - return false; + return false; } bool ButtonTile::isCubeShaped() { - return false; + return false; } bool ButtonTile::mayPlace(Level *level, int x, int y, int z, int face) { - if (face == 2 && level->isSolidBlockingTile(x, y, z + 1)) return true; - if (face == 3 && level->isSolidBlockingTile(x, y, z - 1)) return true; - if (face == 4 && level->isSolidBlockingTile(x + 1, y, z)) return true; - if (face == 5 && level->isSolidBlockingTile(x - 1, y, z)) return true; - return false; + // face: 0=bottom, 1=top, 2=north, 3=south, 4=west, 5=east + if (face == 0 && level->isSolidBlockingTile(x, y + 1, z)) return true; // Soffitto + if (face == 1 && level->isSolidBlockingTile(x, y - 1, z)) return true; // Pavimento + if (face == 2 && level->isSolidBlockingTile(x, y, z + 1)) return true; // Nord + if (face == 3 && level->isSolidBlockingTile(x, y, z - 1)) return true; // Sud + if (face == 4 && level->isSolidBlockingTile(x + 1, y, z)) return true; // Ovest + if (face == 5 && level->isSolidBlockingTile(x - 1, y, z)) return true; // Est + return false; } bool ButtonTile::mayPlace(Level *level, int x, int y, int z) { - if (level->isSolidBlockingTile(x - 1, y, z)) - { - return true; - } - else if (level->isSolidBlockingTile(x + 1, y, z)) - { - return true; - } - else if (level->isSolidBlockingTile(x, y, z - 1)) - { - return true; - } - else if (level->isSolidBlockingTile(x, y, z + 1)) - { - return true; - } - return false; + if (level->isSolidBlockingTile(x - 1, y, z)) return true; + if (level->isSolidBlockingTile(x + 1, y, z)) return true; + if (level->isSolidBlockingTile(x, y, z - 1)) return true; + if (level->isSolidBlockingTile(x, y, z + 1)) return true; + if (level->isSolidBlockingTile(x, y - 1, z)) return true; + if (level->isSolidBlockingTile(x, y + 1, z)) return true; + return false; } int ButtonTile::getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue) { - int dir = level->getData(x, y, z); + int oldFlip = 0; + int dir = 1; - int oldFlip = dir & 8; - dir &= 7; + // face: 0=bottom, 1=top, 2=north, 3=south, 4=west, 5=east + if (face == 0 && level->isSolidBlockingTile(x, y + 1, z)) dir = 5; // Soffitto + else if (face == 1 && level->isSolidBlockingTile(x, y - 1, z)) dir = 6; // Pavimento + else if (face == 2 && level->isSolidBlockingTile(x, y, z + 1)) dir = 4; // Nord + else if (face == 3 && level->isSolidBlockingTile(x, y, z - 1)) dir = 3; // Sud + else if (face == 4 && level->isSolidBlockingTile(x + 1, y, z)) dir = 2; // Ovest + else if (face == 5 && level->isSolidBlockingTile(x - 1, y, z)) dir = 1; // Est + else dir = findFace(level, x, y, z); - if (face == 2 && level->isSolidBlockingTile(x, y, z + 1)) dir = 4; - else if (face == 3 && level->isSolidBlockingTile(x, y, z - 1)) dir = 3; - else if (face == 4 && level->isSolidBlockingTile(x + 1, y, z)) dir = 2; - else if (face == 5 && level->isSolidBlockingTile(x - 1, y, z)) dir = 1; - else dir = findFace(level, x, y, z); - - return dir + oldFlip; + return dir + oldFlip; } int ButtonTile::findFace(Level *level, int x, int y, int z) { - if (level->isSolidBlockingTile(x - 1, y, z)) - { - return 1; - } - else if (level->isSolidBlockingTile(x + 1, y, z)) - { - return 2; - } - else if (level->isSolidBlockingTile(x, y, z - 1)) - { - return 3; - } - else if (level->isSolidBlockingTile(x, y, z + 1)) - { - return 4; - } - return 1; + if (level->isSolidBlockingTile(x - 1, y, z)) return 1; // Est + if (level->isSolidBlockingTile(x + 1, y, z)) return 2; // Ovest + if (level->isSolidBlockingTile(x, y, z - 1)) return 3; // Sud + if (level->isSolidBlockingTile(x, y, z + 1)) return 4; // Nord + if (level->isSolidBlockingTile(x, y - 1, z)) return 5; // Soffitto + if (level->isSolidBlockingTile(x, y + 1, z)) return 6; // Pavimento + return 1; } void ButtonTile::neighborChanged(Level *level, int x, int y, int z, int type) { - if (checkCanSurvive(level, x, y, z)) - { - int dir = level->getData(x, y, z) & 7; - bool replace = false; + if (checkCanSurvive(level, x, y, z)) + { + int dir = level->getData(x, y, z) & 7; + bool replace = false; - if (!level->isSolidBlockingTile(x - 1, y, z) && dir == 1) replace = true; - if (!level->isSolidBlockingTile(x + 1, y, z) && dir == 2) replace = true; - if (!level->isSolidBlockingTile(x, y, z - 1) && dir == 3) replace = true; - if (!level->isSolidBlockingTile(x, y, z + 1) && dir == 4) replace = true; + if (dir == 1 && !level->isSolidBlockingTile(x - 1, y, z)) replace = true; // Est + if (dir == 2 && !level->isSolidBlockingTile(x + 1, y, z)) replace = true; // Ovest + if (dir == 3 && !level->isSolidBlockingTile(x, y, z - 1)) replace = true; // Sud + if (dir == 4 && !level->isSolidBlockingTile(x, y, z + 1)) replace = true; // Nord + if (dir == 5 && !level->isSolidBlockingTile(x, y + 1, z)) replace = true; // Soffitto + if (dir == 6 && !level->isSolidBlockingTile(x, y - 1, z)) replace = true; // Pavimento - if (replace) - { - spawnResources(level, x, y, z, level->getData(x, y, z), 0); - level->removeTile(x, y, z); - } - } + if (replace) + { + spawnResources(level, x, y, z, level->getData(x, y, z), 0); + level->removeTile(x, y, z); + } + } } bool ButtonTile::checkCanSurvive(Level *level, int x, int y, int z) { - if (!mayPlace(level, x, y, z)) - { - this->spawnResources(level, x, y, z, level->getData(x, y, z), 0); - level->removeTile(x, y, z); - return false; - } - return true; + if (!mayPlace(level, x, y, z)) + { + this->spawnResources(level, x, y, z, level->getData(x, y, z), 0); + level->removeTile(x, y, z); + return false; + } + return true; } -void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param +void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) { - int data = level->getData(x, y, z); - updateShape(data); + int data = level->getData(x, y, z); + updateShape(data); } void ButtonTile::updateShape(int data) { - int dir = data & 7; - bool pressed = (data & 8) > 0; + int dir = data & 7; + bool pressed = (data & 8) > 0; - float h0 = 6 / 16.0f; - float h1 = 10 / 16.0f; - float r = 3 / 16.0f; - float d = 2 / 16.0f; - if (pressed) d = 1 / 16.0f; + + float width = 3 / 16.0f; + float height = 4 / 16.0f; + float thickness = pressed ? 1 / 16.0f : 2 / 16.0f; - if (dir == 1) - { - setShape(0, h0, 0.5f - r, d, h1, 0.5f + r); - } - else if (dir == 2) - { - setShape(1 - d, h0, 0.5f - r, 1, h1, 0.5f + r); - } - else if (dir == 3) - { - setShape(0.5f - r, h0, 0, 0.5f + r, h1, d); - } - else if (dir == 4) - { - setShape(0.5f - r, h0, 1 - d, 0.5f + r, h1, 1); - } + float minY = 6 / 16.0f; + float maxY = 10 / 16.0f; + + if (dir == 1) // Est + { + setShape(0, minY, 0.5f - width, thickness, maxY, 0.5f + width); + } + else if (dir == 2) // Ovest + { + setShape(1 - thickness, minY, 0.5f - width, 1, maxY, 0.5f + width); + } + else if (dir == 3) // Sud + { + setShape(0.5f - width, minY, 0, 0.5f + width, maxY, thickness); + } + else if (dir == 4) // Nord + { + setShape(0.5f - width, minY, 1 - thickness, 0.5f + width, maxY, 1); + } + else if (dir == 5) // Soffitto + { + + setShape(0.5f - width, 1 - thickness, 0.5f - height/2, 0.5f + width, 1, 0.5f + height/2); + } + else if (dir == 6) // Pavimento + { + + setShape(0.5f - width, 0, 0.5f - height/2, 0.5f + width, thickness, 0.5f + height/2); + } } void ButtonTile::attack(Level *level, int x, int y, int z, shared_ptr player) { - //use(level, x, y, z, player, 0, 0, 0, 0); + //use(level, x, y, z, player, 0, 0, 0, 0); } -// 4J-PB - Adding a TestUse for tooltip display bool ButtonTile::TestUse() { - return true; + return true; } -bool ButtonTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param +bool ButtonTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) { - if (soundOnly) - { - // 4J - added - just do enough to play the sound - level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f); - return false; - } + if (soundOnly) + { + level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f); + return false; + } - int data = level->getData(x, y, z); - int dir = data & 7; - int open = 8 - (data & 8); - if (open == 0) return true; + int data = level->getData(x, y, z); + int dir = data & 7; + int open = 8 - (data & 8); + if (open == 0) return true; - level->setData(x, y, z, dir + open, Tile::UPDATE_ALL); - level->setTilesDirty(x, y, z, x, y, z); + level->setData(x, y, z, dir + open, Tile::UPDATE_ALL); + level->setTilesDirty(x, y, z, x, y, z); - level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f); + level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f); - updateNeighbours(level, x, y, z, dir); + updateNeighbours(level, x, y, z, dir); - level->addToTickNextTick(x, y, z, id, getTickDelay(level)); + level->addToTickNextTick(x, y, z, id, getTickDelay(level)); - return true; + return true; } void ButtonTile::onRemove(Level *level, int x, int y, int z, int id, int data) { - if ((data & 8) > 0) - { - int dir = data & 7; - updateNeighbours(level, x, y, z, dir); - } - Tile::onRemove(level, x, y, z, id, data); + if ((data & 8) > 0) + { + int dir = data & 7; + updateNeighbours(level, x, y, z, dir); + } + Tile::onRemove(level, x, y, z, id, data); } int ButtonTile::getSignal(LevelSource *level, int x, int y, int z, int dir) { - return (level->getData(x, y, z) & 8) > 0 ? Redstone::SIGNAL_MAX : Redstone::SIGNAL_NONE; + return (level->getData(x, y, z) & 8) > 0 ? Redstone::SIGNAL_MAX : Redstone::SIGNAL_NONE; } int ButtonTile::getDirectSignal(LevelSource *level, int x, int y, int z, int dir) { - int data = level->getData(x, y, z); - if ((data & 8) == 0) return Redstone::SIGNAL_NONE; - int myDir = data & 7; - - if (myDir == 5 && dir == 1) return Redstone::SIGNAL_MAX; - if (myDir == 4 && dir == 2) return Redstone::SIGNAL_MAX; - if (myDir == 3 && dir == 3) return Redstone::SIGNAL_MAX; - if (myDir == 2 && dir == 4) return Redstone::SIGNAL_MAX; - if (myDir == 1 && dir == 5) return Redstone::SIGNAL_MAX; - - return false; + int data = level->getData(x, y, z); + if ((data & 8) == 0) return Redstone::SIGNAL_NONE; + + + return Redstone::SIGNAL_MAX; } bool ButtonTile::isSignalSource() { - return true; + return true; } void ButtonTile::tick(Level *level, int x, int y, int z, Random *random) { - if (level->isClientSide) return; - int data = level->getData(x, y, z); - if ((data & 8) == 0) - { - return; - } - if(sensitive) - { - checkPressed(level, x, y, z); - } - else - { - level->setData(x, y, z, data & 7, Tile::UPDATE_ALL); + if (level->isClientSide) return; + int data = level->getData(x, y, z); + if ((data & 8) == 0) + { + return; + } + if(sensitive) + { + checkPressed(level, x, y, z); + } + else + { + level->setData(x, y, z, data & 7, Tile::UPDATE_ALL); - int dir = data & 7; - updateNeighbours(level, x, y, z, dir); + int dir = data & 7; + updateNeighbours(level, x, y, z, dir); - level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.5f); - level->setTilesDirty(x, y, z, x, y, z); - } + level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.5f); + level->setTilesDirty(x, y, z, x, y, z); + } } void ButtonTile::updateDefaultShape() { - float x = 3 / 16.0f; - float y = 2 / 16.0f; - float z = 2 / 16.0f; - setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z); + float x = 3 / 16.0f; + float y = 2 / 16.0f; + float z = 2 / 16.0f; + setShape(0.5f - x, 0.5f - y, 0.5f - z, 0.5f + x, 0.5f + y, 0.5f + z); } void ButtonTile::entityInside(Level *level, int x, int y, int z, shared_ptr entity) { - if (level->isClientSide) return; - if (!sensitive) return; + if (level->isClientSide) return; + if (!sensitive) return; - if ((level->getData(x, y, z) & 8) != 0) - { - return; - } + if ((level->getData(x, y, z) & 8) != 0) + { + return; + } - checkPressed(level, x, y, z); + checkPressed(level, x, y, z); } void ButtonTile::checkPressed(Level *level, int x, int y, int z) { - int data = level->getData(x, y, z); - int dir = data & 7; - bool wasPressed = (data & 8) != 0; - bool shouldBePressed; + int data = level->getData(x, y, z); + int dir = data & 7; + bool wasPressed = (data & 8) != 0; + bool shouldBePressed; - updateShape(data); - Tile::ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); - vector > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); - shouldBePressed = !entities->empty(); - delete entities; + updateShape(data); + Tile::ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); + vector > *entities = level->getEntitiesOfClass(typeid(Arrow), AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1)); + shouldBePressed = !entities->empty(); + delete entities; - if (shouldBePressed && !wasPressed) - { - level->setData(x, y, z, dir | 8, Tile::UPDATE_ALL); - updateNeighbours(level, x, y, z, dir); - level->setTilesDirty(x, y, z, x, y, z); + if (shouldBePressed && !wasPressed) + { + level->setData(x, y, z, dir | 8, Tile::UPDATE_ALL); + updateNeighbours(level, x, y, z, dir); + level->setTilesDirty(x, y, z, x, y, z); - level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f); - } - if (!shouldBePressed && wasPressed) - { - level->setData(x, y, z, dir, Tile::UPDATE_ALL); - updateNeighbours(level, x, y, z, dir); - level->setTilesDirty(x, y, z, x, y, z); + level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f); + } + if (!shouldBePressed && wasPressed) + { + level->setData(x, y, z, dir, Tile::UPDATE_ALL); + updateNeighbours(level, x, y, z, dir); + level->setTilesDirty(x, y, z, x, y, z); - level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.5f); - } + level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.5f); + } - if (shouldBePressed) - { - level->addToTickNextTick(x, y, z, id, getTickDelay(level)); - } + if (shouldBePressed) + { + level->addToTickNextTick(x, y, z, id, getTickDelay(level)); + } } void ButtonTile::updateNeighbours(Level *level, int x, int y, int z, int dir) { - level->updateNeighborsAt(x, y, z, id); + level->updateNeighborsAt(x, y, z, id); - if (dir == 1) - { - level->updateNeighborsAt(x - 1, y, z, id); - } - else if (dir == 2) - { - level->updateNeighborsAt(x + 1, y, z, id); - } - else if (dir == 3) - { - level->updateNeighborsAt(x, y, z - 1, id); - } - else if (dir == 4) - { - level->updateNeighborsAt(x, y, z + 1, id); - } - else - { - level->updateNeighborsAt(x, y - 1, z, id); - } + if (dir == 1) // Est + { + level->updateNeighborsAt(x - 1, y, z, id); + } + else if (dir == 2) // Ovest + { + level->updateNeighborsAt(x + 1, y, z, id); + } + else if (dir == 3) // Sud + { + level->updateNeighborsAt(x, y, z - 1, id); + } + else if (dir == 4) // Nord + { + level->updateNeighborsAt(x, y, z + 1, id); + } + else if (dir == 5) // Soffitto + { + level->updateNeighborsAt(x, y + 1, z, id); + + } + else if (dir == 6) // Pavimento + { + level->updateNeighborsAt(x, y - 1, z, id); + } } bool ButtonTile::shouldTileTick(Level *level, int x,int y,int z) { - int currentData = level->getData(x, y, z); - return (currentData & 8) != 0; + int currentData = level->getData(x, y, z); + return (currentData & 8) != 0; } void ButtonTile::registerIcons(IconRegister *iconRegister) { - // None -} + // None +} \ No newline at end of file diff --git a/Minecraft.World/Material.cpp b/Minecraft.World/Material.cpp index d17965df..ba9ee752 100644 --- a/Minecraft.World/Material.cpp +++ b/Minecraft.World/Material.cpp @@ -39,6 +39,7 @@ Material *Material::portal = nullptr; Material *Material::cake = nullptr; Material *Material::piston = nullptr; Material *Material::web = nullptr; +Material* Material::packedIce = nullptr; void Material::staticCtor() { @@ -76,6 +77,7 @@ void Material::staticCtor() // 4J added WebMaterial, Java version just does a local alteration when instantiating the Material for webs to get the same thing Material::web = (new WebMaterial(MaterialColor::cloth))->notAlwaysDestroyable()->destroyOnPush(); Material::piston = (new Material(MaterialColor::stone))->notPushable(); + Material::packedIce = (new Material(MaterialColor::ice))->neverBuildable(); } Material::Material(MaterialColor *color) diff --git a/Minecraft.World/Material.h b/Minecraft.World/Material.h index 6e0571cf..aa735a20 100644 --- a/Minecraft.World/Material.h +++ b/Minecraft.World/Material.h @@ -40,6 +40,7 @@ public: static Material *cake; static Material *web; static Material *piston; + static Material *packedIce; static const int PUSH_NORMAL = 0; static const int PUSH_DESTROY = 1; diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index c66f58b2..fcbdc8c1 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -2701,6 +2701,7 @@ + @@ -3633,6 +3634,7 @@ + diff --git a/Minecraft.World/MobSpawnerTileEntity.cpp b/Minecraft.World/MobSpawnerTileEntity.cpp index e3ee57d6..1db58f41 100644 --- a/Minecraft.World/MobSpawnerTileEntity.cpp +++ b/Minecraft.World/MobSpawnerTileEntity.cpp @@ -99,4 +99,27 @@ shared_ptr MobSpawnerTileEntity::clone() void MobSpawnerTileEntity::setEntityId(const wstring &id) { spawner->setEntityId(id); + + if (spawner != nullptr) + { + + spawner->spawnDelay = 20; + } + + if (level != nullptr) + { + level->sendTileUpdated(x, y, z); + } + +} + +void MobSpawnerTileEntity::setEntityIdFromEgg(const wstring &id) +{ + + spawner->setEntityId(id); + + + if (level != nullptr) { + level->sendTileUpdated(x, y, z); + } } \ No newline at end of file diff --git a/Minecraft.World/MobSpawnerTileEntity.h b/Minecraft.World/MobSpawnerTileEntity.h index b649702b..f1c16966 100644 --- a/Minecraft.World/MobSpawnerTileEntity.h +++ b/Minecraft.World/MobSpawnerTileEntity.h @@ -46,4 +46,5 @@ public: // 4J Added virtual shared_ptr clone(); void setEntityId(const wstring &id); + void setEntityIdFromEgg(const wstring &id); }; diff --git a/Minecraft.World/PackedIceTile.cpp b/Minecraft.World/PackedIceTile.cpp new file mode 100644 index 00000000..e2fadda5 --- /dev/null +++ b/Minecraft.World/PackedIceTile.cpp @@ -0,0 +1,12 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.h" +#include "net.minecraft.world.level.dimension.h" +#include "net.minecraft.world.item.enchantment.h" +#include "net.minecraft.world.food.h" +#include "net.minecraft.stats.h" +#include "PackedIceTile.h" + +PackedIceTile::PackedIceTile(int id) : Tile(id, Material::packedIce) +{ + friction = 0.98f; +} diff --git a/Minecraft.World/PackedIceTile.h b/Minecraft.World/PackedIceTile.h new file mode 100644 index 00000000..6a850dfd --- /dev/null +++ b/Minecraft.World/PackedIceTile.h @@ -0,0 +1,12 @@ +#pragma once +#include "Tile.h" + +class Random; + +class PackedIceTile : public Tile +{ +public: + PackedIceTile(int id); + virtual int getResource(int data, Random* random, int playerBonusLevel) { return 0; }; + virtual int getPistonPushReaction() { return Material::PUSH_NORMAL; }; +}; diff --git a/Minecraft.World/SpawnEggItem.cpp b/Minecraft.World/SpawnEggItem.cpp index 5124f668..da7c7ec7 100644 --- a/Minecraft.World/SpawnEggItem.cpp +++ b/Minecraft.World/SpawnEggItem.cpp @@ -193,20 +193,29 @@ bool SpawnEggItem::useOn(shared_ptr itemInstance, shared_ptrgetTile(x, y, z); -#ifndef _CONTENT_PACKAGE - if(app.DebugArtToolsOn() && tile == Tile::mobSpawner_Id) + if (tile == Tile::mobSpawner_Id) { - // 4J Stu - Force adding this as a tile update - level->removeTile(x,y,z); - level->setTileAndData(x,y,z,Tile::mobSpawner_Id, 0, Tile::UPDATE_ALL); - shared_ptr mste = dynamic_pointer_cast( level->getTileEntity(x,y,z) ); - if(mste != nullptr) + + shared_ptr spawnerTile = dynamic_pointer_cast(level->getTileEntity(x, y, z)); + + if (spawnerTile != nullptr) { - mste->setEntityId( EntityIO::getEncodeId(itemInstance->getAuxValue()) ); + + int mobId = itemInstance->getAuxValue() & 0xFFF; + spawnerTile->setEntityId(EntityIO::getEncodeId(mobId)); + + + + + + if (!player->abilities.instabuild && !bTestUseOnOnly) + { + itemInstance->count--; + } + return true; } } -#endif x += Facing::STEP_X[face]; y += Facing::STEP_Y[face]; diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index 3d49896a..2ba65277 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -251,6 +251,7 @@ Tile* Tile::stairs_red_sandstone = nullptr; Tile* Tile::seaLantern = nullptr; Tile* Tile::tree2Trunk = nullptr; +Tile* Tile::packed_ice = nullptr; DWORD Tile::tlsIdxShape = TlsAlloc(); @@ -478,6 +479,8 @@ void Tile::staticCtor() Tile::clayHardened = (new Tile(172, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_clay, Item::eMaterial_clay)->setDestroyTime(1.25f)->setExplodeable(7)->setSoundType(SOUND_STONE)->setIconName(L"hardened_clay")->setDescriptionId(IDS_TILE_HARDENED_CLAY)->setUseDescriptionId(IDS_DESC_HARDENED_CLAY); Tile::coalBlock = (new Tile(173, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_coal)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"coal_block")->setDescriptionId(IDS_TILE_COAL)->setUseDescriptionId(IDS_DESC_COAL_BLOCK); + Tile::packed_ice = (new PackedIceTile(174))->setDestroyTime(0.5f)->setSoundType(SOUND_GLASS)->setIconName(L"packed_ice")->setDescriptionId(IDS_TILE_ICE)->setUseDescriptionId(IDS_DESC_ICE); + Tile::invertedDaylightDetector = static_cast((new DaylightDetectorTile(178, true))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR)); Tile::red_sandstone = (new RedSandStoneTile(179))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_sand)->setSoundType(Tile::SOUND_STONE)->setDestroyTime(0.8f)->sendTileData()->setIconName(L"red_sandstone")->setDescriptionId(IDS_TILE_SANDSTONE)->setUseDescriptionId(IDS_DESC_SANDSTONE)->sendTileData(); Tile::stairs_red_sandstone = (new StairTile(180, Tile::red_sandstone, 0))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sand)->setIconName(L"stairsRedSandstone")->setDescriptionId(IDS_TILE_STAIRS_SANDSTONE)->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index 12e8ac10..6893406e 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -371,6 +371,7 @@ public: static const int woolCarpet_Id = 171; static const int clayHardened_Id = 172; static const int coalBlock_Id = 173; + static const int packed_ice_Id = 174; static const int invertedDaylightDetector_Id = 178; static const int red_sandstone_Id = 179; @@ -591,8 +592,8 @@ public: static Tile* red_sandstone; static Tile* stairs_red_sandstone; static Tile* tree2Trunk; + static Tile* packed_ice; static Tile* seaLantern; - static void staticCtor(); int id; diff --git a/Minecraft.World/net.minecraft.world.level.tile.h b/Minecraft.World/net.minecraft.world.level.tile.h index 0a398641..031d00df 100644 --- a/Minecraft.World/net.minecraft.world.level.tile.h +++ b/Minecraft.World/net.minecraft.world.level.tile.h @@ -134,3 +134,4 @@ #include "RedSandStoneTile.h" #include "TreeTile2.h" +#include "PackedIceTile.h" \ No newline at end of file