mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +00:00
Merge pull request #311 from Merc6/refactor/remove-BasicTypeContainers
refactor: remove basic type containers
This commit is contained in:
commit
c18e86944f
|
|
@ -1,5 +1,7 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "ClientConnection.h"
|
#include "ClientConnection.h"
|
||||||
|
#include <cfloat>
|
||||||
|
#include <limits>
|
||||||
#include "../Level/MultiPlayerLevel.h"
|
#include "../Level/MultiPlayerLevel.h"
|
||||||
#include "../Player/MultiPlayerLocalPlayer.h"
|
#include "../Player/MultiPlayerLocalPlayer.h"
|
||||||
#include "../GameState/StatsCounter.h"
|
#include "../GameState/StatsCounter.h"
|
||||||
|
|
@ -43,7 +45,6 @@
|
||||||
#include "../MinecraftServer.h"
|
#include "../MinecraftServer.h"
|
||||||
#include "../ClientConstants.h"
|
#include "../ClientConstants.h"
|
||||||
#include "../../Minecraft.World/Util/SoundTypes.h"
|
#include "../../Minecraft.World/Util/SoundTypes.h"
|
||||||
#include "../../Minecraft.World/Util/BasicTypeContainers.h"
|
|
||||||
#include "../Textures/Packs/TexturePackRepository.h"
|
#include "../Textures/Packs/TexturePackRepository.h"
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
#include "../Platform/Common/XUI/XUI_Scene_Trading.h"
|
#include "../Platform/Common/XUI/XUI_Scene_Trading.h"
|
||||||
|
|
@ -2171,12 +2172,11 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet) {
|
||||||
// Check this friend against each player, if we find them we
|
// Check this friend against each player, if we find them we
|
||||||
// have at least one friend
|
// have at least one friend
|
||||||
for (int j = 0; j < g_NetworkManager.GetPlayerCount(); j++) {
|
for (int j = 0; j < g_NetworkManager.GetPlayerCount(); j++) {
|
||||||
Platform::String ^ xboxUserId =
|
Platform::String ^ xboxUserId = ref new Platform::String(
|
||||||
ref new Platform::String(
|
g_NetworkManager.GetPlayerByIndex(j)
|
||||||
g_NetworkManager.GetPlayerByIndex(j)
|
->GetUID()
|
||||||
->GetUID()
|
.toString()
|
||||||
.toString()
|
.data());
|
||||||
.data());
|
|
||||||
if (friendsXuid == xboxUserId) {
|
if (friendsXuid == xboxUserId) {
|
||||||
isAtLeastOneFriend = true;
|
isAtLeastOneFriend = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -2279,8 +2279,8 @@ void ClientConnection::handlePreLogin(std::shared_ptr<PreLoginPacket> packet) {
|
||||||
// down, because they are trying to lock the incoming critsec when
|
// down, because they are trying to lock the incoming critsec when
|
||||||
// it's already locked by this thread
|
// it's already locked by this thread
|
||||||
// Minecraft::GetInstance()->connectionDisconnected(
|
// Minecraft::GetInstance()->connectionDisconnected(
|
||||||
// m_userIndex , reason ); done = true; connection->flush();
|
// m_userIndex , reason ); done = true;
|
||||||
// connection->close(reason);
|
// connection->flush(); connection->close(reason);
|
||||||
// app.SetAction(m_userIndex,eAppAction_ExitPlayer);
|
// app.SetAction(m_userIndex,eAppAction_ExitPlayer);
|
||||||
|
|
||||||
// 4J-PB - doing this instead
|
// 4J-PB - doing this instead
|
||||||
|
|
@ -4050,7 +4050,8 @@ void ClientConnection::handleUpdateAttributes(
|
||||||
// are we passing in MIN_NORMAL (Java's smallest non-zero value
|
// are we passing in MIN_NORMAL (Java's smallest non-zero value
|
||||||
// conforming to IEEE Standard 754 (?)) and MAX_VALUE
|
// conforming to IEEE Standard 754 (?)) and MAX_VALUE
|
||||||
instance = attributes->registerAttribute(new RangedAttribute(
|
instance = attributes->registerAttribute(new RangedAttribute(
|
||||||
attribute->getId(), 0, Double::MIN_NORMAL, Double::MAX_VALUE));
|
attribute->getId(), 0, std::numeric_limits<double>::min(),
|
||||||
|
std::numeric_limits<double>::max()));
|
||||||
}
|
}
|
||||||
|
|
||||||
instance->setBaseValue(attribute->getBase());
|
instance->setBaseValue(attribute->getBase());
|
||||||
|
|
@ -4105,4 +4106,4 @@ ClientConnection::DeferredEntityLinkPacket::DeferredEntityLinkPacket(
|
||||||
std::shared_ptr<SetEntityLinkPacket> packet) {
|
std::shared_ptr<SetEntityLinkPacket> packet) {
|
||||||
m_recievedTick = GetTickCount();
|
m_recievedTick = GetTickCount();
|
||||||
m_packet = packet;
|
m_packet = packet;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -17,7 +17,6 @@
|
||||||
#include "../../Minecraft.World/Headers/net.minecraft.network.packet.h"
|
#include "../../Minecraft.World/Headers/net.minecraft.network.packet.h"
|
||||||
#include "../../Minecraft.World/Headers/net.minecraft.network.h"
|
#include "../../Minecraft.World/Headers/net.minecraft.network.h"
|
||||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.dimension.h"
|
#include "../../Minecraft.World/Headers/net.minecraft.world.level.dimension.h"
|
||||||
#include "../../Minecraft.World/Util/BasicTypeContainers.h"
|
|
||||||
#include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h"
|
#include "../../Minecraft.World/Headers/net.minecraft.world.level.chunk.h"
|
||||||
#include "../Network/PlayerConnection.h"
|
#include "../Network/PlayerConnection.h"
|
||||||
|
|
||||||
|
|
@ -250,4 +249,4 @@ std::shared_ptr<TrackedEntity> EntityTracker::getTracker(
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "LevelRenderer.h"
|
#include "LevelRenderer.h"
|
||||||
|
#include <cmath>
|
||||||
#include "../Textures/Textures.h"
|
#include "../Textures/Textures.h"
|
||||||
#include "../Textures/TextureAtlas.h"
|
#include "../Textures/TextureAtlas.h"
|
||||||
#include "Tesselator.h"
|
#include "Tesselator.h"
|
||||||
|
|
@ -59,7 +60,6 @@
|
||||||
#include "../Level/MultiPlayerLevel.h"
|
#include "../Level/MultiPlayerLevel.h"
|
||||||
#include "../../Minecraft.World/Util/SoundTypes.h"
|
#include "../../Minecraft.World/Util/SoundTypes.h"
|
||||||
#include "FrustumCuller.h"
|
#include "FrustumCuller.h"
|
||||||
#include "../../Minecraft.World/Util/BasicTypeContainers.h"
|
|
||||||
|
|
||||||
// #define DISABLE_SPU_CODE
|
// #define DISABLE_SPU_CODE
|
||||||
|
|
||||||
|
|
@ -2920,9 +2920,9 @@ std::shared_ptr<Particle> LevelRenderer::addParticleInternal(
|
||||||
// optimised PS3 code which reverses the logic on the comparison with
|
// optimised PS3 code which reverses the logic on the comparison with
|
||||||
// particleDistanceSquared and gets the opposite result to what you might
|
// particleDistanceSquared and gets the opposite result to what you might
|
||||||
// expect.
|
// expect.
|
||||||
if (Double::isNaN(x)) return nullptr;
|
if (std::isnan(x)) return nullptr;
|
||||||
if (Double::isNaN(y)) return nullptr;
|
if (std::isnan(y)) return nullptr;
|
||||||
if (Double::isNaN(z)) return nullptr;
|
if (std::isnan(z)) return nullptr;
|
||||||
|
|
||||||
int particleLevel = mc->options->particles;
|
int particleLevel = mc->options->particles;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "Tesselator.h"
|
#include "Tesselator.h"
|
||||||
#include "../../Minecraft.World/Util/BasicTypeContainers.h"
|
|
||||||
#include "../../Minecraft.World/IO/Streams/FloatBuffer.h"
|
#include "../../Minecraft.World/IO/Streams/FloatBuffer.h"
|
||||||
#include "../../Minecraft.World/IO/Streams/IntBuffer.h"
|
#include "../../Minecraft.World/IO/Streams/IntBuffer.h"
|
||||||
#include "../../Minecraft.World/IO/Streams/ByteBuffer.h"
|
#include "../../Minecraft.World/IO/Streams/ByteBuffer.h"
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.animal.h"
|
#include "../../Headers/net.minecraft.world.entity.animal.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "BreedGoal.h"
|
#include "BreedGoal.h"
|
||||||
|
#include <limits>
|
||||||
#include "../../Entities/Mobs/ExperienceOrb.h"
|
#include "../../Entities/Mobs/ExperienceOrb.h"
|
||||||
|
|
||||||
#include "../../Stats/GenericStats.h"
|
#include "../../Stats/GenericStats.h"
|
||||||
|
|
@ -50,7 +50,7 @@ std::shared_ptr<Animal> BreedGoal::getFreePartner() {
|
||||||
float r = 8;
|
float r = 8;
|
||||||
std::vector<std::shared_ptr<Entity> >* others =
|
std::vector<std::shared_ptr<Entity> >* others =
|
||||||
level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r));
|
level->getEntitiesOfClass(typeid(*animal), animal->bb->grow(r, r, r));
|
||||||
double dist = Double::MAX_VALUE;
|
double dist = std::numeric_limits<double>::max();
|
||||||
std::shared_ptr<Animal> partner = nullptr;
|
std::shared_ptr<Animal> partner = nullptr;
|
||||||
for (AUTO_VAR(it, others->begin()); it != others->end(); ++it) {
|
for (AUTO_VAR(it, others->begin()); it != others->end(); ++it) {
|
||||||
std::shared_ptr<Animal> p = std::dynamic_pointer_cast<Animal>(*it);
|
std::shared_ptr<Animal> p = std::dynamic_pointer_cast<Animal>(*it);
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.ai.navigation.h"
|
#include "../../Headers/net.minecraft.world.entity.ai.navigation.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "FollowParentGoal.h"
|
#include "FollowParentGoal.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
FollowParentGoal::FollowParentGoal(Animal* animal, double speedModifier) {
|
FollowParentGoal::FollowParentGoal(Animal* animal, double speedModifier) {
|
||||||
timeToRecalcPath = 0;
|
timeToRecalcPath = 0;
|
||||||
|
|
@ -21,7 +21,7 @@ bool FollowParentGoal::canUse() {
|
||||||
animal->bb->grow(8, 4, 8));
|
animal->bb->grow(8, 4, 8));
|
||||||
|
|
||||||
std::shared_ptr<Animal> closest = nullptr;
|
std::shared_ptr<Animal> closest = nullptr;
|
||||||
double closestDistSqr = Double::MAX_VALUE;
|
double closestDistSqr = std::numeric_limits<double>::max();
|
||||||
for (AUTO_VAR(it, parents->begin()); it != parents->end(); ++it) {
|
for (AUTO_VAR(it, parents->begin()); it != parents->end(); ++it) {
|
||||||
std::shared_ptr<Animal> parent = std::dynamic_pointer_cast<Animal>(*it);
|
std::shared_ptr<Animal> parent = std::dynamic_pointer_cast<Animal>(*it);
|
||||||
if (parent->getAge() < 0) continue;
|
if (parent->getAge() < 0) continue;
|
||||||
|
|
@ -53,4 +53,4 @@ void FollowParentGoal::tick() {
|
||||||
if (--timeToRecalcPath > 0) return;
|
if (--timeToRecalcPath > 0) return;
|
||||||
timeToRecalcPath = 10;
|
timeToRecalcPath = 10;
|
||||||
animal->getNavigation()->moveTo(parent.lock(), speedModifier);
|
animal->getNavigation()->moveTo(parent.lock(), speedModifier);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.ai.village.h"
|
#include "../../Headers/net.minecraft.world.entity.ai.village.h"
|
||||||
#include "../../Headers/net.minecraft.world.entity.h"
|
#include "../../Headers/net.minecraft.world.entity.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "MoveThroughVillageGoal.h"
|
#include "MoveThroughVillageGoal.h"
|
||||||
|
#include <limits>
|
||||||
#include "../Navigation/Path.h"
|
#include "../Navigation/Path.h"
|
||||||
|
|
||||||
MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob* mob,
|
MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob* mob,
|
||||||
|
|
@ -86,7 +86,7 @@ void MoveThroughVillageGoal::stop() {
|
||||||
std::shared_ptr<DoorInfo> MoveThroughVillageGoal::getNextDoorInfo(
|
std::shared_ptr<DoorInfo> MoveThroughVillageGoal::getNextDoorInfo(
|
||||||
std::shared_ptr<Village> village) {
|
std::shared_ptr<Village> village) {
|
||||||
std::shared_ptr<DoorInfo> closest = nullptr;
|
std::shared_ptr<DoorInfo> closest = nullptr;
|
||||||
int closestDistSqr = Integer::MAX_VALUE;
|
int closestDistSqr = std::numeric_limits<int>::max();
|
||||||
std::vector<std::shared_ptr<DoorInfo> >* doorInfos =
|
std::vector<std::shared_ptr<DoorInfo> >* doorInfos =
|
||||||
village->getDoorInfos();
|
village->getDoorInfos();
|
||||||
// for (DoorInfo di : doorInfos)
|
// for (DoorInfo di : doorInfos)
|
||||||
|
|
@ -120,4 +120,4 @@ bool MoveThroughVillageGoal::hasVisited(std::shared_ptr<DoorInfo> di) {
|
||||||
|
|
||||||
void MoveThroughVillageGoal::updateVisited() {
|
void MoveThroughVillageGoal::updateVisited() {
|
||||||
if (visited.size() > 15) visited.erase(visited.begin());
|
if (visited.size() > 15) visited.erase(visited.begin());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.tile.h"
|
#include "../../Headers/net.minecraft.world.level.tile.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.tile.entity.h"
|
#include "../../Headers/net.minecraft.world.level.tile.entity.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "../../Util/Arrays.h"
|
#include "../../Util/Arrays.h"
|
||||||
#include "OcelotSitOnTileGoal.h"
|
#include "OcelotSitOnTileGoal.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
const int OcelotSitOnTileGoal::GIVE_UP_TICKS =
|
const int OcelotSitOnTileGoal::GIVE_UP_TICKS =
|
||||||
3 * SharedConstants::TICKS_PER_SECOND;
|
3 * SharedConstants::TICKS_PER_SECOND;
|
||||||
|
|
@ -77,7 +77,7 @@ void OcelotSitOnTileGoal::tick() {
|
||||||
|
|
||||||
bool OcelotSitOnTileGoal::findNearestTile() {
|
bool OcelotSitOnTileGoal::findNearestTile() {
|
||||||
int y = (int)ocelot->y;
|
int y = (int)ocelot->y;
|
||||||
double distSqr = Integer::MAX_VALUE;
|
double distSqr = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
for (int x = (int)ocelot->x - SEARCH_RANGE; x < ocelot->x + SEARCH_RANGE;
|
for (int x = (int)ocelot->x - SEARCH_RANGE; x < ocelot->x + SEARCH_RANGE;
|
||||||
x++) {
|
x++) {
|
||||||
|
|
@ -97,7 +97,7 @@ bool OcelotSitOnTileGoal::findNearestTile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return distSqr < Integer::MAX_VALUE;
|
return distSqr < std::numeric_limits<int>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OcelotSitOnTileGoal::isValidTarget(Level* level, int x, int y, int z) {
|
bool OcelotSitOnTileGoal::isValidTarget(Level* level, int x, int y, int z) {
|
||||||
|
|
@ -119,4 +119,4 @@ bool OcelotSitOnTileGoal::isValidTarget(Level* level, int x, int y, int z) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.h"
|
#include "../../Headers/net.minecraft.world.entity.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "PlayGoal.h"
|
#include "PlayGoal.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
PlayGoal::PlayGoal(Villager* mob, double speedModifier) {
|
PlayGoal::PlayGoal(Villager* mob, double speedModifier) {
|
||||||
followFriend = std::weak_ptr<LivingEntity>();
|
followFriend = std::weak_ptr<LivingEntity>();
|
||||||
|
|
@ -26,7 +26,7 @@ bool PlayGoal::canUse() {
|
||||||
std::vector<std::shared_ptr<Entity> >* children =
|
std::vector<std::shared_ptr<Entity> >* children =
|
||||||
mob->level->getEntitiesOfClass(typeid(Villager),
|
mob->level->getEntitiesOfClass(typeid(Villager),
|
||||||
mob->bb->grow(6, 3, 6));
|
mob->bb->grow(6, 3, 6));
|
||||||
double closestDistSqr = Double::MAX_VALUE;
|
double closestDistSqr = std::numeric_limits<double>::max();
|
||||||
// for (Entity c : children)
|
// for (Entity c : children)
|
||||||
for (AUTO_VAR(it, children->begin()); it != children->end(); ++it) {
|
for (AUTO_VAR(it, children->begin()); it != children->end(); ++it) {
|
||||||
std::shared_ptr<Entity> c = *it;
|
std::shared_ptr<Entity> c = *it;
|
||||||
|
|
@ -80,4 +80,4 @@ void PlayGoal::tick() {
|
||||||
mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, speedModifier);
|
mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, speedModifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
#include "../Headers/net.minecraft.commands.h"
|
#include "../Headers/net.minecraft.commands.h"
|
||||||
#include "../Headers/net.minecraft.world.entity.player.h"
|
#include "../Headers/net.minecraft.world.entity.player.h"
|
||||||
#include "../Headers/net.minecraft.world.damagesource.h"
|
#include "../Headers/net.minecraft.world.damagesource.h"
|
||||||
#include "../Util/BasicTypeContainers.h"
|
|
||||||
#include "KillCommand.h"
|
#include "KillCommand.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
EGameCommand KillCommand::getId() { return eGameCommand_Kill; }
|
EGameCommand KillCommand::getId() { return eGameCommand_Kill; }
|
||||||
|
|
||||||
|
|
@ -13,8 +13,8 @@ void KillCommand::execute(std::shared_ptr<CommandSender> source,
|
||||||
byteArray commandData) {
|
byteArray commandData) {
|
||||||
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(source);
|
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>(source);
|
||||||
|
|
||||||
player->hurt(DamageSource::outOfWorld, Float::MAX_VALUE);
|
player->hurt(DamageSource::outOfWorld, std::numeric_limits<float>::max());
|
||||||
|
|
||||||
source->sendMessage(L"Ouch. That look like it hurt.");
|
source->sendMessage(L"Ouch. That look like it hurt.");
|
||||||
// source.sendMessage(ChatMessageComponent.forTranslation("commands.kill.success"));
|
// source.sendMessage(ChatMessageComponent.forTranslation("commands.kill.success"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
#include "../../Minecraft.Client/Level/ServerLevel.h"
|
#include "../../Minecraft.Client/Level/ServerLevel.h"
|
||||||
#include "../../Minecraft.Client/Player/EntityTracker.h"
|
#include "../../Minecraft.Client/Player/EntityTracker.h"
|
||||||
#include "../Util/SoundTypes.h"
|
#include "../Util/SoundTypes.h"
|
||||||
#include "../Util/BasicTypeContainers.h"
|
|
||||||
#include "../Util/ParticleTypes.h"
|
#include "../Util/ParticleTypes.h"
|
||||||
#include "../Stats/GenericStats.h"
|
#include "../Stats/GenericStats.h"
|
||||||
#include "ItemEntity.h"
|
#include "ItemEntity.h"
|
||||||
|
|
@ -1732,4 +1731,4 @@ bool LivingEntity::isAlliedTo(Team* other) {
|
||||||
return getTeam()->isAlliedTo(other);
|
return getTeam()->isAlliedTo(other);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "Mob.h"
|
#include "Mob.h"
|
||||||
#include "../../Minecraft.Client/Textures/Textures.h"
|
#include "../../Minecraft.Client/Textures/Textures.h"
|
||||||
#include "../Util/SoundTypes.h"
|
#include "../Util/SoundTypes.h"
|
||||||
#include "../Util/BasicTypeContainers.h"
|
|
||||||
#include "../Util/ParticleTypes.h"
|
#include "../Util/ParticleTypes.h"
|
||||||
#include "../Stats/GenericStats.h"
|
#include "../Stats/GenericStats.h"
|
||||||
#include "ItemEntity.h"
|
#include "ItemEntity.h"
|
||||||
|
|
@ -901,4 +900,4 @@ void Mob::setLevel(Level* level) {
|
||||||
navigation->setLevel(level);
|
navigation->setLevel(level);
|
||||||
goalSelector.setLevel(level);
|
goalSelector.setLevel(level);
|
||||||
targetSelector.setLevel(level);
|
targetSelector.setLevel(level);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.projectile.h"
|
#include "../../Headers/net.minecraft.world.entity.projectile.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../Headers/net.minecraft.world.damagesource.h"
|
#include "../../Headers/net.minecraft.world.damagesource.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "../../../Minecraft.Client/Textures/Textures.h"
|
#include "../../../Minecraft.Client/Textures/Textures.h"
|
||||||
#include "../../Headers/net.minecraft.world.entity.boss.enderdragon.h"
|
#include "../../Headers/net.minecraft.world.entity.boss.enderdragon.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.pathfinder.h"
|
#include "../../Headers/net.minecraft.world.level.pathfinder.h"
|
||||||
#include "../../Util/SharedConstants.h"
|
#include "../../Util/SharedConstants.h"
|
||||||
#include "EnderDragon.h"
|
#include "EnderDragon.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#define PRINT_DRAGON_STATE_CHANGE_MESSAGES 1
|
#define PRINT_DRAGON_STATE_CHANGE_MESSAGES 1
|
||||||
|
|
||||||
|
|
@ -815,7 +815,7 @@ void EnderDragon::checkCrystals() {
|
||||||
bb->grow(maxDist, maxDist, maxDist));
|
bb->grow(maxDist, maxDist, maxDist));
|
||||||
|
|
||||||
std::shared_ptr<EnderCrystal> crystal = nullptr;
|
std::shared_ptr<EnderCrystal> crystal = nullptr;
|
||||||
double nearest = Double::MAX_VALUE;
|
double nearest = std::numeric_limits<double>::max();
|
||||||
// for (Entity ec : crystals)
|
// for (Entity ec : crystals)
|
||||||
for (AUTO_VAR(it, crystals->begin()); it != crystals->end(); ++it) {
|
for (AUTO_VAR(it, crystals->begin()); it != crystals->end(); ++it) {
|
||||||
std::shared_ptr<EnderCrystal> ec =
|
std::shared_ptr<EnderCrystal> ec =
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../../Minecraft.Client/Textures/Textures.h"
|
#include "../../../Minecraft.Client/Textures/Textures.h"
|
||||||
#include "../../../Minecraft.Client/Minecraft.h"
|
#include "../../../Minecraft.Client/Minecraft.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "EntityHorse.h"
|
#include "EntityHorse.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
const std::wstring EntityHorse::TEX_FOLDER = L"mob/horse/";
|
const std::wstring EntityHorse::TEX_FOLDER = L"mob/horse/";
|
||||||
|
|
||||||
|
|
@ -417,7 +417,7 @@ bool EntityHorse::canSpawn() {
|
||||||
|
|
||||||
std::shared_ptr<EntityHorse> EntityHorse::getClosestMommy(
|
std::shared_ptr<EntityHorse> EntityHorse::getClosestMommy(
|
||||||
std::shared_ptr<Entity> baby, double searchRadius) {
|
std::shared_ptr<Entity> baby, double searchRadius) {
|
||||||
double closestDistance = Double::MAX_VALUE;
|
double closestDistance = std::numeric_limits<double>::max();
|
||||||
|
|
||||||
std::shared_ptr<Entity> mommy = nullptr;
|
std::shared_ptr<Entity> mommy = nullptr;
|
||||||
std::vector<std::shared_ptr<Entity> >* list = level->getEntities(
|
std::vector<std::shared_ptr<Entity> >* list = level->getEntities(
|
||||||
|
|
@ -1517,4 +1517,4 @@ bool EntityHorse::onLadder() {
|
||||||
|
|
||||||
std::shared_ptr<Player> EntityHorse::getOwner() {
|
std::shared_ptr<Player> EntityHorse::getOwner() {
|
||||||
return level->getPlayerByUUID(getOwnerName());
|
return level->getPlayerByUUID(getOwnerName());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../Headers/net.minecraft.world.entity.ai.attributes.h"
|
#include "../../Headers/net.minecraft.world.entity.ai.attributes.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "SharedMonsterAttributes.h"
|
#include "SharedMonsterAttributes.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
Attribute* SharedMonsterAttributes::MAX_HEALTH =
|
Attribute* SharedMonsterAttributes::MAX_HEALTH =
|
||||||
(new RangedAttribute(eAttributeId_GENERIC_MAXHEALTH, 20, 0,
|
(new RangedAttribute(eAttributeId_GENERIC_MAXHEALTH, 20, 0,
|
||||||
Double::MAX_VALUE))
|
std::numeric_limits<double>::max()))
|
||||||
->setSyncable(true);
|
->setSyncable(true);
|
||||||
Attribute* SharedMonsterAttributes::FOLLOW_RANGE =
|
Attribute* SharedMonsterAttributes::FOLLOW_RANGE =
|
||||||
(new RangedAttribute(eAttributeId_GENERIC_FOLLOWRANGE, 32, 0, 2048));
|
(new RangedAttribute(eAttributeId_GENERIC_FOLLOWRANGE, 32, 0, 2048));
|
||||||
|
|
@ -13,10 +13,11 @@ Attribute* SharedMonsterAttributes::KNOCKBACK_RESISTANCE =
|
||||||
(new RangedAttribute(eAttributeId_GENERIC_KNOCKBACKRESISTANCE, 0, 0, 1));
|
(new RangedAttribute(eAttributeId_GENERIC_KNOCKBACKRESISTANCE, 0, 0, 1));
|
||||||
Attribute* SharedMonsterAttributes::MOVEMENT_SPEED =
|
Attribute* SharedMonsterAttributes::MOVEMENT_SPEED =
|
||||||
(new RangedAttribute(eAttributeId_GENERIC_MOVEMENTSPEED, 0.7f, 0,
|
(new RangedAttribute(eAttributeId_GENERIC_MOVEMENTSPEED, 0.7f, 0,
|
||||||
Double::MAX_VALUE))
|
std::numeric_limits<double>::max()))
|
||||||
->setSyncable(true);
|
->setSyncable(true);
|
||||||
Attribute* SharedMonsterAttributes::ATTACK_DAMAGE = new RangedAttribute(
|
Attribute* SharedMonsterAttributes::ATTACK_DAMAGE =
|
||||||
eAttributeId_GENERIC_ATTACKDAMAGE, 2, 0, Double::MAX_VALUE);
|
new RangedAttribute(eAttributeId_GENERIC_ATTACKDAMAGE, 2, 0,
|
||||||
|
std::numeric_limits<double>::max());
|
||||||
|
|
||||||
ListTag<CompoundTag>* SharedMonsterAttributes::saveAttributes(
|
ListTag<CompoundTag>* SharedMonsterAttributes::saveAttributes(
|
||||||
BaseAttributeMap* attributes) {
|
BaseAttributeMap* attributes) {
|
||||||
|
|
@ -108,4 +109,4 @@ AttributeModifier* SharedMonsterAttributes::loadAttributeModifier(
|
||||||
eMODIFIER_ID id = (eMODIFIER_ID)tag->getInt(L"UUID");
|
eMODIFIER_ID id = (eMODIFIER_ID)tag->getInt(L"UUID");
|
||||||
return new AttributeModifier(id, tag->getDouble(L"Amount"),
|
return new AttributeModifier(id, tag->getDouble(L"Amount"),
|
||||||
tag->getInt(L"Operation"));
|
tag->getInt(L"Operation"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.entity.h"
|
#include "../../Headers/net.minecraft.world.entity.h"
|
||||||
#include "../../Headers/net.minecraft.world.entity.monster.h"
|
#include "../../Headers/net.minecraft.world.entity.monster.h"
|
||||||
#include "../../Headers/com.mojang.nbt.h"
|
#include "../../Headers/com.mojang.nbt.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "Spider.h"
|
#include "Spider.h"
|
||||||
|
#include <limits>
|
||||||
#include "../../../Minecraft.Client/Textures/Textures.h"
|
#include "../../../Minecraft.Client/Textures/Textures.h"
|
||||||
#include "../../Util/SoundTypes.h"
|
#include "../../Util/SoundTypes.h"
|
||||||
|
|
||||||
|
|
@ -173,7 +173,8 @@ MobGroupData* Spider::finalizeMobSpawn(
|
||||||
if (dynamic_cast<SpiderEffectsGroupData*>(groupData) != NULL) {
|
if (dynamic_cast<SpiderEffectsGroupData*>(groupData) != NULL) {
|
||||||
int effect = ((SpiderEffectsGroupData*)groupData)->effectId;
|
int effect = ((SpiderEffectsGroupData*)groupData)->effectId;
|
||||||
if (effect > 0 && MobEffect::effects[effect] != NULL) {
|
if (effect > 0 && MobEffect::effects[effect] != NULL) {
|
||||||
addEffect(new MobEffectInstance(effect, Integer::MAX_VALUE));
|
addEffect(
|
||||||
|
new MobEffectInstance(effect, std::numeric_limits<int>::max()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,4 +196,4 @@ void Spider::SpiderEffectsGroupData::setRandomEffect(Random* random) {
|
||||||
} else if (selection <= 4) {
|
} else if (selection <= 4) {
|
||||||
effectId = MobEffect::invisibility->id;
|
effectId = MobEffect::invisibility->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "../Util/Class.h"
|
#include "../Util/Class.h"
|
||||||
#include "../Util/BasicTypeContainers.h"
|
|
||||||
#include "../IO/Streams/InputOutputStream.h"
|
#include "../IO/Streams/InputOutputStream.h"
|
||||||
#include "../Headers/net.minecraft.h"
|
#include "../Headers/net.minecraft.h"
|
||||||
#include "../Headers/net.minecraft.network.packet.h"
|
#include "../Headers/net.minecraft.network.packet.h"
|
||||||
|
|
@ -542,4 +541,4 @@ int SynchedEntityData::DataItem::getType() { return type; }
|
||||||
|
|
||||||
bool SynchedEntityData::DataItem::isDirty() { return dirty; }
|
bool SynchedEntityData::DataItem::isDirty() { return dirty; }
|
||||||
|
|
||||||
void SynchedEntityData::DataItem::setDirty(bool dirty) { this->dirty = dirty; }
|
void SynchedEntityData::DataItem::setDirty(bool dirty) { this->dirty = dirty; }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
|
|
||||||
#include "DataInputStream.h"
|
#include "DataInputStream.h"
|
||||||
|
#include <bit>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// Creates a DataInputStream that uses the specified underlying InputStream.
|
// Creates a DataInputStream that uses the specified underlying InputStream.
|
||||||
// Parameters:
|
// Parameters:
|
||||||
|
|
@ -146,7 +147,7 @@ unsigned char DataInputStream::readUnsignedByte() {
|
||||||
|
|
||||||
// Reads two input bytes and returns a char value. Let a be the first byte read
|
// Reads two input bytes and returns a char value. Let a be the first byte read
|
||||||
// and b be the second byte. The value returned is: (char)((a << 8) | (b &
|
// and b be the second byte. The value returned is: (char)((a << 8) | (b &
|
||||||
//0xff))
|
// 0xff))
|
||||||
//
|
//
|
||||||
// This method is suitable for reading bytes written by the writeChar method of
|
// This method is suitable for reading bytes written by the writeChar method of
|
||||||
// interface DataOutput. Returns: the char value read.
|
// interface DataOutput. Returns: the char value read.
|
||||||
|
|
@ -229,7 +230,7 @@ bool DataInputStream::readFully(charArray b) {
|
||||||
double DataInputStream::readDouble() {
|
double DataInputStream::readDouble() {
|
||||||
int64_t bits = readLong();
|
int64_t bits = readLong();
|
||||||
|
|
||||||
return Double::longBitsToDouble(bits);
|
return std::bit_cast<double>(bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads four input bytes and returns a float value. It does this by first
|
// Reads four input bytes and returns a float value. It does this by first
|
||||||
|
|
@ -240,7 +241,7 @@ double DataInputStream::readDouble() {
|
||||||
float DataInputStream::readFloat() {
|
float DataInputStream::readFloat() {
|
||||||
int bits = readInt();
|
int bits = readInt();
|
||||||
|
|
||||||
return Float::intBitsToFloat(bits);
|
return std::bit_cast<float>(bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads four input bytes and returns an int value. Let a-d be the first through
|
// Reads four input bytes and returns an int value. Let a-d be the first through
|
||||||
|
|
@ -308,7 +309,7 @@ int64_t DataInputStream::readLong() {
|
||||||
|
|
||||||
// Reads two input bytes and returns a short value. Let a be the first byte read
|
// Reads two input bytes and returns a short value. Let a be the first byte read
|
||||||
// and b be the second byte. The value returned is: (short)((a << 8) | (b &
|
// and b be the second byte. The value returned is: (short)((a << 8) | (b &
|
||||||
//0xff))
|
// 0xff))
|
||||||
//
|
//
|
||||||
// This method is suitable for reading the bytes written by the writeShort
|
// This method is suitable for reading the bytes written by the writeShort
|
||||||
// method of interface DataOutput. Returns: the 16-bit value read.
|
// method of interface DataOutput. Returns: the 16-bit value read.
|
||||||
|
|
@ -326,7 +327,8 @@ short DataInputStream::readShort() {
|
||||||
unsigned short DataInputStream::readUnsignedShort() {
|
unsigned short DataInputStream::readUnsignedShort() {
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"DataInputStream::readUnsignedShort() but underlying stream is NULL\n");
|
"DataInputStream::readUnsignedShort() but underlying stream is "
|
||||||
|
"NULL\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int a = stream->read();
|
int a = stream->read();
|
||||||
|
|
@ -392,8 +394,8 @@ std::wstring DataInputStream::readUTF() {
|
||||||
unsigned short UTFLength = (unsigned short)(((a & 0xff) << 8) | (b & 0xff));
|
unsigned short UTFLength = (unsigned short)(((a & 0xff) << 8) | (b & 0xff));
|
||||||
|
|
||||||
//// 4J Stu - I decided while writing DataOutputStream that we didn't need
|
//// 4J Stu - I decided while writing DataOutputStream that we didn't need
|
||||||
///to bother using the UTF8 format / used in the java libs, and just write
|
/// to bother using the UTF8 format / used in the java libs, and just write
|
||||||
///in/out as wchar_t all the time
|
/// in/out as wchar_t all the time
|
||||||
|
|
||||||
/*for( unsigned short i = 0; i < UTFLength; i++)
|
/*for( unsigned short i = 0; i < UTFLength; i++)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
|
|
||||||
#include "DataOutputStream.h"
|
#include "DataOutputStream.h"
|
||||||
|
#include <bit>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
// Creates a new data output stream to write data to the specified underlying
|
// Creates a new data output stream to write data to the specified underlying
|
||||||
// output stream. The counter written is set to zero. Parameters: out - the
|
// output stream. The counter written is set to zero. Parameters: out - the
|
||||||
|
|
@ -86,7 +87,7 @@ void DataOutputStream::writeByte(uint8_t a) {
|
||||||
// counter written is incremented by 8. Parameters: v - a double value to be
|
// counter written is incremented by 8. Parameters: v - a double value to be
|
||||||
// written.
|
// written.
|
||||||
void DataOutputStream::writeDouble(double a) {
|
void DataOutputStream::writeDouble(double a) {
|
||||||
int64_t bits = Double::doubleToLongBits(a);
|
int64_t bits = std::bit_cast<int64_t>(a);
|
||||||
|
|
||||||
writeLong(bits);
|
writeLong(bits);
|
||||||
// TODO 4J Stu - Error handling?
|
// TODO 4J Stu - Error handling?
|
||||||
|
|
@ -98,7 +99,7 @@ void DataOutputStream::writeDouble(double a) {
|
||||||
// as a 4-byte quantity, high byte first. If no exception is thrown, the counter
|
// as a 4-byte quantity, high byte first. If no exception is thrown, the counter
|
||||||
// written is incremented by 4. Parameters: v - a float value to be written.
|
// written is incremented by 4. Parameters: v - a float value to be written.
|
||||||
void DataOutputStream::writeFloat(float a) {
|
void DataOutputStream::writeFloat(float a) {
|
||||||
int bits = Float::floatToIntBits(a);
|
int bits = std::bit_cast<int>(a);
|
||||||
|
|
||||||
writeInt(bits);
|
writeInt(bits);
|
||||||
// TODO 4J Stu - Error handling?
|
// TODO 4J Stu - Error handling?
|
||||||
|
|
@ -149,7 +150,8 @@ void DataOutputStream::writeShort(short a) {
|
||||||
void DataOutputStream::writeUnsignedShort(unsigned short a) {
|
void DataOutputStream::writeUnsignedShort(unsigned short a) {
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
app.DebugPrintf(
|
app.DebugPrintf(
|
||||||
"DataOutputStream::writeUnsignedShort() but underlying stream is NULL\n");
|
"DataOutputStream::writeUnsignedShort() but underlying stream is "
|
||||||
|
"NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stream->write(static_cast<unsigned int>((a >> 8) & 0xff));
|
stream->write(static_cast<unsigned int>((a >> 8) & 0xff));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "../Platform/System.h"
|
#include "../Platform/System.h"
|
||||||
#include "../Util/BasicTypeContainers.h"
|
|
||||||
#include "../IO/Files/File.h"
|
#include "../IO/Files/File.h"
|
||||||
#include "../Util/ProgressListener.h"
|
#include "../Util/ProgressListener.h"
|
||||||
#include "../Headers/net.minecraft.h"
|
#include "../Headers/net.minecraft.h"
|
||||||
|
|
@ -39,7 +38,9 @@
|
||||||
#include "../../Minecraft.Client/Platform/Common/DLC/DLCPack.h"
|
#include "../../Minecraft.Client/Platform/Common/DLC/DLCPack.h"
|
||||||
#include "../../Minecraft.Client/Platform/PS3/PS3Extras/ShutdownManager.h"
|
#include "../../Minecraft.Client/Platform/PS3/PS3Extras/ShutdownManager.h"
|
||||||
#include "../../Minecraft.Client/MinecraftServer.h"
|
#include "../../Minecraft.Client/MinecraftServer.h"
|
||||||
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// 4J : WESTY : Added for time played stats.
|
// 4J : WESTY : Added for time played stats.
|
||||||
#include "../Headers/net.minecraft.stats.h"
|
#include "../Headers/net.minecraft.stats.h"
|
||||||
|
|
@ -1374,10 +1375,8 @@ HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid, bool solidOnly) {
|
HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid, bool solidOnly) {
|
||||||
if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z))
|
if (std::isnan(a->x) || std::isnan(a->y) || std::isnan(a->z)) return NULL;
|
||||||
return NULL;
|
if (std::isnan(b->x) || std::isnan(b->y) || std::isnan(b->z)) return NULL;
|
||||||
if (Double::isNaN(b->x) || Double::isNaN(b->y) || Double::isNaN(b->z))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
int xTile1 = Mth::floor(b->x);
|
int xTile1 = Mth::floor(b->x);
|
||||||
int yTile1 = Mth::floor(b->y);
|
int yTile1 = Mth::floor(b->y);
|
||||||
|
|
@ -1403,7 +1402,7 @@ HitResult* Level::clip(Vec3* a, Vec3* b, bool liquid, bool solidOnly) {
|
||||||
|
|
||||||
int maxIterations = 200;
|
int maxIterations = 200;
|
||||||
while (maxIterations-- >= 0) {
|
while (maxIterations-- >= 0) {
|
||||||
if (Double::isNaN(a->x) || Double::isNaN(a->y) || Double::isNaN(a->z))
|
if (std::isnan(a->x) || std::isnan(a->y) || std::isnan(a->z))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1)
|
if (xTile0 == xTile1 && yTile0 == yTile1 && zTile0 == zTile1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -2308,13 +2307,12 @@ void Level::tick(std::shared_ptr<Entity> e, bool actual) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SANTITY!!
|
// SANTITY!!
|
||||||
if (Double::isNaN(e->x) || Double::isInfinite(e->x)) e->x = e->xOld;
|
|
||||||
if (Double::isNaN(e->y) || Double::isInfinite(e->y)) e->y = e->yOld;
|
if (!std::isfinite(e->x)) e->x = e->xOld;
|
||||||
if (Double::isNaN(e->z) || Double::isInfinite(e->z)) e->z = e->zOld;
|
if (!std::isfinite(e->y)) e->y = e->yOld;
|
||||||
if (Double::isNaN(e->xRot) || Double::isInfinite(e->xRot))
|
if (!std::isfinite(e->z)) e->z = e->zOld;
|
||||||
e->xRot = e->xRotO;
|
if (!std::isfinite(e->xRot)) e->xRot = e->xRotO;
|
||||||
if (Double::isNaN(e->yRot) || Double::isInfinite(e->yRot))
|
if (!std::isfinite(e->yRot)) e->yRot = e->yRotO;
|
||||||
e->yRot = e->yRotO;
|
|
||||||
|
|
||||||
int xcn = Mth::floor(e->x / 16);
|
int xcn = Mth::floor(e->x / 16);
|
||||||
int ycn = Mth::floor(e->y / 16);
|
int ycn = Mth::floor(e->y / 16);
|
||||||
|
|
@ -2931,7 +2929,7 @@ void Level::toggleDownfall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Level::buildAndPrepareChunksToPoll() {
|
void Level::buildAndPrepareChunksToPoll() {
|
||||||
#if 0
|
#if 0
|
||||||
AUTO_VAR(itEnd, players.end());
|
AUTO_VAR(itEnd, players.end());
|
||||||
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
|
for (AUTO_VAR(it, players.begin()); it != itEnd; it++)
|
||||||
{
|
{
|
||||||
|
|
@ -3512,7 +3510,7 @@ std::shared_ptr<Entity> Level::getClosestEntityOfClass(
|
||||||
std::vector<std::shared_ptr<Entity> >* entities =
|
std::vector<std::shared_ptr<Entity> >* entities =
|
||||||
getEntitiesOfClass(baseClass, bb);
|
getEntitiesOfClass(baseClass, bb);
|
||||||
std::shared_ptr<Entity> closest = nullptr;
|
std::shared_ptr<Entity> closest = nullptr;
|
||||||
double closestDistSqr = Double::MAX_VALUE;
|
double closestDistSqr = std::numeric_limits<double>::max();
|
||||||
// for (Entity entity : entities)
|
// for (Entity entity : entities)
|
||||||
for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) {
|
for (AUTO_VAR(it, entities->begin()); it != entities->end(); ++it) {
|
||||||
std::shared_ptr<Entity> entity = *it;
|
std::shared_ptr<Entity> entity = *it;
|
||||||
|
|
@ -4411,4 +4409,4 @@ bool Level::canCreateMore(eINSTANCEOF type, ESPAWN_TYPE spawnType) {
|
||||||
}
|
}
|
||||||
// 4J: Interpret 0 as no limit
|
// 4J: Interpret 0 as no limit
|
||||||
return max == 0 || count < max;
|
return max == 0 || count < max;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include "Storage/SparseLightStorage.h"
|
#include "Storage/SparseLightStorage.h"
|
||||||
#include "BlockReplacements.h"
|
#include "BlockReplacements.h"
|
||||||
#include "LevelChunk.h"
|
#include "LevelChunk.h"
|
||||||
#include "../Util/BasicTypeContainers.h"
|
#include <limits>
|
||||||
#include "../../Minecraft.Client/MinecraftServer.h"
|
#include "../../Minecraft.Client/MinecraftServer.h"
|
||||||
#include "../../Minecraft.Client/Level/ServerLevel.h"
|
#include "../../Minecraft.Client/Level/ServerLevel.h"
|
||||||
#include "../../Minecraft.Client/Network/ServerChunkCache.h"
|
#include "../../Minecraft.Client/Network/ServerChunkCache.h"
|
||||||
|
|
@ -499,8 +499,8 @@ void LevelChunk::recalcHeightmapOnly() {
|
||||||
// value changed from -999 to 255
|
// value changed from -999 to 255
|
||||||
|
|
||||||
int y = Level::maxBuildHeight - 1;
|
int y = Level::maxBuildHeight - 1;
|
||||||
// int p = x << level->depthBitsPlusFour | z <<
|
// int p = x << level->depthBitsPlusFour | z <<
|
||||||
// level->depthBits; // 4J - removed
|
// level->depthBits; // 4J - removed
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
||||||
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
|
int offset = Level::COMPRESSED_CHUNK_SECTION_TILES;
|
||||||
|
|
@ -561,14 +561,14 @@ void LevelChunk::recalcHeightmap() {
|
||||||
byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT);
|
byteArray blockData = byteArray(Level::CHUNK_TILE_COUNT);
|
||||||
getBlockData(blockData);
|
getBlockData(blockData);
|
||||||
#endif
|
#endif
|
||||||
lowestHeightmap = Integer::MAX_VALUE;
|
lowestHeightmap = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
int min = Level::maxBuildHeight - 1;
|
int min = Level::maxBuildHeight - 1;
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
int y = Level::maxBuildHeight - 1;
|
int y = Level::maxBuildHeight - 1;
|
||||||
// int p = x << level->depthBitsPlusFour | z <<
|
// int p = x << level->depthBitsPlusFour | z <<
|
||||||
// level->depthBits; // 4J - removed
|
// level->depthBits; // 4J - removed
|
||||||
|
|
||||||
#ifdef __PSVITA__
|
#ifdef __PSVITA__
|
||||||
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
int Index = ((unsigned)x << 11) + ((unsigned)z << 7);
|
||||||
|
|
@ -1747,21 +1747,21 @@ void LevelChunk::getEntitiesOfClass(const std::type_info& ec, AABB* bb,
|
||||||
// our class may be derived from, otherwise do a direct comparison
|
// our class may be derived from, otherwise do a direct comparison
|
||||||
// of type_info
|
// of type_info
|
||||||
if (ec == typeid(Player))
|
if (ec == typeid(Player))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_PLAYER);
|
isAssignableFrom = e->instanceof(eTYPE_PLAYER);
|
||||||
else if (ec == typeid(Entity))
|
else if (ec == typeid(Entity))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_ENTITY);
|
isAssignableFrom = e->instanceof(eTYPE_ENTITY);
|
||||||
else if (ec == typeid(Mob))
|
else if (ec == typeid(Mob))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_MOB);
|
isAssignableFrom = e->instanceof(eTYPE_MOB);
|
||||||
else if (ec == typeid(LivingEntity))
|
else if (ec == typeid(LivingEntity))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_LIVINGENTITY);
|
isAssignableFrom = e->instanceof(eTYPE_LIVINGENTITY);
|
||||||
else if (ec == typeid(ItemEntity))
|
else if (ec == typeid(ItemEntity))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_ITEMENTITY);
|
isAssignableFrom = e->instanceof(eTYPE_ITEMENTITY);
|
||||||
else if (ec == typeid(Minecart))
|
else if (ec == typeid(Minecart))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_MINECART);
|
isAssignableFrom = e->instanceof(eTYPE_MINECART);
|
||||||
else if (ec == typeid(Monster))
|
else if (ec == typeid(Monster))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_MONSTER);
|
isAssignableFrom = e->instanceof(eTYPE_MONSTER);
|
||||||
else if (ec == typeid(Zombie))
|
else if (ec == typeid(Zombie))
|
||||||
isAssignableFrom = e->instanceof (eTYPE_ZOMBIE);
|
isAssignableFrom = e->instanceof(eTYPE_ZOMBIE);
|
||||||
else if (Entity* entity = e.get();
|
else if (Entity* entity = e.get();
|
||||||
entity != NULL && ec == typeid(*entity))
|
entity != NULL && ec == typeid(*entity))
|
||||||
isAssignableFrom = true;
|
isAssignableFrom = true;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../Util/JavaMath.h"
|
#include "../../Util/JavaMath.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#if 0
|
#if 0
|
||||||
// 4J - not required anymore
|
// 4J - not required anymore
|
||||||
#include "Matcher.h"
|
#include "Matcher.h"
|
||||||
|
|
@ -41,7 +40,7 @@ std::vector<LevelSummary*>* McRegionLevelStorageSource::getLevelList() {
|
||||||
{
|
{
|
||||||
file = *it; //subFolders->at(i);
|
file = *it; //subFolders->at(i);
|
||||||
|
|
||||||
if (file->isDirectory())
|
if (file->isDirectory())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +141,7 @@ bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile* saveFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalCount = normalRegions->size() + netherRegions->size() + enderRegions.size() + normalBaseFolders->size() + netherBaseFolders->size() + enderBaseFolders.size();
|
int totalCount = normalRegions->size() + netherRegions->size() + enderRegions.size() + normalBaseFolders->size() + netherBaseFolders->size() + enderBaseFolders.size();
|
||||||
|
|
||||||
// System.out.println("Total conversion count is " + totalCount); 4J Jev, TODO
|
// System.out.println("Total conversion count is " + totalCount); 4J Jev, TODO
|
||||||
|
|
||||||
// convert normal world
|
// convert normal world
|
||||||
|
|
@ -170,7 +169,7 @@ bool McRegionLevelStorageSource::convertLevel(ConsoleSaveFile* saveFile,
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// 4J - not required anymore
|
// 4J - not required anymore
|
||||||
void McRegionLevelStorageSource::addRegions(File &baseFolder, std::vector<ChunkFile *> *dest, std::vector<File *> *firstLevelFolders)
|
void McRegionLevelStorageSource::addRegions(File &baseFolder, std::vector<ChunkFile *> *dest, std::vector<File *> *firstLevelFolders)
|
||||||
{
|
{
|
||||||
FolderFilter folderFilter;
|
FolderFilter folderFilter;
|
||||||
ChunkFilter chunkFilter;
|
ChunkFilter chunkFilter;
|
||||||
|
|
@ -236,7 +235,7 @@ void McRegionLevelStorageSource::convertRegions(
|
||||||
int z = chunkFile->getZ();
|
int z = chunkFile->getZ();
|
||||||
|
|
||||||
RegionFile *region = RegionFileCache::getRegionFile(baseFolder, x, z);
|
RegionFile *region = RegionFileCache::getRegionFile(baseFolder, x, z);
|
||||||
if (!region->hasChunk(x & 31, z & 31))
|
if (!region->hasChunk(x & 31, z & 31))
|
||||||
{
|
{
|
||||||
FileInputStream fis = new BufferedInputStream(FileInputStream(*chunkFile->getFile()));
|
FileInputStream fis = new BufferedInputStream(FileInputStream(*chunkFile->getFile()));
|
||||||
DataInputStream istream = DataInputStream(&fis); // 4J - was new GZIPInputStream as well
|
DataInputStream istream = DataInputStream(&fis); // 4J - was new GZIPInputStream as well
|
||||||
|
|
@ -287,7 +286,7 @@ void McRegionLevelStorageSource::eraseFolders(std::vector<File*>* folders,
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// 4J - not required anymore
|
// 4J - not required anymore
|
||||||
bool McRegionLevelStorageSource::FolderFilter::accept(File *file)
|
bool McRegionLevelStorageSource::FolderFilter::accept(File *file)
|
||||||
{
|
{
|
||||||
if (file->isDirectory())
|
if (file->isDirectory())
|
||||||
{
|
{
|
||||||
|
|
@ -298,23 +297,23 @@ bool McRegionLevelStorageSource::FolderFilter::accept(File *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const std::wstring& name)
|
bool McRegionLevelStorageSource::ChunkFilter::accept(File *dir, const std::wstring& name)
|
||||||
{
|
{
|
||||||
Matcher matcher( chunkFilePattern, name );
|
Matcher matcher( chunkFilePattern, name );
|
||||||
return matcher.matches();
|
return matcher.matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
McRegionLevelStorageSource::ChunkFile::ChunkFile(File *file)
|
McRegionLevelStorageSource::ChunkFile::ChunkFile(File *file)
|
||||||
{
|
{
|
||||||
this->file = file;
|
this->file = file;
|
||||||
|
|
||||||
Matcher matcher( ChunkFilter::chunkFilePattern, file->getName() );
|
Matcher matcher( ChunkFilter::chunkFilePattern, file->getName() );
|
||||||
if (matcher.matches())
|
if (matcher.matches())
|
||||||
{
|
{
|
||||||
x = Integer::parseInt(matcher.group(1), 36);
|
x = Integer::parseInt(matcher.group(1), 36);
|
||||||
z = Integer::parseInt(matcher.group(2), 36);
|
z = Integer::parseInt(matcher.group(2), 36);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
@ -346,18 +345,18 @@ bool McRegionLevelStorageSource::ChunkFile::operator<( ChunkFile *b )
|
||||||
return compareTo( b ) < 0;
|
return compareTo( b ) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
File *McRegionLevelStorageSource::ChunkFile::getFile()
|
File *McRegionLevelStorageSource::ChunkFile::getFile()
|
||||||
{
|
{
|
||||||
return (File *) file;
|
return (File *) file;
|
||||||
}
|
}
|
||||||
|
|
||||||
int McRegionLevelStorageSource::ChunkFile::getX()
|
int McRegionLevelStorageSource::ChunkFile::getX()
|
||||||
{
|
{
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
int McRegionLevelStorageSource::ChunkFile::getZ()
|
int McRegionLevelStorageSource::ChunkFile::getZ()
|
||||||
{
|
{
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "PacketListener.h"
|
#include "PacketListener.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "CustomPayloadPacket.h"
|
#include "CustomPayloadPacket.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// Mojang-defined custom packets
|
// Mojang-defined custom packets
|
||||||
const std::wstring CustomPayloadPacket::CUSTOM_BOOK_PACKET = L"MC|BEdit";
|
const std::wstring CustomPayloadPacket::CUSTOM_BOOK_PACKET = L"MC|BEdit";
|
||||||
|
|
@ -25,7 +25,7 @@ CustomPayloadPacket::CustomPayloadPacket(const std::wstring& identifier,
|
||||||
if (data.data != NULL) {
|
if (data.data != NULL) {
|
||||||
length = data.length;
|
length = data.length;
|
||||||
|
|
||||||
if (length > Short::MAX_VALUE) {
|
if (length > std::numeric_limits<short>::max()) {
|
||||||
app.DebugPrintf("Payload may not be larger than 32K\n");
|
app.DebugPrintf("Payload may not be larger than 32K\n");
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
|
|
@ -40,7 +40,7 @@ void CustomPayloadPacket::read(DataInputStream* dis) {
|
||||||
identifier = readUtf(dis, 20);
|
identifier = readUtf(dis, 20);
|
||||||
length = dis->readShort();
|
length = dis->readShort();
|
||||||
|
|
||||||
if (length > 0 && length < Short::MAX_VALUE) {
|
if (length > 0 && length < std::numeric_limits<short>::max()) {
|
||||||
if (data.data != NULL) {
|
if (data.data != NULL) {
|
||||||
delete[] data.data;
|
delete[] data.data;
|
||||||
}
|
}
|
||||||
|
|
@ -63,4 +63,4 @@ void CustomPayloadPacket::handle(PacketListener* listener) {
|
||||||
|
|
||||||
int CustomPayloadPacket::getEstimatedSize() {
|
int CustomPayloadPacket::getEstimatedSize() {
|
||||||
return 2 + identifier.length() * 2 + 2 + length;
|
return 2 + identifier.length() * 2 + 2 + length;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "PacketListener.h"
|
#include "PacketListener.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "GameCommandPacket.h"
|
#include "GameCommandPacket.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
GameCommandPacket::GameCommandPacket() { length = 0; }
|
GameCommandPacket::GameCommandPacket() { length = 0; }
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ GameCommandPacket::GameCommandPacket(EGameCommand command, byteArray data) {
|
||||||
if (data.data != NULL) {
|
if (data.data != NULL) {
|
||||||
length = data.length;
|
length = data.length;
|
||||||
|
|
||||||
if (length > Short::MAX_VALUE) {
|
if (length > std::numeric_limits<short>::max()) {
|
||||||
app.DebugPrintf("Payload may not be larger than 32K\n");
|
app.DebugPrintf("Payload may not be larger than 32K\n");
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
__debugbreak();
|
__debugbreak();
|
||||||
|
|
@ -31,7 +31,7 @@ void GameCommandPacket::read(DataInputStream* dis) {
|
||||||
command = (EGameCommand)dis->readInt();
|
command = (EGameCommand)dis->readInt();
|
||||||
length = dis->readShort();
|
length = dis->readShort();
|
||||||
|
|
||||||
if (length > 0 && length < Short::MAX_VALUE) {
|
if (length > 0 && length < std::numeric_limits<short>::max()) {
|
||||||
if (data.data != NULL) {
|
if (data.data != NULL) {
|
||||||
delete[] data.data;
|
delete[] data.data;
|
||||||
}
|
}
|
||||||
|
|
@ -52,4 +52,4 @@ void GameCommandPacket::handle(PacketListener* listener) {
|
||||||
listener->handleGameCommand(shared_from_this());
|
listener->handleGameCommand(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
int GameCommandPacket::getEstimatedSize() { return 2 + 2 + length; }
|
int GameCommandPacket::getEstimatedSize() { return 2 + 2 + length; }
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "../../Headers/net.minecraft.network.packet.h"
|
#include "../../Headers/net.minecraft.network.packet.h"
|
||||||
#include "LevelSoundPacket.h"
|
#include "LevelSoundPacket.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
const float LevelSoundPacket::PITCH_ACCURACY = Byte::MAX_VALUE / 2.0f;
|
const float LevelSoundPacket::PITCH_ACCURACY =
|
||||||
|
std::numeric_limits<char>::max() / 2.0;
|
||||||
const float LevelSoundPacket::LOCATION_ACCURACY = 8.0f;
|
const float LevelSoundPacket::LOCATION_ACCURACY = 8.0f;
|
||||||
|
|
||||||
LevelSoundPacket::LevelSoundPacket() {
|
LevelSoundPacket::LevelSoundPacket() {
|
||||||
sound = 0;
|
sound = 0;
|
||||||
x = 0;
|
x = 0;
|
||||||
y = Integer::MAX_VALUE;
|
y = std::numeric_limits<int>::max();
|
||||||
z = 0;
|
z = 0;
|
||||||
volume = 0.0f;
|
volume = 0.0f;
|
||||||
pitch = 0;
|
pitch = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "../../Platform/stdafx.h"
|
#include "../../Platform/stdafx.h"
|
||||||
#include "../../Platform/System.h"
|
#include "../../Platform/System.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "../../Headers/net.minecraft.network.packet.h"
|
#include "../../Headers/net.minecraft.network.packet.h"
|
||||||
#include "PacketListener.h"
|
#include "PacketListener.h"
|
||||||
|
|
@ -483,7 +482,8 @@ void Packet::writeUtf(const std::wstring& value,
|
||||||
// should this declare a throws?
|
// should this declare a throws?
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (value.length() > Short::MAX_VALUE)
|
#include <limits>
|
||||||
|
if (value.length() > std::numeric_limits<short>::max())
|
||||||
{
|
{
|
||||||
throw new IOException(L"String too big");
|
throw new IOException(L"String too big");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
#include <limits>
|
||||||
#include "Packet.h"
|
#include "Packet.h"
|
||||||
|
|
||||||
class RemoveEntitiesPacket
|
class RemoveEntitiesPacket
|
||||||
: public Packet,
|
: public Packet,
|
||||||
public std::enable_shared_from_this<RemoveEntitiesPacket> {
|
public std::enable_shared_from_this<RemoveEntitiesPacket> {
|
||||||
public:
|
public:
|
||||||
static const int MAX_PER_PACKET = Byte::MAX_VALUE;
|
static const int MAX_PER_PACKET = std::numeric_limits<char>::max();
|
||||||
|
|
||||||
intArray ids;
|
intArray ids;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
#include "../../IO/Streams/InputOutputStream.h"
|
#include "../../IO/Streams/InputOutputStream.h"
|
||||||
#include "PacketListener.h"
|
#include "PacketListener.h"
|
||||||
#include "../../WorldGen/Features/BasicTreeFeature.h"
|
#include "../../WorldGen/Features/BasicTreeFeature.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "UpdateMobEffectPacket.h"
|
#include "UpdateMobEffectPacket.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
UpdateMobEffectPacket::UpdateMobEffectPacket() {
|
UpdateMobEffectPacket::UpdateMobEffectPacket() {
|
||||||
entityId = 0;
|
entityId = 0;
|
||||||
|
|
@ -19,8 +19,8 @@ UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId,
|
||||||
effectId = (BYTE)(effect->getId() & 0xff);
|
effectId = (BYTE)(effect->getId() & 0xff);
|
||||||
effectAmplifier = (char)(effect->getAmplifier() & 0xff);
|
effectAmplifier = (char)(effect->getAmplifier() & 0xff);
|
||||||
|
|
||||||
if (effect->getDuration() > Short::MAX_VALUE) {
|
if (effect->getDuration() > std::numeric_limits<short>::max()) {
|
||||||
effectDurationTicks = Short::MAX_VALUE;
|
effectDurationTicks = std::numeric_limits<short>::max();
|
||||||
} else {
|
} else {
|
||||||
effectDurationTicks = (short)effect->getDuration();
|
effectDurationTicks = (short)effect->getDuration();
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ void UpdateMobEffectPacket::write(DataOutputStream* dos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UpdateMobEffectPacket::isSuperLongDuration() {
|
bool UpdateMobEffectPacket::isSuperLongDuration() {
|
||||||
return effectDurationTicks == Short::MAX_VALUE;
|
return effectDurationTicks == std::numeric_limits<short>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateMobEffectPacket::handle(PacketListener* listener) {
|
void UpdateMobEffectPacket::handle(PacketListener* listener) {
|
||||||
|
|
@ -56,4 +56,4 @@ bool UpdateMobEffectPacket::isInvalidatedBy(std::shared_ptr<Packet> packet) {
|
||||||
std::shared_ptr<UpdateMobEffectPacket> target =
|
std::shared_ptr<UpdateMobEffectPacket> target =
|
||||||
std::dynamic_pointer_cast<UpdateMobEffectPacket>(packet);
|
std::dynamic_pointer_cast<UpdateMobEffectPacket>(packet);
|
||||||
return target->entityId == entityId && target->effectId == effectId;
|
return target->entityId == entityId && target->effectId == effectId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#include "../Platform/stdafx.h"
|
|
||||||
#include "BasicTypeContainers.h"
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
/* 4J Jev TODO,
|
|
||||||
this is different to Float::MAX_VALUE, javas floats
|
|
||||||
seem to actually allow values of infinity which c++ does not.
|
|
||||||
*/
|
|
||||||
// A constant holding the positive infinity of type float. It is equal to the
|
|
||||||
// value returned by Float.intBitsToFloat(0x7f800000).
|
|
||||||
const float Float::POSITIVE_INFINITY = 0x7f800000;
|
|
||||||
|
|
||||||
const float Float::MAX_VALUE = FLT_MAX;
|
|
||||||
|
|
||||||
const double Double::MAX_VALUE = DBL_MAX;
|
|
||||||
|
|
||||||
const double Double::MIN_NORMAL = DBL_MIN;
|
|
||||||
|
|
||||||
int Integer::parseInt(std::wstring& str, int radix /* = 10*/) {
|
|
||||||
return wcstol(str.c_str(), NULL, radix);
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <climits>
|
|
||||||
#include <cfloat>
|
|
||||||
|
|
||||||
class Byte {
|
|
||||||
public:
|
|
||||||
static const char MAX_VALUE = CHAR_MAX;
|
|
||||||
static const char MIN_VALUE = CHAR_MIN;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Short {
|
|
||||||
public:
|
|
||||||
static const short MAX_VALUE = SHRT_MAX;
|
|
||||||
static const short MIN_VALUE = SHRT_MIN;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Integer {
|
|
||||||
public:
|
|
||||||
static const int MAX_VALUE = INT_MAX;
|
|
||||||
static int parseInt(std::wstring& str, int radix = 10);
|
|
||||||
};
|
|
||||||
|
|
||||||
class Float {
|
|
||||||
public:
|
|
||||||
static const float MAX_VALUE;
|
|
||||||
static int floatToIntBits(float value) { return *(int*)&value; }
|
|
||||||
static int floatToRawIntBits(float value) { return *(int*)&value; }
|
|
||||||
|
|
||||||
static float intBitsToFloat(int bits) { return *(float*)&bits; }
|
|
||||||
|
|
||||||
static const float POSITIVE_INFINITY;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Double {
|
|
||||||
public:
|
|
||||||
static const double MAX_VALUE;
|
|
||||||
static const double MIN_NORMAL;
|
|
||||||
|
|
||||||
static bool isNaN(double a) {
|
|
||||||
#ifdef __PS3__
|
|
||||||
return isnan(a);
|
|
||||||
#else
|
|
||||||
return (a != a);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
static bool isInfinite(double a) { return false; /*4J TODO*/ }
|
|
||||||
|
|
||||||
static double longBitsToDouble(int64_t bits) { return *(double*)&bits; }
|
|
||||||
|
|
||||||
static int64_t doubleToLongBits(double d) { return *(int64_t*)&d; }
|
|
||||||
};
|
|
||||||
|
|
||||||
// 4J Stu - The String class should only be used if we need to use the
|
|
||||||
// BaseClass::class type As such I have renamed it so that we don't confuse it
|
|
||||||
// with places where we should use std::string
|
|
||||||
class _String {};
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "../AI/Navigation/Node.h"
|
#include "../AI/Navigation/Node.h"
|
||||||
#include "../Platform/System.h"
|
#include "../Platform/System.h"
|
||||||
#include "BasicTypeContainers.h"
|
|
||||||
#include "BinaryHeap.h"
|
#include "BinaryHeap.h"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
// 4J Jev, add common ctor code.
|
// 4J Jev, add common ctor code.
|
||||||
void BinaryHeap::_init() {
|
void BinaryHeap::_init() {
|
||||||
heap = NodeArray(1024);
|
heap = NodeArray(1024);
|
||||||
|
|
@ -113,7 +114,7 @@ void BinaryHeap::downHeap(int idx) {
|
||||||
if (rightIdx >= sizeVar) {
|
if (rightIdx >= sizeVar) {
|
||||||
// Only need to compare with left.
|
// Only need to compare with left.
|
||||||
rightNode = NULL;
|
rightNode = NULL;
|
||||||
rightCost = Float::POSITIVE_INFINITY;
|
rightCost = std::numeric_limits<float>::infinity();
|
||||||
} else {
|
} else {
|
||||||
rightNode = heap[rightIdx];
|
rightNode = heap[rightIdx];
|
||||||
rightCost = rightNode->f;
|
rightCost = rightNode->f;
|
||||||
|
|
@ -142,4 +143,4 @@ void BinaryHeap::downHeap(int idx) {
|
||||||
node->heapIdx = idx;
|
node->heapIdx = idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BinaryHeap::isEmpty() { return sizeVar == 0; }
|
bool BinaryHeap::isEmpty() { return sizeVar == 0; }
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "../AI/Navigation/Node.h"
|
#include "../AI/Navigation/Node.h"
|
||||||
#include "../Platform/System.h"
|
#include "../Platform/System.h"
|
||||||
#include "BasicTypeContainers.h"
|
|
||||||
|
|
||||||
class BinaryHeap {
|
class BinaryHeap {
|
||||||
private:
|
private:
|
||||||
|
|
@ -31,4 +30,4 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool isEmpty();
|
bool isEmpty();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#include "../Platform/stdafx.h"
|
#include "../Platform/stdafx.h"
|
||||||
#include "../Headers/net.minecraft.world.damagesource.h"
|
#include "../Headers/net.minecraft.world.damagesource.h"
|
||||||
#include "../Headers/net.minecraft.world.entity.h"
|
#include "../Headers/net.minecraft.world.entity.h"
|
||||||
#include "BasicTypeContainers.h"
|
|
||||||
#include "CombatEntry.h"
|
#include "CombatEntry.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
CombatEntry::CombatEntry(DamageSource* source, int time, float health,
|
CombatEntry::CombatEntry(DamageSource* source, int time, float health,
|
||||||
float damage, CombatTracker::eLOCATION location,
|
float damage, CombatTracker::eLOCATION location,
|
||||||
|
|
@ -45,6 +45,7 @@ std::wstring CombatEntry::getAttackerName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
float CombatEntry::getFallDistance() {
|
float CombatEntry::getFallDistance() {
|
||||||
if (source == DamageSource::outOfWorld) return Float::MAX_VALUE;
|
if (source == DamageSource::outOfWorld)
|
||||||
|
return std::numeric_limits<float>::max();
|
||||||
return fallDistance;
|
return fallDistance;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.tile.h"
|
#include "../../Headers/net.minecraft.world.level.tile.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "Village.h"
|
#include "Village.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
Village::Aggressor::Aggressor(std::shared_ptr<LivingEntity> mob,
|
Village::Aggressor::Aggressor(std::shared_ptr<LivingEntity> mob,
|
||||||
int timeStamp) {
|
int timeStamp) {
|
||||||
|
|
@ -159,7 +159,7 @@ std::vector<std::shared_ptr<DoorInfo> >* Village::getDoorInfos() {
|
||||||
|
|
||||||
std::shared_ptr<DoorInfo> Village::getClosestDoorInfo(int x, int y, int z) {
|
std::shared_ptr<DoorInfo> Village::getClosestDoorInfo(int x, int y, int z) {
|
||||||
std::shared_ptr<DoorInfo> closest = nullptr;
|
std::shared_ptr<DoorInfo> closest = nullptr;
|
||||||
int closestDistSqr = Integer::MAX_VALUE;
|
int closestDistSqr = std::numeric_limits<int>::max();
|
||||||
// for (DoorInfo dm : doorInfos)
|
// for (DoorInfo dm : doorInfos)
|
||||||
for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) {
|
for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) {
|
||||||
std::shared_ptr<DoorInfo> dm = *it;
|
std::shared_ptr<DoorInfo> dm = *it;
|
||||||
|
|
@ -174,7 +174,7 @@ std::shared_ptr<DoorInfo> Village::getClosestDoorInfo(int x, int y, int z) {
|
||||||
|
|
||||||
std::shared_ptr<DoorInfo> Village::getBestDoorInfo(int x, int y, int z) {
|
std::shared_ptr<DoorInfo> Village::getBestDoorInfo(int x, int y, int z) {
|
||||||
std::shared_ptr<DoorInfo> closest = nullptr;
|
std::shared_ptr<DoorInfo> closest = nullptr;
|
||||||
int closestDist = Integer::MAX_VALUE;
|
int closestDist = std::numeric_limits<int>::max();
|
||||||
// for (DoorInfo dm : doorInfos)
|
// for (DoorInfo dm : doorInfos)
|
||||||
for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) {
|
for (AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) {
|
||||||
std::shared_ptr<DoorInfo> dm = *it;
|
std::shared_ptr<DoorInfo> dm = *it;
|
||||||
|
|
@ -232,7 +232,7 @@ void Village::addAggressor(std::shared_ptr<LivingEntity> mob) {
|
||||||
|
|
||||||
std::shared_ptr<LivingEntity> Village::getClosestAggressor(
|
std::shared_ptr<LivingEntity> Village::getClosestAggressor(
|
||||||
std::shared_ptr<LivingEntity> from) {
|
std::shared_ptr<LivingEntity> from) {
|
||||||
double closestSqr = Double::MAX_VALUE;
|
double closestSqr = std::numeric_limits<double>::max();
|
||||||
Aggressor* closest = NULL;
|
Aggressor* closest = NULL;
|
||||||
// for (int i = 0; i < aggressors.size(); ++i)
|
// for (int i = 0; i < aggressors.size(); ++i)
|
||||||
for (AUTO_VAR(it, aggressors.begin()); it != aggressors.end(); ++it) {
|
for (AUTO_VAR(it, aggressors.begin()); it != aggressors.end(); ++it) {
|
||||||
|
|
@ -247,7 +247,7 @@ std::shared_ptr<LivingEntity> Village::getClosestAggressor(
|
||||||
|
|
||||||
std::shared_ptr<Player> Village::getClosestBadStandingPlayer(
|
std::shared_ptr<Player> Village::getClosestBadStandingPlayer(
|
||||||
std::shared_ptr<LivingEntity> from) {
|
std::shared_ptr<LivingEntity> from) {
|
||||||
double closestSqr = Double::MAX_VALUE;
|
double closestSqr = std::numeric_limits<double>::max();
|
||||||
std::shared_ptr<Player> closest = nullptr;
|
std::shared_ptr<Player> closest = nullptr;
|
||||||
|
|
||||||
// for (String player : playerStanding.keySet())
|
// for (String player : playerStanding.keySet())
|
||||||
|
|
@ -453,4 +453,4 @@ void Village::rewardAllPlayers(int amount) {
|
||||||
++it) {
|
++it) {
|
||||||
modifyStanding(it->first, amount);
|
modifyStanding(it->first, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
#include "../../Headers/net.minecraft.world.level.h"
|
#include "../../Headers/net.minecraft.world.level.h"
|
||||||
#include "../../Headers/net.minecraft.world.level.tile.h"
|
#include "../../Headers/net.minecraft.world.level.tile.h"
|
||||||
#include "../../Headers/net.minecraft.world.phys.h"
|
#include "../../Headers/net.minecraft.world.phys.h"
|
||||||
#include "../../Util/BasicTypeContainers.h"
|
|
||||||
#include "Villages.h"
|
#include "Villages.h"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
const std::wstring Villages::VILLAGE_FILE_ID = L"villages";
|
const std::wstring Villages::VILLAGE_FILE_ID = L"villages";
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ std::vector<std::shared_ptr<Village> >* Villages::getVillages() {
|
||||||
std::shared_ptr<Village> Villages::getClosestVillage(int x, int y, int z,
|
std::shared_ptr<Village> Villages::getClosestVillage(int x, int y, int z,
|
||||||
int maxDist) {
|
int maxDist) {
|
||||||
std::shared_ptr<Village> closest = nullptr;
|
std::shared_ptr<Village> closest = nullptr;
|
||||||
float closestDistSqr = Float::MAX_VALUE;
|
float closestDistSqr = std::numeric_limits<float>::max();
|
||||||
// for (Village village : villages)
|
// for (Village village : villages)
|
||||||
for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) {
|
for (AUTO_VAR(it, villages.begin()); it != villages.end(); ++it) {
|
||||||
std::shared_ptr<Village> village = *it;
|
std::shared_ptr<Village> village = *it;
|
||||||
|
|
@ -221,4 +221,4 @@ void Villages::save(CompoundTag* tag) {
|
||||||
villageTags->add(villageTag);
|
villageTags->add(villageTag);
|
||||||
}
|
}
|
||||||
tag->put(L"Villages", villageTags);
|
tag->put(L"Villages", villageTags);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue