chore: port rest of magma block stuff
This commit is contained in:
@@ -72,6 +72,8 @@ public:
|
||||
e_ChatDeathFireballItem,
|
||||
e_ChatDeathThrownItem,
|
||||
e_ChatDeathIndirectMagicItem,
|
||||
e_ChatDeathHotFloor,
|
||||
e_ChatDeathHotFloorPlayer,
|
||||
|
||||
e_ChatPlayerEnteredEnd,
|
||||
e_ChatPlayerLeftEnd,
|
||||
|
||||
@@ -23,6 +23,7 @@ DamageSource *DamageSource::wither = (new DamageSource(ChatPacket::e_ChatDeathWi
|
||||
DamageSource *DamageSource::anvil = (new DamageSource(ChatPacket::e_ChatDeathAnvil));
|
||||
DamageSource *DamageSource::fallingBlock = (new DamageSource(ChatPacket::e_ChatDeathFallingBlock));
|
||||
DamageSource *DamageSource::flyIntoWall = new DamageSource(ChatPacket::e_ChatDeathFlyIntoWall);
|
||||
DamageSource *DamageSource::hotFloor = (new DamageSource(ChatPacket::e_ChatDeathHotFloor, ChatPacket::e_ChatDeathHotFloorPlayer))->setIsFire();
|
||||
|
||||
DamageSource *DamageSource::mobAttack(shared_ptr<LivingEntity> mob)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
static DamageSource *anvil;
|
||||
static DamageSource *fallingBlock;
|
||||
static DamageSource *flyIntoWall;
|
||||
static DamageSource *hotFloor;
|
||||
|
||||
static DamageSource *mobAttack(shared_ptr<LivingEntity> mob);
|
||||
static DamageSource *playerAttack(shared_ptr<Player> player);
|
||||
|
||||
@@ -487,7 +487,7 @@ void HellRandomLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
|
||||
FlowerFeature(Tile::mushroom_red_Id).place(level, pprandom, x, y, z);
|
||||
}
|
||||
|
||||
OreFeature magmaFeature(Tile::magma_Id, 0, 160, Tile::netherrack_Id);
|
||||
OreFeature magmaFeature(Tile::magma_block_Id, 0, 160, Tile::netherrack_Id);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int x = xo + pprandom->nextInt(16);
|
||||
|
||||
@@ -211,9 +211,9 @@ void LivingEntity::baseTick()
|
||||
if (!level->isClientSide && isAlive() && onGround && !isSneaking() && tickCount % 10 == 0)
|
||||
{
|
||||
int tileBelow = level->getTile(Mth::floor(x), Mth::floor(bb->y0) - 1, Mth::floor(z));
|
||||
if (tileBelow == Tile::magma_Id)
|
||||
if (tileBelow == Tile::magma_block_Id)
|
||||
{
|
||||
hurt(DamageSource::inFire, 1);
|
||||
hurt(DamageSource::hotFloor, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,50 @@
|
||||
#include "MagmaTile.h"
|
||||
|
||||
MagmaTile::MagmaTile(int id) : Tile(id, Material::stone)
|
||||
{
|
||||
{
|
||||
setLightEmission(0.2f);
|
||||
}
|
||||
|
||||
void MagmaTile::tick(Level *level, int x, int y, int z, Random *random)
|
||||
{
|
||||
int above = level->getTile(x, y + 1, z);
|
||||
if (above == Tile::water_Id || above == Tile::flowing_water_Id)
|
||||
{
|
||||
level->removeTile(x, y + 1, z);
|
||||
level->playSound(x + 0.5f, y + 0.5f, z + 0.5f, eSoundType_RANDOM_FIZZ, 0.5f, 2.6f + (random->nextFloat() - random->nextFloat()) * 0.8f);
|
||||
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
float rx = x + 0.5f + (random->nextFloat() - random->nextFloat()) * 0.5f;
|
||||
float ry = y + 0.25f + random->nextFloat() * 0.25f;
|
||||
float rz = z + 0.5f + (random->nextFloat() - random->nextFloat()) * 0.5f;
|
||||
level->addParticle(eParticleType_largesmoke, rx, ry, rz, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
level->addToTickNextTick(x, y, z, id, getTickDelay(level) + random->nextInt(10));
|
||||
}
|
||||
|
||||
void MagmaTile::animateTick(Level *level, int x, int y, int z, Random *random)
|
||||
{
|
||||
// rain -> smoke particles
|
||||
if (level->isRainingAt(x, y + 1, z))
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
float rx = x + random->nextFloat();
|
||||
float ry = y + 1.0f + random->nextFloat() * 0.5f;
|
||||
float rz = z + random->nextFloat();
|
||||
level->addParticle(eParticleType_largesmoke, rx, ry, rz, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int MagmaTile::getTickDelay(Level *level)
|
||||
{
|
||||
return 160;
|
||||
}
|
||||
|
||||
int MagmaTile::getLightColor(LevelSource *level, int x, int y, int z, int tileId)
|
||||
{
|
||||
return 0x0f000f0;
|
||||
}
|
||||
@@ -5,4 +5,9 @@ class MagmaTile : public Tile
|
||||
{
|
||||
public:
|
||||
MagmaTile(int id);
|
||||
virtual void tick(Level *level, int x, int y, int z, Random *random) override;
|
||||
|
||||
virtual void animateTick(Level *level, int x, int y, int z, Random *random) override;
|
||||
virtual int getTickDelay(Level *level) override;
|
||||
virtual int getLightColor(LevelSource *level, int x, int y, int z, int tileId = -1) override;
|
||||
};
|
||||
|
||||
@@ -592,7 +592,7 @@ void Tile::staticCtor()
|
||||
Tile::frosted_ice = static_cast<FrostedIceTile*>((new FrostedIceTile(frosted_ice_Id))->setDestroyTime(0.5f)->setLightBlock(3)->setSoundType(Tile::SOUND_GLASS)->setIconName(L"ice")->setDescriptionId(IDS_TILE_FROSTED_ICE)->setUseDescriptionId(IDS_DESC_ICE)->setNotCollectStatistics());
|
||||
|
||||
Tile::end_bricks = (new Tile(end_bricks_Id, Material::stone))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(3.0f)->setExplodeable(9)->setSoundType(SOUND_STONE)->setIconName(L"end_bricks")->setDescriptionId(IDS_TILE_END_BRICKS)->setUseDescriptionId(IDS_DESC_STONE);
|
||||
Tile::magma = static_cast<MagmaTile*>((new MagmaTile(magma_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_stone)->setDestroyTime(0.5f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"magma")->setDescriptionId(IDS_TILE_MAGMA)->setUseDescriptionId(IDS_DESC_MAGMA));
|
||||
Tile::magma = static_cast<MagmaTile*>((new MagmaTile(magma_block_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_stone)->setDestroyTime(0.5f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"magma")->setDescriptionId(IDS_TILE_MAGMA)->setUseDescriptionId(IDS_DESC_MAGMA));
|
||||
Tile::nether_wart_block = (new Tile(nether_wart_block_Id, Material::grass))->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_wheat)->setDestroyTime(0.5f)->setSoundType(SOUND_WOOD)->setIconName(L"nether_wart_block")->setDescriptionId(IDS_TILE_NETHER_WART_BLOCK)->setUseDescriptionId(IDS_DESC_NETHER_WART_BLOCK);
|
||||
Tile::red_nether_brick = (new Tile(red_nether_brick_Id, Material::stone))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(2.0f)->setExplodeable(6)->setSoundType(SOUND_STONE)->setIconName(L"red_nether_brick")->setDescriptionId(IDS_TILE_RED_NETHER_BRICK)->setUseDescriptionId(IDS_DESC_RED_NETHER_BRICK);
|
||||
Tile::bone_block = static_cast<BoneBlockTile*>((new BoneBlockTile(bone_block_Id))->setBaseItemTypeAndMaterial(Item::eBaseItemType_structblock, Item::eMaterial_stone)->setDestroyTime(1.5f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"bone_block_side")->setDescriptionId(IDS_TILE_BONE_BLOCK)->setUseDescriptionId(IDS_DESC_BONE_BLOCK)->sendTileData());
|
||||
@@ -1934,7 +1934,7 @@ const int Tile::slime_Id;
|
||||
const int Tile::beetroots_Id;
|
||||
const int Tile::grass_path_Id;
|
||||
const int Tile::end_bricks_Id;
|
||||
const int Tile::magma_Id;
|
||||
const int Tile::magma_block_Id;
|
||||
const int Tile::nether_wart_block_Id;
|
||||
const int Tile::red_nether_brick_Id;
|
||||
const int Tile::bone_block_Id;
|
||||
|
||||
@@ -451,7 +451,7 @@ public:
|
||||
static const int grass_path_Id = 208;
|
||||
//end_gateway 209
|
||||
static const int frosted_ice_Id = 212;
|
||||
static const int magma_Id = 213;
|
||||
static const int magma_block_Id = 213;
|
||||
static const int nether_wart_block_Id = 214;
|
||||
static const int red_nether_brick_Id = 215;
|
||||
static const int bone_block_Id = 216;
|
||||
|
||||
Reference in New Issue
Block a user