Files
MinecraftConsoles/Minecraft.World/PressurePlateTile.cpp
daoge b3feddfef3 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>
2026-03-03 03:04:10 +08:00

48 lines
1.5 KiB
C++

#include "stdafx.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.redstone.h"
#include "PressurePlateTile.h"
PressurePlateTile::PressurePlateTile(int id, const wstring &tex, Material *material, Sensitivity sensitivity) : BasePressurePlateTile(id, tex, material)
{
this->sensitivity = sensitivity;
// 4J Stu - Move this from base class to use virtual function
updateShape(getDataForSignal(Redstone::SIGNAL_MAX));
}
int PressurePlateTile::getDataForSignal(int signal)
{
return signal > 0 ? 1 : 0;
}
int PressurePlateTile::getSignalForData(int data)
{
return data == 1 ? Redstone::SIGNAL_MAX : 0;
}
int PressurePlateTile::getSignalStrength(Level *level, int x, int y, int z)
{
vector< shared_ptr<Entity> > *entities = NULL;
if (sensitivity == everything) entities = level->getEntities(nullptr, getSensitiveAABB(x, y, z));
else if (sensitivity == mobs) entities = level->getEntitiesOfClass(typeid(LivingEntity), getSensitiveAABB(x, y, z));
else if (sensitivity == players) entities = level->getEntitiesOfClass(typeid(Player), getSensitiveAABB(x, y, z));
else __debugbreak(); // 4J-JEV: We're going to delete something at a random location.
if (entities != NULL && !entities->empty())
{
for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
{
shared_ptr<Entity> e = *it;
if (!e->isIgnoringTileTriggers())
{
if (sensitivity != everything) delete entities;
return Redstone::SIGNAL_MAX;
}
}
}
if (sensitivity != everything) delete entities;
return Redstone::SIGNAL_NONE;
}