This commit is contained in:
GabsPuNs
2026-05-14 21:52:21 -04:00
parent 1b2f5c6fe8
commit f8a2d644f5
291 changed files with 7363 additions and 18368 deletions

View File

@@ -5,14 +5,12 @@
#include "net.minecraft.world.level.redstone.h"
#include "net.minecraft.world.level.tile.entity.h"
#include "net.minecraft.world.h"
#include "net.minecraft.world.item.h"
#include "JavaMath.h"
#include "DaylightDetectorTile.h"
DaylightDetectorTile::DaylightDetectorTile(int id, bool inverted) : BaseEntityTile(id, Material::wood, isSolidRender() )
DaylightDetectorTile::DaylightDetectorTile(int id) : BaseEntityTile(id, Material::wood, isSolidRender() )
{
updateDefaultShape();
this->inverted = inverted;
}
void DaylightDetectorTile::updateDefaultShape()
@@ -73,10 +71,6 @@ void DaylightDetectorTile::updateSignalStrength(Level *level, int x, int y, int
{
target = Redstone::SIGNAL_MAX;
}
if (inverted)
{
target = Redstone::SIGNAL_MAX - target;
}
if (current != target)
{
@@ -108,46 +102,13 @@ Icon *DaylightDetectorTile::getTexture(int face, int data)
{
if (face == Facing::UP)
{
if (inverted)
{
return icons[1];
}
return icons[0];
}
return icons[2];
return icons[1];
}
void DaylightDetectorTile::registerIcons(IconRegister *iconRegister)
{
icons[0] = iconRegister->registerIcon(getIconName() + L"_top");
icons[1] = iconRegister->registerIcon(getIconName() + L"_inverted_top");
icons[2] = iconRegister->registerIcon(getIconName() + L"_side");
}
bool DaylightDetectorTile::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 (player->mayBuild())
{
if (!level->isClientSide)
{
int data = level->getData(x, y, z);
if (inverted)
level->setTileAndData(x, y, z, Tile::daylightDetector_Id, data, Tile::UPDATE_INVISIBLE);
else
level->setTileAndData(x, y, z, Tile::daylightDetectorInverted_Id, data, Tile::UPDATE_INVISIBLE);
updateSignalStrength(level, x, y, z);
}
return true;
}
else
{
return Tile::use(level, x, y, z, player, clickedFace, clickX, clickY, clickZ, soundOnly);
}
}
int DaylightDetectorTile::getResource(int data, Random *random, int playerBonusLevel)
{
return Tile::daylightDetector_Id;
icons[1] = iconRegister->registerIcon(getIconName() + L"_side");
}