diff --git a/Minecraft.Client/Common/Media/Graphics/Panorama_Background_N.png b/Minecraft.Client/Common/Media/Graphics/Panorama_Background_N.png index 2acd010d..37153cae 100644 Binary files a/Minecraft.Client/Common/Media/Graphics/Panorama_Background_N.png and b/Minecraft.Client/Common/Media/Graphics/Panorama_Background_N.png differ diff --git a/Minecraft.Client/Common/Media/Graphics/Panorama_Background_S.png b/Minecraft.Client/Common/Media/Graphics/Panorama_Background_S.png index 6bbe3dee..f374d82a 100644 Binary files a/Minecraft.Client/Common/Media/Graphics/Panorama_Background_S.png and b/Minecraft.Client/Common/Media/Graphics/Panorama_Background_S.png differ diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 914041c0..aac10048 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -37,6 +37,10 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::sandStone_Id) ITEM_AUX(Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE) ITEM_AUX(Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS) + ITEM_AUX(Tile::sand_Id, SandTile::RED_SAND) + ITEM(Tile::red_sandstone_Id) + ITEM_AUX(Tile::red_sandstone_Id, RedSandStoneTile::TYPE_SMOOTHSIDE) + ITEM_AUX(Tile::red_sandstone_Id, RedSandStoneTile::TYPE_HEIROGLYPHS) ITEM_AUX(Tile::stone_Id, StoneTile::GRANITE) ITEM_AUX(Tile::stone_Id, StoneTile::POLISHED_GRANITE) ITEM_AUX(Tile::stone_Id, StoneTile::ANDESITE) @@ -160,6 +164,7 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::stairs_stoneBrick_Id) ITEM(Tile::stairs_netherBricks_Id) ITEM(Tile::stairs_sandstone_Id) + ITEM(Tile::stairs_red_sandstone) ITEM(Tile::stairs_quartz_Id) ITEM(Tile::clayHardened_Id) diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index 16292a96..ddc66fac 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -996,12 +996,16 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(20, 9, L"log_acacia_top"); ADD_ICON(20, 10, L"planks_acacia"); ADD_ICON(20, 14, L"red_sand"); + ADD_ICON(20, 15, L"red_sandstone_top"); + + ADD_ICON(21, 5, L"flower_tulip_pink"); ADD_ICON(21, 8, L"log_dark"); ADD_ICON(21, 9, L"log_dark_top"); ADD_ICON(21, 10, L"planks_dark"); - ADD_ICON(21, 5, L"flower_tulip_pink"); + ADD_ICON(21, 14, L"red_sandstone_bottom"); + ADD_ICON(21, 15, L"red_sandstone_normal"); ADD_ICON(22, 0, L"flower_allium"); ADD_ICON(22, 1, L"flower_blue_orchid"); @@ -1013,6 +1017,9 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(22, 8, L"coarse_dirt"); ADD_ICON(22, 9, L"dirt_podzol_side"); ADD_ICON(22, 10, L"dirt_podzol_top"); + + ADD_ICON(22, 14, L"red_sandstone_carved"); + ADD_ICON(22, 15, L"red_sandstone_smooth"); ADD_ICON(23, 0, L"door_acacia_upper"); diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index e499c966..dfe4d035 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -2706,9 +2706,11 @@ + + @@ -3632,11 +3634,13 @@ + + diff --git a/Minecraft.World/RedSandStoneTile.cpp b/Minecraft.World/RedSandStoneTile.cpp new file mode 100644 index 00000000..1f1417cf --- /dev/null +++ b/Minecraft.World/RedSandStoneTile.cpp @@ -0,0 +1,52 @@ +#include "stdafx.h" +#include "net.minecraft.h" +#include "net.minecraft.world.level.material.h" +#include "net.minecraft.world.h" +#include "RedSandStoneTile.h" + +const wstring RedSandStoneTile::TEXTURE_TOP = L"red_sandstone_top"; +const wstring RedSandStoneTile::TEXTURE_BOTTOM = L"red_sandstone_bottom"; +const wstring RedSandStoneTile::TEXTURE_NAMES[] = { L"red_sandstone_normal", L"red_sandstone_carved", L"red_sandstone_smooth" }; + +int RedSandStoneTile::SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES] = { + IDS_TILE_SANDSTONE, IDS_TILE_SANDSTONE_CHISELED, IDS_TILE_SANDSTONE_SMOOTH +}; + +RedSandStoneTile::RedSandStoneTile(int id) : Tile(id, Material::stone) +{ + icons = nullptr; + iconTop = nullptr; + iconBottom = nullptr; +} + +Icon* RedSandStoneTile::getTexture(int face, int data) +{ + if (face == Facing::UP || (face == Facing::DOWN && (data == TYPE_HEIROGLYPHS || data == TYPE_SMOOTHSIDE))) + { + return iconTop; + } + if (face == Facing::DOWN) + { + return iconBottom; + } + if (data < 0 || data >= SANDSTONE_TILE_TEXTURE_COUNT) data = 0; + return icons[data]; +} + +int RedSandStoneTile::getSpawnResourcesAuxValue(int data) +{ + return data; +} + +void RedSandStoneTile::registerIcons(IconRegister* iconRegister) +{ + icons = new Icon * [SANDSTONE_TILE_TEXTURE_COUNT]; + + for (int i = 0; i < SANDSTONE_TILE_TEXTURE_COUNT; i++) + { + icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]); + } + + iconTop = iconRegister->registerIcon(TEXTURE_TOP); + iconBottom = iconRegister->registerIcon(TEXTURE_BOTTOM); +} \ No newline at end of file diff --git a/Minecraft.World/RedSandStoneTile.h b/Minecraft.World/RedSandStoneTile.h new file mode 100644 index 00000000..5cac7963 --- /dev/null +++ b/Minecraft.World/RedSandStoneTile.h @@ -0,0 +1,38 @@ +#pragma once +using namespace std; + +#include "Tile.h" + +class ChunkRebuildData; + +class RedSandStoneTile : public Tile +{ + friend class ChunkRebuildData; +public: + static const int TYPE_DEFAULT = 0; + static const int TYPE_HEIROGLYPHS = 1; + static const int TYPE_SMOOTHSIDE = 2; + + // Add this in when we need it + //static final String[] SANDSTONE_NAMES = {"default", "chiseled", "smooth"}; + + static const int SANDSTONE_BLOCK_NAMES = 3; + static int SANDSTONE_NAMES[SANDSTONE_BLOCK_NAMES]; + +private: + static const wstring TEXTURE_TOP; + static const wstring TEXTURE_BOTTOM; + static const wstring TEXTURE_NAMES[]; + static const int SANDSTONE_TILE_TEXTURE_COUNT = 3; + + Icon** icons; + Icon* iconTop; + Icon* iconBottom; +public: + RedSandStoneTile(int id); + +public: + Icon* getTexture(int face, int data); + virtual int getSpawnResourcesAuxValue(int data); + void registerIcons(IconRegister* iconRegister); +}; \ No newline at end of file diff --git a/Minecraft.World/SandTile.cpp b/Minecraft.World/SandTile.cpp new file mode 100644 index 00000000..b6ec68f8 --- /dev/null +++ b/Minecraft.World/SandTile.cpp @@ -0,0 +1,122 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.h" +#include "net.minecraft.world.entity.item.h" +#include "SandTile.h" +#include "FireTile.h" +#include "net.minecraft.world.h" + +const unsigned int SandTile::SAND_NAMES[SAND_NAMES_LENGTH] = { IDS_TILE_STONE, +IDS_TILE_SAND}; + +const wstring SandTile::TEXTURE_NAMES[] = { L"sand", + L"red_sand" }; + +bool SandTile::instaFall = false; + +SandTile::SandTile(int type, bool isSolidRender) : Tile(type, Material::sand, isSolidRender) +{ + icons = nullptr; +} + +int SandTile::getSpawnResourcesAuxValue(int data) +{ + if (data < 0 || data >= SAND_NAMES_LENGTH) data = 0; + + return data; +} + +void SandTile::onPlace(Level* level, int x, int y, int z) +{ + level->addToTickNextTick(x, y, z, id, getTickDelay(level)); +} + +void SandTile::neighborChanged(Level* level, int x, int y, int z, int type) +{ + level->addToTickNextTick(x, y, z, id, getTickDelay(level)); +} + +void SandTile::tick(Level* level, int x, int y, int z, Random* random) +{ + if (!level->isClientSide) + { + checkSlide(level, x, y, z); + } +} + +void SandTile::checkSlide(Level* level, int x, int y, int z) +{ + int x2 = x; + int y2 = y; + int z2 = z; + if (isFree(level, x2, y2 - 1, z2) && y2 >= 0) + { + int r = 32; + + if (instaFall || !level->hasChunksAt(x - r, y - r, z - r, x + r, y + r, z + r)) + { + level->removeTile(x, y, z); + while (isFree(level, x, y - 1, z) && y > 0) + y--; + if (y > 0) + { + level->setTileAndUpdate(x, y, z, id); + } + } + else if (!level->isClientSide) + { + // 4J added - don't do anything just now if we can't create any new falling tiles + if (!level->newFallingTileAllowed()) + { + level->addToTickNextTick(x, y, z, id, getTickDelay(level)); + return; + } + + shared_ptr e = std::make_shared(level, x + 0.5f, y + 0.5f, z + 0.5f, id, level->getData(x, y, z)); + falling(e); + level->addEntity(e); + } + } +} + +void SandTile::falling(shared_ptr entity) +{ +} + +int SandTile::getTickDelay(Level* level) +{ + return 2; +} + +bool SandTile::isFree(Level* level, int x, int y, int z) +{ + int t = level->getTile(x, y, z); + if (t == 0) return true; + if (t == Tile::fire_Id) return true; + Material* material = Tile::tiles[t]->material; + if (material == Material::water) return true; + if (material == Material::lava) return true; + return false; +} + +void SandTile::onLand(Level* level, int xt, int yt, int zt, int data) +{ +} + +Icon* SandTile::getTexture(int face, int data) +{ + if (data < 0 || data >= SAND_NAMES_LENGTH) + { + data = 0; + } + return icons[data]; +} + +void SandTile::registerIcons(IconRegister* iconRegister) +{ + icons = new Icon * [SAND_NAMES_LENGTH]; + + for (int i = 0; i < SAND_NAMES_LENGTH; i++) + { + icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]); + } +} \ No newline at end of file diff --git a/Minecraft.World/SandTile.h b/Minecraft.World/SandTile.h new file mode 100644 index 00000000..bb81fb91 --- /dev/null +++ b/Minecraft.World/SandTile.h @@ -0,0 +1,36 @@ +#pragma once +#include "Tile.h" + +class Random; +class Level; +class FallingTile; + +class SandTile : public Tile +{ +public: + static bool instaFall; + + static const int RED_SAND = 1; + + static const int SAND_NAMES_LENGTH = 2; + + static const unsigned int SAND_NAMES[SAND_NAMES_LENGTH]; + static const wstring TEXTURE_NAMES[]; + + SandTile(int type, bool isSolidRender = true); + virtual void onPlace(Level* level, int x, int y, int z); + virtual void neighborChanged(Level* level, int x, int y, int z, int type); + virtual void tick(Level* level, int x, int y, int z, Random* random); +private: + Icon** icons; + void checkSlide(Level* level, int x, int y, int z); +protected: + virtual void falling(shared_ptr entity); +public: + virtual int getTickDelay(Level* level); + static bool isFree(Level* level, int x, int y, int z); + virtual int getSpawnResourcesAuxValue(int data); + virtual void onLand(Level* level, int xt, int yt, int zt, int data); + virtual Icon* getTexture(int face, int data); + void registerIcons(IconRegister* iconRegister); +}; diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index c11ed2fc..f475d8db 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -244,6 +244,9 @@ Tile* Tile::acaciaGate = nullptr; Tile* Tile::darkGate = nullptr; Tile* Tile::invertedDaylightDetector = nullptr; +Tile* Tile::red_sandstone = nullptr; +Tile* Tile::stairs_red_sandstone = nullptr; + DWORD Tile::tlsIdxShape = TlsAlloc(); @@ -295,7 +298,7 @@ void Tile::staticCtor() Tile::lava = static_cast((new LiquidTileDynamic(10, Material::lava))->setDestroyTime(00.0f)->setLightEmission(1.0f)->setLightBlock(255)->setIconName(L"lava_flow")->setDescriptionId(IDS_TILE_LAVA)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_LAVA)); Tile::calmLava = (new LiquidTileStatic(11, Material::lava)) ->setDestroyTime(100.0f)->setLightEmission(1.0f)->setLightBlock(255)->setIconName(L"lava_still")->setDescriptionId(IDS_TILE_LAVA)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_LAVA); - Tile::sand = (new HeavyTile(12)) ->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_SAND)->setIconName(L"sand")->setDescriptionId(IDS_TILE_SAND)->setUseDescriptionId(IDS_DESC_SAND); + Tile::sand = (new SandTile(12)) ->setDestroyTime(0.5f)->setSoundType(Tile::SOUND_SAND)->setIconName(L"sand")->setDescriptionId(IDS_TILE_SAND)->setUseDescriptionId(IDS_DESC_SAND); Tile::gravel = (new GravelTile(13)) ->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRAVEL)->setIconName(L"gravel")->setDescriptionId(IDS_TILE_GRAVEL)->setUseDescriptionId(IDS_DESC_GRAVEL); Tile::goldOre = (new OreTile(14)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"gold_ore")->setDescriptionId(IDS_TILE_ORE_GOLD)->setUseDescriptionId(IDS_DESC_ORE_GOLD); Tile::ironOre = (new OreTile(15)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"iron_ore")->setDescriptionId(IDS_TILE_ORE_IRON)->setUseDescriptionId(IDS_DESC_ORE_IRON); @@ -472,6 +475,8 @@ void Tile::staticCtor() 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::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); Tile::spruceGate = (new FenceGateTile(183))->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_spruce")->setDescriptionId(IDS_TILE_SPRUCE_GATE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); Tile::birchGate = (new FenceGateTile(184))->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"planks_birch")->setDescriptionId(IDS_TILE_BIRCH_GATE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); @@ -522,6 +527,8 @@ void Tile::staticCtor() Item::items[dirt_Id] = (new MultiTextureTileItem(Tile::dirt_Id - 256, dirt, (int*)DirtTile::DIRT_NAMES, 3))->setIconName(L"dirt")->setDescriptionId(IDS_TILE_DIRT)->setUseDescriptionId(IDS_DESC_DIRT); Item::items[stone_Id] = (new MultiTextureTileItem(Tile::stone_Id - 256, dirt, (int*)StoneTile::STONE_NAMES, 3))->setIconName(L"stone")->setDescriptionId(IDS_TILE_STONE)->setUseDescriptionId(IDS_DESC_STONE); Item::items[rose_Id] = (new MultiTextureTileItem(Tile::rose_Id - 256, rose, (int*)Rose::FLOWER_NAMES, Rose::FLOWER_NAMES_LENGTH))->setIconName(L"flower_rose")->setDescriptionId(IDS_TILE_ROSE)->setUseDescriptionId(IDS_DESC_FLOWER); + Item::items[sand_Id] = (new MultiTextureTileItem(Tile::sand_Id - 256, sand, (int*)SandTile::SAND_NAMES, SandTile::SAND_NAMES_LENGTH))->setIconName(L"sand")->setDescriptionId(IDS_TILE_SAND)->setUseDescriptionId(IDS_DESC_SAND); + Item::items[red_sandstone_Id] = (new MultiTextureTileItem(Tile::red_sandstone_Id - 256, red_sandstone, (int*)RedSandStoneTile::SANDSTONE_NAMES, RedSandStoneTile::SANDSTONE_BLOCK_NAMES))->setIconName(L"red_sandstone")->setDescriptionId(IDS_TILE_SANDSTONE)->setUseDescriptionId(IDS_DESC_SANDSTONE); for (int i = 0; i < 256; i++) { diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index 3ce8458c..47943057 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -371,7 +371,8 @@ public: static const int coalBlock_Id = 173; static const int invertedDaylightDetector_Id = 178; - + static const int red_sandstone_Id = 179; + static const int stairs_red_sandstone_Id = 180; static const int spruceGate_Id = 183; static const int birchGate_Id = 184; @@ -584,7 +585,8 @@ public: static Tile* darkGate; static Tile* invertedDaylightDetector; - + static Tile* red_sandstone; + static Tile* stairs_red_sandstone; 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 565f39be..35af92df 100644 --- a/Minecraft.World/net.minecraft.world.level.tile.h +++ b/Minecraft.World/net.minecraft.world.level.tile.h @@ -130,5 +130,6 @@ #include "WoodSlabTile.h" #include "WoolCarpetTile.h" #include "Rose.h" - +#include "SandTile.h" +#include "RedSandStoneTile.h"