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:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "net.minecraft.world.entity.projectile.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.redstone.h"
#include "net.minecraft.world.phys.h"
#include "net.minecraft.h"
#include "ButtonTile.h"
@@ -15,7 +16,7 @@ ButtonTile::ButtonTile(int id, bool sensitive) : Tile(id, Material::decoration,i
Icon *ButtonTile::getTexture(int face, int data)
{
if(id == Tile::button_wood_Id) return Tile::wood->getTexture(Facing::UP);
else return Tile::rock->getTexture(Facing::UP);
else return Tile::stone->getTexture(Facing::UP);
}
AABB *ButtonTile::getAABB(Level *level, int x, int y, int z)
@@ -23,7 +24,7 @@ AABB *ButtonTile::getAABB(Level *level, int x, int y, int z)
return NULL;
}
int ButtonTile::getTickDelay()
int ButtonTile::getTickDelay(Level *level)
{
return sensitive ? 30 : 20;
}
@@ -45,100 +46,100 @@ bool ButtonTile::isCubeShaped()
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;
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;
}
bool ButtonTile::mayPlace(Level *level, int x, int y, int z)
{
if (level->isSolidBlockingTile(x - 1, y, z))
if (level->isSolidBlockingTile(x - 1, y, z))
{
return true;
}
return true;
}
else if (level->isSolidBlockingTile(x + 1, y, z))
{
return true;
}
return true;
}
else if (level->isSolidBlockingTile(x, y, z - 1))
{
return true;
}
return true;
}
else if (level->isSolidBlockingTile(x, y, z + 1))
{
return true;
}
return false;
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 dir = level->getData(x, y, z);
int oldFlip = dir & 8;
dir &= 7;
int oldFlip = dir & 8;
dir &= 7;
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);
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))
if (level->isSolidBlockingTile(x - 1, y, z))
{
return 1;
}
return 1;
}
else if (level->isSolidBlockingTile(x + 1, y, z))
{
return 2;
}
return 2;
}
else if (level->isSolidBlockingTile(x, y, z - 1))
{
return 3;
}
return 3;
}
else if (level->isSolidBlockingTile(x, y, z + 1))
{
return 4;
}
return 1;
return 4;
}
return 1;
}
void ButtonTile::neighborChanged(Level *level, int x, int y, int z, int type)
{
if (checkCanSurvive(level, x, y, z))
if (checkCanSurvive(level, x, y, z))
{
int dir = level->getData(x, y, z) & 7;
bool replace = false;
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 (!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 (replace)
if (replace)
{
this->spawnResources(level, x, y, z, level->getData(x, y, z), 0);
level->setTile(x, y, z, 0);
}
}
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))
if (!mayPlace(level, x, y, z))
{
this->spawnResources(level, x, y, z, level->getData(x, y, z), 0);
level->setTile(x, y, z, 0);
return false;
}
return true;
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<TileEntity> forceEntity) // 4J added forceData, forceEntity param
@@ -149,31 +150,31 @@ void ButtonTile::updateShape(LevelSource *level, int x, int y, int z, int forceD
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 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;
if (dir == 1)
if (dir == 1)
{
setShape(0, h0, 0.5f - r, d, h1, 0.5f + r);
}
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);
}
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);
}
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);
}
setShape(0.5f - r, h0, 1 - d, 0.5f + r, h1, 1);
}
}
void ButtonTile::attack(Level *level, int x, int y, int z, shared_ptr<Player> player)
@@ -189,57 +190,58 @@ bool ButtonTile::TestUse()
bool ButtonTile::use(Level *level, int x, int y, int z, shared_ptr<Player> player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param
{
if( soundOnly)
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;
}
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);
level->setTilesDirty(x, y, z, x, y, z);
int data = level->getData(x, y, z);
int dir = data & 7;
int open = 8 - (data & 8);
if (open == 0) return true;
level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f);
level->setData(x, y, z, dir + open, Tile::UPDATE_ALL);
level->setTilesDirty(x, y, z, x, y, z);
updateNeighbours(level, x, y, z, dir);
level->playSound(x + 0.5, y + 0.5, z + 0.5, eSoundType_RANDOM_CLICK, 0.3f, 0.6f);
level->addToTickNextTick(x, y, z, id, getTickDelay());
updateNeighbours(level, x, y, z, dir);
return true;
level->addToTickNextTick(x, y, z, id, getTickDelay(level));
return true;
}
void ButtonTile::onRemove(Level *level, int x, int y, int z, int id, int data)
{
if ((data & 8) > 0)
if ((data & 8) > 0)
{
int dir = data & 7;
updateNeighbours(level, x, y, z, dir);
}
Tile::onRemove(level, x, y, z, id, data);
int dir = data & 7;
updateNeighbours(level, x, y, z, dir);
}
Tile::onRemove(level, x, y, z, id, data);
}
bool ButtonTile::getSignal(LevelSource *level, int x, int y, int z, int dir)
int ButtonTile::getSignal(LevelSource *level, int x, int y, int z, int dir)
{
return (level->getData(x, y, z) & 8) > 0;
return (level->getData(x, y, z) & 8) > 0 ? Redstone::SIGNAL_MAX : Redstone::SIGNAL_NONE;
}
bool ButtonTile::getDirectSignal(Level *level, int x, int y, int z, int dir)
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 false;
int myDir = data & 7;
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 true;
if (myDir == 4 && dir == 2) return true;
if (myDir == 3 && dir == 3) return true;
if (myDir == 2 && dir == 4) return true;
if (myDir == 1 && dir == 5) return true;
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;
return false;
}
bool ButtonTile::isSignalSource()
@@ -261,7 +263,7 @@ void ButtonTile::tick(Level *level, int x, int y, int z, Random *random)
}
else
{
level->setData(x, y, z, data & 7);
level->setData(x, y, z, data & 7, Tile::UPDATE_ALL);
int dir = data & 7;
updateNeighbours(level, x, y, z, dir);
@@ -273,10 +275,10 @@ void ButtonTile::tick(Level *level, int x, int y, int z, Random *random)
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> entity)
@@ -307,7 +309,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z)
if (shouldBePressed && !wasPressed)
{
level->setData(x, y, z, dir | 8);
level->setData(x, y, z, dir | 8, Tile::UPDATE_ALL);
updateNeighbours(level, x, y, z, dir);
level->setTilesDirty(x, y, z, x, y, z);
@@ -315,7 +317,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z)
}
if (!shouldBePressed && wasPressed)
{
level->setData(x, y, z, dir);
level->setData(x, y, z, dir, Tile::UPDATE_ALL);
updateNeighbours(level, x, y, z, dir);
level->setTilesDirty(x, y, z, x, y, z);
@@ -324,7 +326,7 @@ void ButtonTile::checkPressed(Level *level, int x, int y, int z)
if (shouldBePressed)
{
level->addToTickNextTick(x, y, z, id, getTickDelay());
level->addToTickNextTick(x, y, z, id, getTickDelay(level));
}
}
@@ -357,7 +359,7 @@ void ButtonTile::updateNeighbours(Level *level, int x, int y, int z, int dir)
bool ButtonTile::shouldTileTick(Level *level, int x,int y,int z)
{
int currentData = level->getData(x, y, z);
return (currentData & 8) != 0;
return (currentData & 8) != 0;
}
void ButtonTile::registerIcons(IconRegister *iconRegister)