feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a4399472.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
@@ -4,8 +4,28 @@
|
||||
#include "net.minecraft.world.level.tile.h"
|
||||
#include "net.minecraft.world.level.tile.entity.h"
|
||||
#include "net.minecraft.world.item.h"
|
||||
#include "WeighedTreasure.h"
|
||||
#include "MonsterRoomFeature.h"
|
||||
|
||||
WeighedTreasure *MonsterRoomFeature::monsterRoomTreasure[MonsterRoomFeature::TREASURE_ITEMS_COUNT] =
|
||||
{
|
||||
new WeighedTreasure(Item::saddle_Id, 0, 1, 1, 10),
|
||||
new WeighedTreasure(Item::ironIngot_Id, 0, 1, 4, 10),
|
||||
new WeighedTreasure(Item::bread_Id, 0, 1, 1, 10),
|
||||
new WeighedTreasure(Item::wheat_Id, 0, 1, 4, 10),
|
||||
new WeighedTreasure(Item::gunpowder_Id, 0, 1, 4, 10),
|
||||
new WeighedTreasure(Item::string_Id, 0, 1, 4, 10),
|
||||
new WeighedTreasure(Item::bucket_empty_Id, 0, 1, 1, 10),
|
||||
new WeighedTreasure(Item::apple_gold_Id, 0, 1, 1, 1),
|
||||
new WeighedTreasure(Item::redStone_Id, 0, 1, 4, 10),
|
||||
new WeighedTreasure(Item::record_01_Id, 0, 1, 1, 10),
|
||||
new WeighedTreasure(Item::record_02_Id, 0, 1, 1, 10),
|
||||
new WeighedTreasure(Item::nameTag_Id, 0, 1, 1, 10),
|
||||
new WeighedTreasure(Item::horseArmorGold_Id, 0, 1, 1, 2),
|
||||
new WeighedTreasure(Item::horseArmorMetal_Id, 0, 1, 1, 5),
|
||||
new WeighedTreasure(Item::horseArmorDiamond_Id, 0, 1, 1, 1),
|
||||
};
|
||||
|
||||
bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
{
|
||||
int hr = 3;
|
||||
@@ -48,19 +68,22 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z
|
||||
{
|
||||
if (yy >= 0 && !level->getMaterial(xx, yy - 1, zz)->isSolid())
|
||||
{
|
||||
level->setTile(xx, yy, zz, 0);
|
||||
} else if (level->getMaterial(xx, yy, zz)->isSolid())
|
||||
level->removeTile(xx, yy, zz);
|
||||
}
|
||||
else if (level->getMaterial(xx, yy, zz)->isSolid())
|
||||
{
|
||||
if (yy == y - 1 && random->nextInt(4) != 0)
|
||||
{
|
||||
level->setTile(xx, yy, zz, Tile::mossStone_Id);
|
||||
} else {
|
||||
level->setTile(xx, yy, zz, Tile::stoneBrick_Id);
|
||||
level->setTileAndData(xx, yy, zz, Tile::mossyCobblestone_Id, 0, Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
else
|
||||
{
|
||||
level->setTileAndData(xx, yy, zz, Tile::cobblestone_Id, 0, Tile::UPDATE_CLIENTS);
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
level->setTile(xx, yy, zz, 0);
|
||||
level->removeTile(xx, yy, zz);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,15 +106,13 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z
|
||||
|
||||
if (count != 1) continue;
|
||||
|
||||
level->setTile(xc, yc, zc, Tile::chest_Id);
|
||||
level->setTileAndData(xc, yc, zc, Tile::chest_Id, 0, Tile::UPDATE_CLIENTS);
|
||||
WeighedTreasureArray wrapperArray(monsterRoomTreasure, TREASURE_ITEMS_COUNT);
|
||||
WeighedTreasureArray treasure = WeighedTreasure::addToTreasure(wrapperArray, Item::enchantedBook->createForRandomTreasure(random));
|
||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity >( level->getTileEntity(xc, yc, zc) );
|
||||
if (chest != NULL )
|
||||
{
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
shared_ptr<ItemInstance> item = randomItem(random);
|
||||
if (item != NULL) chest->setItem(random->nextInt(chest->getContainerSize()), item);
|
||||
}
|
||||
WeighedTreasure::addChestItems(random, treasure, chest, 8);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -99,36 +120,17 @@ bool MonsterRoomFeature::place(Level *level, Random *random, int x, int y, int z
|
||||
}
|
||||
|
||||
|
||||
level->setTile(x, y, z, Tile::mobSpawner_Id);
|
||||
level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS);
|
||||
shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>( level->getTileEntity(x, y, z) );
|
||||
if( entity != NULL )
|
||||
{
|
||||
entity->setEntityId(randomEntityId(random));
|
||||
entity->getSpawner()->setEntityId(randomEntityId(random));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> MonsterRoomFeature::randomItem(Random *random)
|
||||
{
|
||||
int type = random->nextInt(12);
|
||||
if (type == 0) return shared_ptr<ItemInstance>( new ItemInstance(Item::saddle) );
|
||||
if (type == 1) return shared_ptr<ItemInstance>( new ItemInstance(Item::ironIngot, random->nextInt(4) + 1) );
|
||||
if (type == 2) return shared_ptr<ItemInstance>( new ItemInstance(Item::bread) );
|
||||
if (type == 3) return shared_ptr<ItemInstance>( new ItemInstance(Item::wheat, random->nextInt(4) + 1) );
|
||||
if (type == 4) return shared_ptr<ItemInstance>( new ItemInstance(Item::sulphur, random->nextInt(4) + 1) );
|
||||
if (type == 5) return shared_ptr<ItemInstance>( new ItemInstance(Item::string, random->nextInt(4) + 1) );
|
||||
if (type == 6) return shared_ptr<ItemInstance>( new ItemInstance(Item::bucket_empty) );
|
||||
if (type == 7 && random->nextInt(100) == 0) return shared_ptr<ItemInstance>( new ItemInstance(Item::apple_gold) );
|
||||
if (type == 8 && random->nextInt(2) == 0) return shared_ptr<ItemInstance>( new ItemInstance(Item::redStone, random->nextInt(4) + 1) );
|
||||
if (type == 9 && random->nextInt(10) == 0) return shared_ptr<ItemInstance>( new ItemInstance( Item::items[Item::record_01->id + random->nextInt(2)]) );
|
||||
if (type == 10) return shared_ptr<ItemInstance>( new ItemInstance(Item::dye_powder, 1, DyePowderItem::BROWN) );
|
||||
if (type == 11) return Item::enchantedBook->createForRandomLoot(random);
|
||||
|
||||
return shared_ptr<ItemInstance>();
|
||||
}
|
||||
|
||||
wstring MonsterRoomFeature::randomEntityId(Random *random)
|
||||
{
|
||||
int id = random->nextInt(4);
|
||||
|
||||
Reference in New Issue
Block a user