refactor: split java libs and nbt into separate projects

This commit is contained in:
Tropical 2026-03-30 12:54:00 -05:00
parent 5c17c5c9ff
commit da1d6d8e97
535 changed files with 1286 additions and 1208 deletions

View file

@ -64,6 +64,9 @@ stb_dep = declare_dependency(include_directories: stb)
miniaudio_dep = dependency('miniaudio')
subdir('minecraft/java')
subdir('minecraft/nbt')
subdir('minecraft/4J.Render')
subdir('minecraft/4J.Input')
subdir('minecraft/4J.Profile')
@ -71,3 +74,4 @@ subdir('minecraft/4J.Storage')
subdir('minecraft/Minecraft.Assets')
subdir('minecraft/Minecraft.World')
subdir('minecraft/Minecraft.Client')

View file

@ -23,7 +23,7 @@
#include "Minecraft.World/net/minecraft/world/level/tile/entity/DispenserTileEntity.h"
#include "Minecraft.World/net/minecraft/world/level/tile/entity/SignTileEntity.h"
#include "Minecraft.World/net/minecraft/world/level/tile/entity/HopperTileEntity.h"
#include "Minecraft.World/Header Files/PathHelper.h"
#include "Minecraft.World/ConsoleHelpers/PathHelper.h"
#include "../net/minecraft/stats/StatsCounter.h"
#include "../net/minecraft/server/level/GameMode.h"
#include "../Windows64/Source Files/Social/SocialManager.h"
@ -37,7 +37,7 @@
#include "../net/minecraft/server/level/ServerPlayer.h"
#include "Source Files/GameRules/ConsoleGameRules.h"
#include "Source Files/GameRules/LevelGeneration/ConsoleSchematicFile.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/InputOutputStream.h"
#include "java/InputOutputStream/InputOutputStream.h"
#include "Minecraft.World/net/minecraft/world/level/LevelSettings.h"
#include "../net/minecraft/client/User.h"
#include <cstring>

View file

@ -6,7 +6,7 @@
#include <cstddef>
#include <mutex>
#include "Minecraft.World/ConsoleHelpers/C4JThread.h"
#include "../../Minecraft.World/ConsoleHelpers/C4JThread.h"
class ShutdownManager {
public:

View file

@ -20,6 +20,7 @@ typedef struct {
} AUDIO_LISTENER;
class Options;
class Mob;
class ConsoleSoundEngine {
public:

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "SoundEngine.h"
#include "Minecraft.World/Header Files/PathHelper.h"
#include "Minecraft.World/ConsoleHelpers/PathHelper.h"
#include "../../Consoles_App.h"
#include "../../../net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
@ -1111,8 +1111,8 @@ void SoundEngine::tick(std::shared_ptr<Mob>* players, float a) {
float yRot = players[i]->yRotO +
(players[i]->yRot - players[i]->yRotO) * a;
float yCos = (float)cos(-yRot * Mth::RAD_TO_GRAD - PI);
float ySin = (float)sin(-yRot * Mth::RAD_TO_GRAD - PI);
float yCos = (float)cos(-yRot * Mth::RAD_TO_GRAD - M_PI);
float ySin = (float)sin(-yRot * Mth::RAD_TO_GRAD - M_PI);
// store the listener positions for splitscreen
m_ListenerA[i].vPosition.x = x;

View file

@ -2,9 +2,9 @@
#include <string>
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "java/File.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/InputOutputStream.h"
#include "java/InputOutputStream/InputOutputStream.h"
#include "DLCManager.h"
#include "DLCGameRulesHeader.h"

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/Header Files/compression.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "java/File.h"
#include "Minecraft.World/Header Files/compression.h"
#include "../DLC/DLCPack.h"
#include "../DLC/DLCLocalisationFile.h"

View file

@ -1,9 +1,9 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include <vector>
#include "Minecraft.World/com/mojang/nbt/com.mojang.nbt.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "nbt/com.mojang.nbt.h"
#include "java/System.h"
#include "ConsoleSchematicFile.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/InputOutputStream.h"
#include "java/InputOutputStream/InputOutputStream.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
#include "Minecraft.World/net/minecraft/world/level/chunk/net.minecraft.world.level.chunk.h"
#include "Minecraft.World/net/minecraft/world/level/tile/entity/net.minecraft.world.level.tile.entity.h"

View file

@ -5,7 +5,7 @@
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/net/minecraft/world/phys/AABB.h"
#include "Minecraft.World/net/minecraft/world/phys/Vec3.h"
#include "Minecraft.World/ConsoleJavaLibs/Socket.h"
#include "Socket.h"
#include "Minecraft.World/ConsoleHelpers/ThreadName.h"
#include "Minecraft.World/net/minecraft/world/entity/Entity.h"
#include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h"

View file

@ -32,7 +32,7 @@ public:
virtual Socket* GetSocket() = 0;
virtual const wchar_t* GetOnlineName() = 0;
virtual std::wstring GetDisplayName() = 0;
virtual PlayerUID GetUID() = 0;
virtual unsigned long long GetUID() = 0;
virtual void SentChunkPacket() = 0;
virtual int GetTimeSinceLastChunkPacket_ms() = 0;
};

View file

@ -1,5 +1,5 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/ConsoleJavaLibs/Socket.h"
#include "Socket.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "NetworkPlayerQNet.h"
#include "PlatformNetworkManagerStub.h"

View file

@ -1,14 +1,15 @@
#include <thread>
#include <chrono>
#include "../Header Files/stdafx.h"
#include "InputOutputStream/InputOutputStream.h"
#include "SocketAddress.h"
#include "java/InputOutputStream/InputOutputStream.h"
#include "Socket.h"
#include "../ConsoleHelpers/ThreadName.h"
#include "Minecraft.Client/net/minecraft/server/network/ServerConnection.h"
#include <algorithm>
#include "Minecraft.Client/Common/ShutdownManager.h"
// 4jcraft TODO
#include "../../Minecraft.Client/Common/ShutdownManager.h"
#include "../../Minecraft.Client/net/minecraft/server/network/ServerConnection.h"
class SocketAddress {};
// This current socket implementation is for the creation of a single local
// link. 2 sockets can be created, one for either end of this local link, the
@ -76,7 +77,7 @@ Socket::Socket(bool response) {
if (s_serverConnection != nullptr) {
s_serverConnection->NewIncomingSocket(socket);
} else {
app.DebugPrintf(
fprintf(stderr,
"SOCKET: Warning - attempted to notify server of new incoming "
"socket but s_serverConnection is nullptr\n");
}
@ -137,7 +138,7 @@ void Socket::pushDataToQueue(const std::uint8_t* pbData, std::size_t dataSize,
if (!fromHost) queueIdx = SOCKET_SERVER_END;
if (queueIdx != m_end && !m_hostLocal) {
app.DebugPrintf(
fprintf(stderr,
"SOCKET: Error pushing data to queue. End is %d but queue idx id "
"%d\n",
m_end, queueIdx);
@ -171,7 +172,7 @@ InputStream* Socket::getInputStream(bool isServerConnection) {
}
} else {
if (s_hostInStream[m_end] == nullptr) {
app.DebugPrintf(
fprintf(stderr,
"SOCKET: Warning - s_hostInStream[%d] is nullptr in "
"getInputStream(); calling EnsureStreamsInitialised()\n",
m_end);
@ -199,7 +200,7 @@ Socket::SocketOutputStream* Socket::getOutputStream(bool isServerConnection) {
} else {
int outIdx = 1 - m_end;
if (s_hostOutStream[outIdx] == nullptr) {
app.DebugPrintf(
fprintf(stderr,
"SOCKET: Warning - s_hostOutStream[%d] is nullptr in "
"getOutputStream(); calling EnsureStreamsInitialised()\n",
outIdx);
@ -326,14 +327,14 @@ void Socket::SocketOutputStreamLocal::write(byteArray b, unsigned int offset,
if (m_streamOpen != true) {
return;
}
MemSect(12);
// MemSect(12);
{
std::lock_guard<std::mutex> lock(s_hostQueueLock[m_queueIdx]);
for (unsigned int i = 0; i < length; i++) {
s_hostQueue[m_queueIdx].push(b[offset + i]);
}
}
MemSect(0);
// MemSect(0);
}
void Socket::SocketOutputStreamLocal::close() {
@ -467,13 +468,13 @@ void Socket::SocketOutputStreamNetwork::writeWithFlags(byteArray b,
INetworkPlayer* hostPlayer = g_NetworkManager.GetHostPlayer();
if (hostPlayer == nullptr) {
app.DebugPrintf(
fprintf(stderr,
"Trying to write to network, but the hostPlayer is nullptr\n");
return;
}
INetworkPlayer* socketPlayer = m_socket->getPlayer();
if (socketPlayer == nullptr) {
app.DebugPrintf(
fprintf(stderr,
"Trying to write to network, but the socketPlayer is "
"nullptr\n");
return;

View file

@ -7,8 +7,13 @@
#endif
#include <mutex>
#include <queue>
#include "InputOutputStream/InputStream.h"
#include "InputOutputStream/OutputStream.h"
#include "java/InputOutputStream/InputStream.h"
#include "java/InputOutputStream/OutputStream.h"
#include "Minecraft.World/ConsoleHelpers/C4JThread.h" // 4jcraft TODO
#include "Minecraft.World/ConsoleHelpers/ThreadName.h" // 4jcraft TODO
#include "Minecraft.Client/Common/Source Files/Network/NetworkPlayerInterface.h"
#include "Minecraft.Client/Common/Source Files/Network/GameNetworkManager.h"
#define SOCKET_CLIENT_END 0
#define SOCKET_SERVER_END 1

View file

@ -535,7 +535,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
/*
*
*
* PISTON - SELF-REPAIRING BRIDGE
* M_PISTON - SELF-REPAIRING BRIDGE
*
*/
if (app.getGameRuleDefinitions() != nullptr) {
@ -555,7 +555,7 @@ FullTutorial::FullTutorial(int iPad, bool isTrial /*= false*/)
/*
*
*
* PISTON - PISTON AND REDSTONE CIRCUITS
* M_PISTON - PISTON AND REDSTONE CIRCUITS
*
*/
if (app.getGameRuleDefinitions() != nullptr) {

View file

@ -1,7 +1,7 @@
#pragma once
// using namespace std;
#include "Minecraft.World/ConsoleJavaLibs/Class.h"
#include "java/Class.h"
#include "TutorialHint.h"
class ItemInstance;

View file

@ -4,7 +4,7 @@
#include <vector>
#include <unordered_map>
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "java/File.h"
#include "Minecraft.World/ConsoleHelpers/ArrayWithLength.h"
class ArchiveFile {

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "IUIScene_AnvilMenu.h"
#include "Minecraft.World/net/minecraft/world/inventory/net.minecraft.world.inventory.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/InputOutputStream.h"
#include "java/InputOutputStream/InputOutputStream.h"
#include "Minecraft.World/net/minecraft/network/packet/net.minecraft.network.packet.h"
#include "../../../../net/minecraft/client/Minecraft.h"
#include "../../../../net/minecraft/client/multiplayer/MultiPlayerLocalPlayer.h"

View file

@ -168,7 +168,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
case ACTION_MENU_A:
// Do some crafting!
if (m_pPlayer && m_pPlayer->inventory) {
// RecipyList *recipes = ((Recipes
// std::vector<Recipy*> *recipes = ((Recipes
// *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
@ -627,7 +627,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() {
}
}
*/
RecipyList* recipes = ((Recipes*)Recipes::getInstance())->getRecipies();
std::vector<Recipy*>* recipes = ((Recipes*)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
int iRecipeC = (int)recipes->size();
@ -868,7 +868,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable() {
// run through the canbemade list and update the icons displayed
int iIndex = 0;
// RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
// std::vector<Recipy*> *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
@ -929,7 +929,7 @@ void IUIScene_CraftingMenu::UpdateHighlight() {
bool bCanBeMade = CanBeMadeA[m_iCurrentSlotHIndex].iCount != 0;
if (bCanBeMade) {
// RecipyList *recipes = ((Recipes
// std::vector<Recipy*> *recipes = ((Recipes
// *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
@ -990,7 +990,7 @@ void IUIScene_CraftingMenu::UpdateHighlight() {
//
//////////////////////////////////////////////////////////////////////////
void IUIScene_CraftingMenu::UpdateVerticalSlots() {
// RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
// std::vector<Recipy*> *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
@ -1061,7 +1061,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots() {
//
//////////////////////////////////////////////////////////////////////////
void IUIScene_CraftingMenu::DisplayIngredients() {
// RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
// std::vector<Recipy*> *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
@ -1228,7 +1228,7 @@ void IUIScene_CraftingMenu::DisplayIngredients() {
//////////////////////////////////////////////////////////////////////////
void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade) {
int iIDSString = 0;
// RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
// std::vector<Recipy*> *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
@ -1316,7 +1316,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade) {
//
//////////////////////////////////////////////////////////////////////////
void IUIScene_CraftingMenu::UpdateTooltips() {
// RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
// std::vector<Recipy*> *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();
// Update tooltips
@ -1398,7 +1398,7 @@ void IUIScene_CraftingMenu::HandleInventoryUpdated() {
bool IUIScene_CraftingMenu::isItemSelected(int itemId) {
bool isSelected = false;
if (m_pPlayer && m_pPlayer->inventory) {
// RecipyList *recipes = ((Recipes
// std::vector<Recipy*> *recipes = ((Recipes
// *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED* pRecipeIngredientsRequired =
Recipes::getInstance()->getRecipeIngredientsArray();

View file

@ -10,7 +10,7 @@
#include "Minecraft.World/net/minecraft/world/item/enchantment/net.minecraft.world.item.enchantment.h"
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
#include "Minecraft.World/net/minecraft/world/entity/animal/net.minecraft.world.entity.animal.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
// 4J JEV - Images for each tab.
IUIScene_CreativeMenu::TabSpec** IUIScene_CreativeMenu::specs = nullptr;

View file

@ -2,7 +2,7 @@
#include "../UI.h"
#include "UIControl.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
UIControl::UIControl() {
m_parentScene = nullptr;

View file

@ -2,7 +2,7 @@
#include "../UI.h"
#include "UIControl.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
UIControl_Base::UIControl_Base() {
m_bLabelChanged = false;

View file

@ -373,8 +373,8 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer* renderer, double x,
float yr = 1; // mob->yBodyRotO + (mob->yBodyRot - mob->yBodyRotO) * a;
double xa = sin(yr * PI / 180);
double za = -cos(yr * PI / 180);
double xa = sin(yr * M_PI / 180);
double za = -cos(yr * M_PI / 180);
float flap = (float)yd * 10;
if (flap < -6) flap = -6;

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/net/minecraft/util/Mth.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "../../../../../net/minecraft/client/User.h"
#include "../../../../../net/minecraft/server/MinecraftServer.h"
#include "../../UI.h"
@ -348,7 +348,7 @@ void UIScene_MainMenu::customDrawSplash(IggyCustomDrawCallbackRegion* region) {
glRotatef(-17, 0, 0, 1);
float sss = 1.8f - Mth::abs(Mth::sin(System::currentTimeMillis() % 1000 /
1000.0f * PI * 2) *
1000.0f * M_PI * 2) *
0.1f);
sss *= (m_fScreenWidth / m_fRawWidth);

View file

@ -2,7 +2,7 @@
#include "../../../UI.h"
#include "UIScene_CreativeMenu.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "../../../../../../net/minecraft/client/player/LocalPlayer.h"
#include "../../../../Tutorial/Tutorial.h"
#include "../../../../Tutorial/TutorialMode.h"

View file

@ -53,10 +53,10 @@ using namespace DirectX;
#include <assert.h>
#include "Minecraft.World/ConsoleHelpers/Definitions.h"
#include "Minecraft.World/ConsoleJavaLibs/Class.h"
#include "java/Class.h"
#include "Minecraft.World/ConsoleHelpers/ArrayWithLength.h"
#include "Minecraft.World/net/minecraft/SharedConstants.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "Minecraft.World/Header Files/compression.h"
#include "Minecraft.World/ConsoleHelpers/PerformanceTimer.h"

View file

@ -3,9 +3,9 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "4J_Render.h"
#include "Minecraft.World/ConsoleJavaLibs/IntBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/FloatBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/ByteBuffer.h"
#include "java/IntBuffer.h"
#include "java/FloatBuffer.h"
#include "java/ByteBuffer.h"
extern C4JRender RenderManager;

View file

@ -54,7 +54,7 @@ static void sigsegv_handler(int sig) {
#include "../net/minecraft/client/multiplayer/ClientConnection.h"
#include "../net/minecraft/client/User.h"
#include "Minecraft.World/ConsoleJavaLibs/Socket.h"
#include "Minecraft.Client/Common/Source Files/Network/Socket.h"
#include "Minecraft.World/ConsoleHelpers/ThreadName.h"
#include "../net/minecraft/stats/StatsCounter.h"
#include "../net/minecraft/client/multiplayer/ConnectScreen.h"

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "../net/minecraft/client/renderer/Textures.h"
#include "Minecraft.World/Header Files/PathHelper.h"
#include "Minecraft.World/ConsoleHelpers/PathHelper.h"
#include "Minecraft.World/ConsoleHelpers/ArrayWithLength.h"
#include "../Header Files/BufferedImage.h"
#if defined(__linux__)

View file

@ -2,9 +2,9 @@
#if !defined(__linux__)
#include "Minecraft.World/ConsoleJavaLibs/FloatBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/IntBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/ByteBuffer.h"
#include "java/FloatBuffer.h"
#include "java/IntBuffer.h"
#include "java/ByteBuffer.h"
void glViewport(int x, int y, int w, int h) {
// We don't really need anything here because minecraft doesn't current do
@ -16,7 +16,7 @@ void glTranslatef(float x, float y, float z) {
}
void glRotatef(float angle, float x, float y, float z) {
RenderManager.MatrixRotate(angle * (PI / 180.0f), x, y, z);
RenderManager.MatrixRotate(angle * (M_PI / 180.0f), x, y, z);
}
void glPopMatrix() { RenderManager.MatrixPop(); }

View file

@ -21,7 +21,7 @@
#include "../../net/minecraft/client/multiplayer/ClientConnection.h"
#include "../../net/minecraft/client/User.h"
#include "Minecraft.World/ConsoleJavaLibs/Socket.h"
#include "Minecraft.Client/Common/Source Files/Network/Socket.h"
#include "Minecraft.World/ConsoleHelpers/ThreadName.h"
#include "../../net/minecraft/stats/StatsCounter.h"
#include "../../net/minecraft/client/multiplayer/ConnectScreen.h"

View file

@ -46,6 +46,8 @@ if host_machine.system() == 'linux'
endif
client_dependencies = [
java_dep,
nbt_dep,
render_dep,
input_dep,
profile_dep,

View file

@ -63,12 +63,12 @@ zPlayerOffs = position->get(2);
float xRot = player->xRot;
float yRot = player->yRot;
xa = cosf(yRot * PI / 180.0f) * (1 - flipCamera * 2);
za = sinf(yRot * PI / 180.0f) * (1 - flipCamera * 2);
xa = cosf(yRot * M_PI / 180.0f) * (1 - flipCamera * 2);
za = sinf(yRot * M_PI / 180.0f) * (1 - flipCamera * 2);
xa2 = -za * sinf(xRot * PI / 180.0f) * (1 - flipCamera * 2);
za2 = xa * sinf(xRot * PI / 180.0f) * (1 - flipCamera * 2);
ya = cosf(xRot * PI / 180.0f);
xa2 = -za * sinf(xRot * M_PI / 180.0f) * (1 - flipCamera * 2);
za2 = xa * sinf(xRot * M_PI / 180.0f) * (1 - flipCamera * 2);
ya = cosf(xRot * M_PI / 180.0f);
}
TilePos* Camera::getCameraTilePos(std::shared_ptr<LivingEntity> player,

View file

@ -1,6 +1,6 @@
#pragma once
#include "Minecraft.World/ConsoleJavaLibs/FloatBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/IntBuffer.h"
#include "java/FloatBuffer.h"
#include "java/IntBuffer.h"
class TilePos;
class Vec3;

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Lighting.h"
#include "Minecraft.World/ConsoleJavaLibs/FloatBuffer.h"
#include "java/FloatBuffer.h"
#include "Minecraft.World/net/minecraft/world/phys/Vec3.h"
FloatBuffer* Lighting::lb = new FloatBuffer(16);

View file

@ -1,8 +1,8 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "MemoryTracker.h"
#include "Minecraft.World/ConsoleJavaLibs/IntBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/ByteBuffer.h"
#include "Minecraft.World/ConsoleJavaLibs/FloatBuffer.h"
#include "java/IntBuffer.h"
#include "java/ByteBuffer.h"
#include "java/FloatBuffer.h"
std::unordered_map<int, int> MemoryTracker::GL_LIST_IDS;
std::vector<int> MemoryTracker::TEXTURE_IDS;

View file

@ -48,12 +48,12 @@
#include "Minecraft.World/net/minecraft/world/entity/player/net.minecraft.world.entity.player.h"
#include "Minecraft.World/net/minecraft/world/entity/item/net.minecraft.world.entity.item.h"
#include "Minecraft.World/net/minecraft/world/phys/net.minecraft.world.phys.h"
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "java/File.h"
#include "Minecraft.World/net/minecraft/world/level/storage/net.minecraft.world.level.storage.h"
#include "Minecraft.World/net/minecraft/net.minecraft.h"
#include "Minecraft.World/net/minecraft/stats/net.minecraft.stats.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "Minecraft.World/ConsoleJavaLibs/ByteBuffer.h"
#include "java/System.h"
#include "java/ByteBuffer.h"
#include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h"
#include "Minecraft.World/net/minecraft/world/level/chunk/net.minecraft.world.level.chunk.h"
#include "Minecraft.World/net/minecraft/world/level/dimension/net.minecraft.world.level.dimension.h"

View file

@ -37,7 +37,7 @@ class ItemInHandRenderer;
class LevelSettings;
class ColourTable;
class MultiPlayerGameMode;
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "java/File.h"
#include "Minecraft.World/net/minecraft/network/packet/DisconnectPacket.h"
#include "Minecraft.World/ConsoleHelpers/C4JThread.h"
#include "resources/ResourceLocation.h"

View file

@ -5,13 +5,13 @@
#include "renderer/Textures.h"
#include "Minecraft.World/net/minecraft/locale/net.minecraft.locale.h"
#include "Minecraft.World/net/minecraft/locale/Language.h"
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/BufferedReader.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/DataInputStream.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/InputStreamReader.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/FileInputStream.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/FileOutputStream.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/DataOutputStream.h"
#include "java/File.h"
#include "java/InputOutputStream/BufferedReader.h"
#include "java/InputOutputStream/DataInputStream.h"
#include "java/InputOutputStream/InputStreamReader.h"
#include "java/InputOutputStream/FileInputStream.h"
#include "java/InputOutputStream/FileOutputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
// 4J - the Option sub-class used to be an java enumerated type, trying to

View file

@ -2,7 +2,7 @@
class Minecraft;
class KeyMapping;
#include "Minecraft.World/ConsoleJavaLibs/File.h"
#include "java/File.h"
class Options {
public:

View file

@ -2,7 +2,7 @@
#include "renderer/Tesselator.h"
#include "renderer/Textures.h"
#include "ProgressRenderer.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "java/System.h"
std::recursive_mutex ProgressRenderer::s_progress;

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Timer.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "java/System.h"
Timer::Timer(float ticksPerSecond) {
// 4J - added initialisers

View file

@ -8,7 +8,7 @@
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
#include "Minecraft.World/net/minecraft/world/level/storage/net.minecraft.world.level.storage.h"
#include "Minecraft.World/net/minecraft/SharedConstants.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "../../server/MinecraftServer.h"
#include "../Options.h"
#include "MessageScreen.h"

View file

@ -4,10 +4,10 @@
#include "../Options.h"
#include "../renderer/Tesselator.h"
#include "../resources/ResourceLocation.h"
#include "Minecraft.World/ConsoleJavaLibs/IntBuffer.h"
#include "java/IntBuffer.h"
#include "Minecraft.World/net/minecraft/net.minecraft.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
Font::Font(Options* options, const std::wstring& name, Textures* textures,
bool enforceUnicode, ResourceLocation* textureLocation, int cols,

View file

@ -10,7 +10,7 @@
#include "../Lighting.h"
#include "ChatScreen.h"
#include "../multiplayer/MultiPlayerLevel.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "Minecraft.World/net/minecraft/world/entity/player/net.minecraft.world.entity.player.h"
#include "Minecraft.World/net/minecraft/world/effect/net.minecraft.world.effect.h"
#include "Minecraft.World/net/minecraft/world/food/net.minecraft.world.food.h"
@ -18,7 +18,7 @@
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
#include "Minecraft.World/net/minecraft/world/level/storage/LevelData.h"
#include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "java/System.h"
#include "Minecraft.World/net/minecraft/locale/Language.h"
#include "../renderer/entity/EntityRenderDispatcher.h"
#include "Minecraft.World/net/minecraft/world/level/dimension/Dimension.h"

View file

@ -14,8 +14,8 @@
#include "Minecraft.World/net/minecraft/world/item/trading/net.minecraft.world.item.trading.h"
#include "../Minecraft.h"
#include "../multiplayer/ClientConnection.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/ByteArrayOutputStream.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/DataOutputStream.h"
#include "java/InputOutputStream/ByteArrayOutputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
#include "Minecraft.World/net/minecraft/world/item/Rarity.h"
// 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing

View file

@ -110,7 +110,7 @@ void PauseScreen::render(int xm, int ym, float a) {
bool isSaving = false; //! minecraft->level->pauseSave(saveStep++);
if (isSaving || visibleTime < 20) {
float col = ((visibleTime % 10) + a) / 10.0f;
col = Mth::sin(col * PI * 2) * 0.2f + 0.8f;
col = Mth::sin(col * M_PI * 2) * 0.2f + 0.8f;
int br = (int)(255 * col);
drawString(font, L"Saving level..", 8, height - 16,

View file

@ -3,7 +3,7 @@
#include "Button.h"
#include "../renderer/Tesselator.h"
#include "../renderer/Textures.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "java/System.h"
ScrolledSelectionList::ScrolledSelectionList(Minecraft* minecraft, int width,
int height, int y0, int y1,

View file

@ -4,7 +4,7 @@
#include "../Font.h"
#include "../../renderer/Textures.h"
#include "../../Lighting.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "java/System.h"
#include "Minecraft.World/net/minecraft/locale/net.minecraft.locale.h"
#include "Minecraft.World/net/minecraft/stats/net.minecraft.stats.h"
#include "Minecraft.World/net/minecraft/SharedConstants.h"

View file

@ -8,10 +8,10 @@
#include "../../renderer/Textures.h"
#include "../../../stats/StatsCounter.h"
#include "../../renderer/entity/ItemRenderer.h"
#include "Minecraft.World/ConsoleJavaLibs/System.h"
#include "java/System.h"
#include "Minecraft.World/net/minecraft/locale/net.minecraft.locale.h"
#include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
AchievementScreen::AchievementScreen(StatsCounter* statsCounter) {
// 4J - added initialisers

View file

@ -13,8 +13,8 @@
#include "Minecraft.World/net/minecraft/world/item/net.minecraft.world.item.h"
#include "../../Minecraft.h"
#include "../../multiplayer/ClientConnection.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/ByteArrayOutputStream.h"
#include "Minecraft.World/ConsoleJavaLibs/InputOutputStream/DataOutputStream.h"
#include "java/InputOutputStream/ByteArrayOutputStream.h"
#include "java/InputOutputStream/DataOutputStream.h"
// 4jcraft: referenced from MCP 8.11 (JE 1.6.4) and the existing
// container classes (and iggy too)

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "GuiParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
Random* GuiParticle::random = new Random();

View file

@ -61,25 +61,25 @@ void BatModel::render(std::shared_ptr<Entity> entity, float time, float r,
bool usecompiled) {
std::shared_ptr<Bat> bat = std::dynamic_pointer_cast<Bat>(entity);
if (bat->isResting()) {
float rad = 180 / PI;
float rad = 180 / M_PI;
head->xRot = xRot / rad;
head->yRot = PI - yRot / rad;
head->zRot = PI;
head->yRot = M_PI - yRot / rad;
head->zRot = M_PI;
head->setPos(0, -2, 0);
rightWing->setPos(-3, 0, 3);
leftWing->setPos(3, 0, 3);
body->xRot = PI;
body->xRot = M_PI;
rightWing->xRot = -PI * .05f;
rightWing->yRot = -PI * .40f;
rightWingTip->yRot = -PI * .55f;
rightWing->xRot = -M_PI * .05f;
rightWing->yRot = -M_PI * .40f;
rightWingTip->yRot = -M_PI * .55f;
leftWing->xRot = rightWing->xRot;
leftWing->yRot = -rightWing->yRot;
leftWingTip->yRot = -rightWingTip->yRot;
} else {
float rad = 180 / PI;
float rad = 180 / M_PI;
head->xRot = xRot / rad;
head->yRot = yRot / rad;
head->zRot = 0;
@ -88,10 +88,10 @@ void BatModel::render(std::shared_ptr<Entity> entity, float time, float r,
rightWing->setPos(0, 0, 0);
leftWing->setPos(0, 0, 0);
body->xRot = PI * .25f + cos(bob * .1f) * .15f;
body->xRot = M_PI * .25f + cos(bob * .1f) * .15f;
body->yRot = 0;
rightWing->yRot = cos(bob * 1.3f) * PI * .25f;
rightWing->yRot = cos(bob * 1.3f) * M_PI * .25f;
leftWing->yRot = -rightWing->yRot;
rightWingTip->yRot = rightWing->yRot * .5f;
leftWingTip->yRot = -rightWing->yRot * .5f;

View file

@ -40,29 +40,29 @@ void BlazeModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
float angle = bob * PI * -.1f;
float angle = bob * M_PI * -.1f;
for (int i = 0; i < 4; i++) {
upperBodyParts[i]->y = -2 + Mth::cos((i * 2 + bob) * .25f);
upperBodyParts[i]->x = Mth::cos(angle) * 9.0f;
upperBodyParts[i]->z = Mth::sin(angle) * 9.0f;
angle += PI * 0.5f;
angle += M_PI * 0.5f;
}
angle = .25f * PI + bob * PI * .03f;
angle = .25f * M_PI + bob * M_PI * .03f;
for (int i = 4; i < 8; i++) {
upperBodyParts[i]->y = 2 + Mth::cos((i * 2 + bob) * .25f);
upperBodyParts[i]->x = Mth::cos(angle) * 7.0f;
upperBodyParts[i]->z = Mth::sin(angle) * 7.0f;
angle += PI * 0.5f;
angle += M_PI * 0.5f;
}
angle = .15f * PI + bob * PI * -.05f;
angle = .15f * M_PI + bob * M_PI * -.05f;
for (int i = 8; i < 12; i++) {
upperBodyParts[i]->y = 11 + Mth::cos((i * 1.5f + bob) * .5f);
upperBodyParts[i]->x = Mth::cos(angle) * 5.0f;
upperBodyParts[i]->z = Mth::sin(angle) * 5.0f;
angle += PI * 0.5f;
angle += M_PI * 0.5f;
}
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / M_PI);
head->xRot = xRot / (float)(180 / M_PI);
}

View file

@ -28,10 +28,10 @@ BoatModel::BoatModel() : Model() {
cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1));
cubes[0]->xRot = PI / 2;
cubes[1]->yRot = PI / 2 * 3;
cubes[2]->yRot = PI / 2 * 1;
cubes[3]->yRot = PI / 2 * 2;
cubes[0]->xRot = M_PI / 2;
cubes[1]->yRot = M_PI / 2 * 3;
cubes[2]->yRot = M_PI / 2 * 1;
cubes[3]->yRot = M_PI / 2 * 2;
// 4J added - compile now to avoid random performance hit first time cubes
// are rendered

View file

@ -30,7 +30,7 @@ BookModel::BookModel() {
leftLid->setPos(0, 0, -1);
rightLid->setPos(0, 0, 1);
seam->yRot = PI / 2;
seam->yRot = M_PI / 2;
// 4J added - compile now to avoid random performance hit first time cubes
// are rendered
@ -65,7 +65,7 @@ void BookModel::setupAnim(float time, float r, float bob, float yRot,
unsigned int uiBitmaskOverrideAnim) {
float openness = (Mth::sin(time * 0.02f) * 0.10f + 1.25f) * yRot;
leftLid->yRot = PI + openness;
leftLid->yRot = M_PI + openness;
rightLid->yRot = -openness;
leftPages->yRot = +openness;
rightPages->yRot = -openness;

View file

@ -86,8 +86,8 @@ void ChickenModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / M_PI);
head->yRot = yRot / (float)(180 / M_PI);
beak->xRot = head->xRot;
beak->yRot = head->yRot;
@ -95,10 +95,10 @@ void ChickenModel::setupAnim(float time, float r, float bob, float yRot,
redThing->xRot = head->xRot;
redThing->yRot = head->yRot;
body->xRot = 90 / (float)(180 / PI);
body->xRot = 90 / (float)(180 / M_PI);
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
wing0->zRot = bob;
wing1->zRot = -bob;
}

View file

@ -67,11 +67,11 @@ void CreeperModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / M_PI);
head->xRot = xRot / (float)(180 / M_PI);
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg2->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
leg2->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
leg3->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
}

View file

@ -1,5 +1,5 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "Minecraft.World/net/minecraft/util/Mth.h"
#include "GhastModel.h"
#include "geom/ModelPart.h"

View file

@ -196,8 +196,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
// bool bIsAttacking = (attackTime > -9990.0f);
{
head->yRot = yRot / (float)(180.0f / PI);
head->xRot = xRot / (float)(180.0f / PI);
head->yRot = yRot / (float)(180.0f / M_PI);
head->xRot = xRot / (float)(180.0f / M_PI);
hair->yRot = head->yRot;
hair->xRot = head->xRot;
body->z = 0.0f;
@ -211,13 +211,13 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
arm1->zRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_ArmsOutFront)) {
arm0->xRot = -HALF_PI;
arm1->xRot = -HALF_PI;
arm0->xRot = -M_PI_2;
arm1->xRot = -M_PI_2;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_SingleArms)) {
arm0->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm1->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm0->xRot = (Mth::cos(time * 0.6662f + M_PI) * 2.0f) * r * 0.5f;
arm1->xRot = (Mth::cos(time * 0.6662f + M_PI) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
}
@ -225,12 +225,12 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
// that's up
else if ((uiBitmaskOverrideAnim & (1 << eAnim_StatueOfLiberty)) &&
(holdingRightHand == 0) && (attackTime == 0.0f)) {
arm0->xRot = -PI;
arm0->xRot = -M_PI ;
arm0->zRot = -0.3f;
arm1->xRot = (Mth::cos(time * 0.6662f) * 2.0f) * r * 0.5f;
arm1->zRot = 0.0f;
} else {
arm0->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f;
arm0->xRot = (Mth::cos(time * 0.6662f + M_PI) * 2.0f) * r * 0.5f;
arm1->xRot = (Mth::cos(time * 0.6662f) * 2.0f) * r * 0.5f;
arm0->zRot = 0.0f;
arm1->zRot = 0.0f;
@ -246,23 +246,23 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
if (riding) {
if ((uiBitmaskOverrideAnim & (1 << eAnim_SmallModel)) == 0) {
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;
leg0->xRot = -HALF_PI * 0.8f;
leg1->xRot = -HALF_PI * 0.8f;
leg0->yRot = HALF_PI * 0.2f;
leg1->yRot = -HALF_PI * 0.2f;
arm0->xRot += -M_PI_2 * 0.4f;
arm1->xRot += -M_PI_2 * 0.4f;
leg0->xRot = -M_PI_2 * 0.8f;
leg1->xRot = -M_PI_2 * 0.8f;
leg0->yRot = M_PI_2 * 0.2f;
leg1->yRot = -M_PI_2 * 0.2f;
} else {
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;
leg0->xRot = -HALF_PI * 0.4f;
leg1->xRot = -HALF_PI * 0.4f;
arm0->xRot += -M_PI_2 * 0.4f;
arm1->xRot += -M_PI_2 * 0.4f;
leg0->xRot = -M_PI_2 * 0.4f;
leg1->xRot = -M_PI_2 * 0.4f;
}
} else if (idle && !sneaking) {
leg0->xRot = -HALF_PI;
leg1->xRot = -HALF_PI;
leg0->yRot = HALF_PI * 0.2f;
leg1->yRot = -HALF_PI * 0.2f;
leg0->xRot = -M_PI_2;
leg1->xRot = -M_PI_2;
leg0->yRot = M_PI_2 * 0.2f;
leg1->yRot = -M_PI_2 * 0.2f;
} else if (uiBitmaskOverrideAnim & (1 << eAnim_NoLegAnim)) {
leg0->xRot = 0.0f;
leg0->zRot = 0.0f;
@ -275,21 +275,21 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
leg1->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
} else {
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
}
if (holdingLeftHand != 0) {
arm1->xRot = arm1->xRot * 0.5f - HALF_PI * 0.2f * holdingLeftHand;
arm1->xRot = arm1->xRot * 0.5f - M_PI_2 * 0.2f * holdingLeftHand;
}
if (holdingRightHand != 0) {
arm0->xRot = arm0->xRot * 0.5f - HALF_PI * 0.2f * holdingRightHand;
arm0->xRot = arm0->xRot * 0.5f - M_PI_2 * 0.2f * holdingRightHand;
}
arm0->yRot = 0.0f;
arm1->yRot = 0.0f;
if (attackTime > -9990.0f) {
float swing = attackTime;
body->yRot = Mth::sin(sqrt(swing) * PI * 2.0f) * 0.2f;
body->yRot = Mth::sin(sqrt(swing) * M_PI * 2.0f) * 0.2f;
arm0->z = Mth::sin(body->yRot) * 5.0f;
arm0->x = -Mth::cos(body->yRot) * 5.0f;
arm1->z = -Mth::sin(body->yRot) * 5.0f;
@ -302,16 +302,16 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
swing *= swing;
swing *= swing;
swing = 1.0f - swing;
float aa = Mth::sin(swing * PI);
float bb = Mth::sin(attackTime * PI) * -(head->xRot - 0.7f) * 0.75f;
float aa = Mth::sin(swing * M_PI);
float bb = Mth::sin(attackTime * M_PI) * -(head->xRot - 0.7f) * 0.75f;
arm0->xRot -= aa * 1.2f + bb; // 4J - changed 1.2 -> 1.2f
arm0->yRot += body->yRot * 2.0f;
if ((uiBitmaskOverrideAnim & (1 << eAnim_StatueOfLiberty)) &&
(holdingRightHand == 0) && (attackTime == 0.0f)) {
arm0->zRot -= Mth::sin(attackTime * PI) * -0.4f;
arm0->zRot -= Mth::sin(attackTime * M_PI) * -0.4f;
} else {
arm0->zRot = Mth::sin(attackTime * PI) * -0.4f;
arm0->zRot = Mth::sin(attackTime * M_PI) * -0.4f;
}
}
@ -324,7 +324,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
is = is * is * is;
is = is * is * is;
float iss = 1 - is;
arm0->xRot = -Mth::abs(Mth::cos(eating_t / 4.0f * PI) * 0.1f) *
arm0->xRot = -Mth::abs(Mth::cos(eating_t / 4.0f * M_PI) * 0.1f) *
(eating_swing > 0.2 ? 1.0f : 0.0f) *
2.0f; // This factor is the chomping bit (conditional
// factor is so that he doesn't eat whilst the
@ -413,8 +413,8 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot,
arm1->zRot = 0.0f;
arm0->yRot = -(0.1f - attack2 * 0.6f) + head->yRot;
arm1->yRot = +(0.1f - attack2 * 0.6f) + head->yRot + 0.4f;
arm0->xRot = -HALF_PI + head->xRot;
arm1->xRot = -HALF_PI + head->xRot;
arm0->xRot = -M_PI_2 + head->xRot;
arm1->xRot = -M_PI_2 + head->xRot;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;
arm0->zRot += ((float)(Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);

View file

@ -30,6 +30,6 @@ void LeashKnotModel::setupAnim(float time, float r, float bob, float yRot,
unsigned int uiBitmaskOverrideAnim) {
Model::setupAnim(time, r, bob, yRot, xRot, scale, entity);
knot->yRot = yRot / (180 / PI);
knot->xRot = xRot / (180 / PI);
knot->yRot = yRot / (180 / M_PI);
knot->xRot = xRot / (180 / M_PI);
}

View file

@ -34,11 +34,11 @@ MinecartModel::MinecartModel() : Model() {
cubes[4]->addBox((float)(-w / 2 + 2), (float)(-d - 1), -1, w - 4, d, 2, 0);
cubes[4]->setPos(0, (float)(0 + yOff), (float)(+h / 2 - 1));
cubes[0]->xRot = PI / 2;
cubes[1]->yRot = PI / 2 * 3;
cubes[2]->yRot = PI / 2 * 1;
cubes[3]->yRot = PI / 2 * 2;
cubes[5]->xRot = -PI / 2;
cubes[0]->xRot = M_PI / 2;
cubes[1]->yRot = M_PI / 2 * 3;
cubes[2]->yRot = M_PI / 2 * 1;
cubes[3]->yRot = M_PI / 2 * 2;
cubes[5]->xRot = -M_PI / 2;
// 4J added - compile now to avoid random performance hit first time cubes
// are rendered

View file

@ -491,8 +491,8 @@ void ModelHorse::prepareMobModel(std::shared_ptr<LivingEntity> mob, float wp,
MuleEarL->xRot = Head->xRot;
MuleEarR->xRot = Head->xRot;
Neck->xRot = Head->xRot;
UMouth->xRot = 0 - (PI * .03f) * openMouth;
LMouth->xRot = 0 + (PI * .05f) * openMouth;
UMouth->xRot = 0 - (M_PI * .03f) * openMouth;
LMouth->xRot = 0 + (M_PI * .05f) * openMouth;
Mane->xRot = Head->xRot;
@ -513,8 +513,8 @@ void ModelHorse::prepareMobModel(std::shared_ptr<LivingEntity> mob, float wp,
* knee joints Leg1 and Leg4 use LLegXRot Leg2 and Leg3 use RLegXRot
*/
{
float r90 = PI * .5f;
float r270 = PI * 1.5f;
float r90 = M_PI * .5f;
float r270 = M_PI * 1.5f;
float r300 = -60 * Mth::DEGRAD;
float standAngle = 15 * Mth::DEGRAD * standing;
float bobValue = Mth::cos((bob * 0.6f) + 3.141593f);
@ -567,14 +567,14 @@ void ModelHorse::prepareMobModel(std::shared_ptr<LivingEntity> mob, float wp,
Leg3A->xRot = rlegRot;
Leg3B->xRot =
(Leg3A->xRot + PI * std::max(0.0f, (.2f + bobValue * .2f))) *
(Leg3A->xRot + M_PI * std::max(0.0f, (.2f + bobValue * .2f))) *
standing +
(legXRotAnim + std::max(0.0f, legAnim1 * 0.5f * ws)) * iStanding;
Leg3C->xRot = Leg3B->xRot;
Leg4A->xRot = llegRot;
Leg4B->xRot =
(Leg4A->xRot + PI * std::max(0.0f, (.2f - bobValue * .2f))) *
(Leg4A->xRot + M_PI * std::max(0.0f, (.2f - bobValue * .2f))) *
standing +
(-legXRotAnim + std::max(0.0f, -legAnim1 * 0.5f * ws)) * iStanding;
Leg4C->xRot = Leg4B->xRot;

View file

@ -147,29 +147,29 @@ void OcelotModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / M_PI);
head->yRot = yRot / (float)(180 / M_PI);
if (state == SITTING_STATE) {
} else {
body->xRot = 90 / (float)(180 / PI);
body->xRot = 90 / (float)(180 / M_PI);
if (state == SPRINT_STATE) {
backLegL->xRot = ((float)Mth::cos(time * 0.6662f) * 1.f) * r;
backLegR->xRot = ((float)Mth::cos(time * 0.6662f + 0.3f) * 1.f) * r;
frontLegL->xRot =
((float)Mth::cos(time * 0.6662f + PI + 0.3f) * 1.f) * r;
frontLegR->xRot = ((float)Mth::cos(time * 0.6662f + PI) * 1.f) * r;
tail2->xRot = 0.55f * PI + 0.1f * PI * Mth::cos(time) * r;
((float)Mth::cos(time * 0.6662f + M_PI + 0.3f) * 1.f) * r;
frontLegR->xRot = ((float)Mth::cos(time * 0.6662f + M_PI) * 1.f) * r;
tail2->xRot = 0.55f * M_PI + 0.1f * M_PI * Mth::cos(time) * r;
} else {
backLegL->xRot = ((float)Mth::cos(time * 0.6662f) * 1.f) * r;
backLegR->xRot = ((float)Mth::cos(time * 0.6662f + PI) * 1.f) * r;
frontLegL->xRot = ((float)Mth::cos(time * 0.6662f + PI) * 1.f) * r;
backLegR->xRot = ((float)Mth::cos(time * 0.6662f + M_PI) * 1.f) * r;
frontLegL->xRot = ((float)Mth::cos(time * 0.6662f + M_PI) * 1.f) * r;
frontLegR->xRot = ((float)Mth::cos(time * 0.6662f) * 1.f) * r;
if (state == WALK_STATE)
tail2->xRot = 0.55f * PI + 0.25f * PI * Mth::cos(time) * r;
tail2->xRot = 0.55f * M_PI + 0.25f * M_PI * Mth::cos(time) * r;
else
tail2->xRot = 0.55f * PI + 0.15f * PI * Mth::cos(time) * r;
tail2->xRot = 0.55f * M_PI + 0.15f * M_PI * Mth::cos(time) * r;
}
}
}
@ -198,17 +198,17 @@ void OcelotModel::prepareMobModel(std::shared_ptr<LivingEntity> mob, float time,
tail1->y += 1;
tail2->y += -4;
tail2->z += 2;
tail1->xRot = 0.5f * PI;
tail2->xRot = 0.5f * PI;
tail1->xRot = 0.5f * M_PI;
tail2->xRot = 0.5f * M_PI;
state = SNEAK_STATE;
} else if (ozelot->isSprinting()) {
tail2->y = tail1->y;
tail2->z += 2;
tail1->xRot = 0.5f * PI;
tail2->xRot = 0.5f * PI;
tail1->xRot = 0.5f * M_PI;
tail2->xRot = 0.5f * M_PI;
state = SPRINT_STATE;
} else if (ozelot->isSitting()) {
body->xRot = 45 / (float)(180 / PI);
body->xRot = 45 / (float)(180 / M_PI);
body->y += -4;
body->z += 5;
head->y += -3.3f;
@ -218,14 +218,14 @@ void OcelotModel::prepareMobModel(std::shared_ptr<LivingEntity> mob, float time,
tail1->z += -2;
tail2->y += 2;
tail2->z += -0.8f;
tail1->xRot = PI * 0.55f;
tail2->xRot = PI * 0.85f;
tail1->xRot = M_PI * 0.55f;
tail2->xRot = M_PI * 0.85f;
frontLegL->xRot = frontLegR->xRot = -PI * 0.05f;
frontLegL->xRot = frontLegR->xRot = -M_PI * 0.05f;
frontLegL->y = frontLegR->y = frontLegY + 2;
frontLegL->z = frontLegR->z = -7;
backLegL->xRot = backLegR->xRot = -PI * 0.5f;
backLegL->xRot = backLegR->xRot = -M_PI * 0.5f;
backLegL->y = backLegR->y = backLegY + 3;
backLegL->z = backLegR->z = backLegZ - 4;
state = SITTING_STATE;

View file

@ -75,14 +75,14 @@ void QuadrupedModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
float rad = (float)(180 / PI);
float rad = (float)(180 / M_PI);
head->xRot = xRot / rad;
head->yRot = yRot / rad;
body->xRot = 90 / rad;
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg2->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
leg2->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
leg3->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
}

View file

@ -71,10 +71,10 @@ void SilverfishModel::setupAnim(float time, float r, float bob, float yRot,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
for (unsigned int i = 0; i < bodyParts.length; i++) {
bodyParts[i]->yRot = Mth::cos(bob * .9f + i * .15f * PI) * PI * .05f *
bodyParts[i]->yRot = Mth::cos(bob * .9f + i * .15f * M_PI) * M_PI * .05f *
(1 + abs((int)i - 2));
bodyParts[i]->x =
Mth::sin(bob * .9f + i * .15f * PI) * PI * .2f * abs((int)i - 2);
Mth::sin(bob * .9f + i * .15f * M_PI) * M_PI * .2f * abs((int)i - 2);
}
bodyLayers[0]->yRot = bodyParts[2]->yRot;

View file

@ -40,6 +40,6 @@ void SkeletonHeadModel::setupAnim(float time, float r, float bob, float yRot,
Model::setupAnim(time, r, bob, yRot, xRot, scale, entity,
uiBitmaskOverrideAnim);
head->yRot = yRot / (180 / PI);
head->xRot = xRot / (180 / PI);
head->yRot = yRot / (180 / M_PI);
head->xRot = xRot / (180 / M_PI);
}

View file

@ -36,10 +36,10 @@ void SkiModel::render(std::shared_ptr<Entity> entity, float time, float r,
void SkiModel::setupAnim(float time, float r, float bob, float yRot, float xRot,
float scale, std::shared_ptr<Entity> entity) {
cubes[0]->y = 24.2f;
cubes[0]->xRot = PI * .5f;
cubes[0]->xRot = M_PI * .5f;
cubes[1]->y = 24.2f;
cubes[1]->xRot = PI * .5f;
cubes[1]->xRot = M_PI * .5f;
if (leftSki) {
cubes[0]->z = -26 - 12 * (cos(time * 0.6662f) * 0.7f) * r;

View file

@ -41,9 +41,9 @@ void SnowManModel::setupAnim(float time, float r, float bob, float yRot,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
Model::setupAnim(time, r, bob, yRot, xRot, scale, entity);
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / PI);
piece1->yRot = (yRot / (float)(180 / PI)) * 0.25f;
head->yRot = yRot / (float)(180 / M_PI);
head->xRot = xRot / (float)(180 / M_PI);
piece1->yRot = (yRot / (float)(180 / M_PI)) * 0.25f;
float s = Mth::sin(piece1->yRot);
float c = Mth::cos(piece1->yRot);
@ -51,7 +51,7 @@ void SnowManModel::setupAnim(float time, float r, float bob, float yRot,
arm1->zRot = 1;
arm2->zRot = -1;
arm1->yRot = 0 + piece1->yRot;
arm2->yRot = PI + piece1->yRot;
arm2->yRot = M_PI + piece1->yRot;
arm1->x = (c) * 5;
arm1->z = (-s) * 5;

View file

@ -89,10 +89,10 @@ void SpiderModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / M_PI);
head->xRot = xRot / (float)(180 / M_PI);
float sr = (float)PI / 4.0f;
float sr = (float)M_PI / 4.0f;
leg0->zRot = -sr;
leg1->zRot = sr;
@ -105,8 +105,8 @@ void SpiderModel::setupAnim(float time, float r, float bob, float yRot,
leg6->zRot = -sr;
leg7->zRot = sr;
float ro = -(float)PI / 2.0f * 0;
float ur = (float)PI / 8.0f;
float ro = -(float)M_PI / 2.0f * 0;
float ur = (float)M_PI / 8.0f;
leg0->yRot = +ur * 2.0f + ro;
leg1->yRot = -ur * 2.0f - ro;
leg2->yRot = +ur * 1.0f + ro;
@ -117,22 +117,22 @@ void SpiderModel::setupAnim(float time, float r, float bob, float yRot,
leg7->yRot = +ur * 2.0f - ro;
float c0 =
-((float)Mth::cos(time * 0.6662f * 2 + PI * 2 * 0 / 4.0f) * 0.4f) * r;
-((float)Mth::cos(time * 0.6662f * 2 + M_PI * 2 * 0 / 4.0f) * 0.4f) * r;
float c1 =
-((float)Mth::cos(time * 0.6662f * 2 + PI * 2 * 2 / 4.0f) * 0.4f) * r;
-((float)Mth::cos(time * 0.6662f * 2 + M_PI * 2 * 2 / 4.0f) * 0.4f) * r;
float c2 =
-((float)Mth::cos(time * 0.6662f * 2 + PI * 2 * 1 / 4.0f) * 0.4f) * r;
-((float)Mth::cos(time * 0.6662f * 2 + M_PI * 2 * 1 / 4.0f) * 0.4f) * r;
float c3 =
-((float)Mth::cos(time * 0.6662f * 2 + PI * 2 * 3 / 4.0f) * 0.4f) * r;
-((float)Mth::cos(time * 0.6662f * 2 + M_PI * 2 * 3 / 4.0f) * 0.4f) * r;
float s0 =
abs((float)Mth::sin(time * 0.6662f + PI * 2 * 0 / 4.0f) * 0.4f) * r;
abs((float)Mth::sin(time * 0.6662f + M_PI * 2 * 0 / 4.0f) * 0.4f) * r;
float s1 =
abs((float)Mth::sin(time * 0.6662f + PI * 2 * 2 / 4.0f) * 0.4f) * r;
abs((float)Mth::sin(time * 0.6662f + M_PI * 2 * 2 / 4.0f) * 0.4f) * r;
float s2 =
abs((float)Mth::sin(time * 0.6662f + PI * 2 * 1 / 4.0f) * 0.4f) * r;
abs((float)Mth::sin(time * 0.6662f + M_PI * 2 * 1 / 4.0f) * 0.4f) * r;
float s3 =
abs((float)Mth::sin(time * 0.6662f + PI * 2 * 3 / 4.0f) * 0.4f) * r;
abs((float)Mth::sin(time * 0.6662f + M_PI * 2 * 3 / 4.0f) * 0.4f) * r;
leg0->yRot += +c0;
leg1->yRot += -c0;

View file

@ -13,7 +13,7 @@ SquidModel::SquidModel() : Model() {
{
tentacles[i] = new ModelPart(this, 48, 0);
double angle = i * PI * 2.0 /
double angle = i * M_PI * 2.0 /
(double)TENTACLES_LENGTH; // 4J - 8 was tentacles.length
float xo = Mth::cos((float)angle) * 5;
float yo = Mth::sin((float)angle) * 5;
@ -23,8 +23,8 @@ SquidModel::SquidModel() : Model() {
tentacles[i]->z = yo;
tentacles[i]->y = (float)(31 + yoffs);
angle = i * PI * -2.0 / (double)TENTACLES_LENGTH +
PI * .5; // 4J - 8 was tentacles.length
angle = i * M_PI * -2.0 / (double)TENTACLES_LENGTH +
M_PI * .5; // 4J - 8 was tentacles.length
tentacles[i]->yRot = (float)angle;
// 4J added - compile now to avoid random performance hit first time

View file

@ -52,8 +52,8 @@ void VillagerGolemModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / M_PI);
head->xRot = xRot / (float)(180 / M_PI);
leg0->xRot = (-1.5f * triangleWave(time, 13)) * r;
leg1->xRot = (1.5f * triangleWave(time, 13)) * r;

View file

@ -67,15 +67,15 @@ void VillagerModel::setupAnim(float time, float r, float bob, float yRot,
float xRot, float scale,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / M_PI);
head->xRot = xRot / (float)(180 / M_PI);
arms->y = 3;
arms->z = -1;
arms->xRot = -0.75f;
leg0->xRot = ((float)Mth::cos(time * 0.6662f) * 1.4f) * r * 0.5f;
leg1->xRot = ((float)Mth::cos(time * 0.6662f + PI) * 1.4f) * r * 0.5f;
leg1->xRot = ((float)Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r * 0.5f;
leg0->yRot = 0;
leg1->yRot = 0;
}

View file

@ -39,14 +39,14 @@ void VillagerZombieModel::setupAnim(float time, float r, float bob, float yRot,
HumanoidModel::setupAnim(time, r, bob, yRot, xRot, scale, entity,
uiBitmaskOverrideAnim);
float attack2 = Mth::sin(attackTime * PI);
float attack = Mth::sin((1 - (1 - attackTime) * (1 - attackTime)) * PI);
float attack2 = Mth::sin(attackTime * M_PI);
float attack = Mth::sin((1 - (1 - attackTime) * (1 - attackTime)) * M_PI);
arm0->zRot = 0;
arm1->zRot = 0;
arm0->yRot = -(0.1f - attack2 * 0.6f);
arm1->yRot = +(0.1f - attack2 * 0.6f);
arm0->xRot = -PI / 2.0f;
arm1->xRot = -PI / 2.0f;
arm0->xRot = -M_PI / 2.0f;
arm1->xRot = -M_PI / 2.0f;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;

View file

@ -57,9 +57,9 @@ void WitchModel::setupAnim(float time, float r, float bob, float yRot,
nose->translateX = nose->translateY = nose->translateZ = 0;
float speed = 0.01f * (entity->entityId % 10);
nose->xRot = (sin(entity->tickCount * speed) * 4.5f) * PI / 180;
nose->xRot = (sin(entity->tickCount * speed) * 4.5f) * M_PI / 180;
nose->yRot = 0;
nose->zRot = (cos(entity->tickCount * speed) * 2.5f) * PI / 180;
nose->zRot = (cos(entity->tickCount * speed) * 2.5f) * M_PI / 180;
if (holdingItem) {
nose->xRot = -0.9f;

View file

@ -56,14 +56,14 @@ void WitherBossModel::setupAnim(float time, float r, float bob, float yRot,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
float anim = cos(bob * .1f);
upperBodyParts[1]->xRot = (.065f + .05f * anim) * PI;
upperBodyParts[1]->xRot = (.065f + .05f * anim) * M_PI;
upperBodyParts[2]->setPos(-2.f, 6.9f + cos(upperBodyParts[1]->xRot) * 10.f,
-.5f + sin(upperBodyParts[1]->xRot) * 10.f);
upperBodyParts[2]->xRot = (.265f + .1f * anim) * PI;
upperBodyParts[2]->xRot = (.265f + .1f * anim) * M_PI;
heads[0]->yRot = yRot / (180 / PI);
heads[0]->xRot = xRot / (180 / PI);
heads[0]->yRot = yRot / (180 / M_PI);
heads[0]->xRot = xRot / (180 / M_PI);
}
void WitherBossModel::prepareMobModel(std::shared_ptr<LivingEntity> mob,
@ -73,7 +73,7 @@ void WitherBossModel::prepareMobModel(std::shared_ptr<LivingEntity> mob,
for (int i = 1; i < 3; i++) {
heads[i]->yRot =
(boss->getHeadYRot(i - 1) - mob->yBodyRot) / (180 / PI);
heads[i]->xRot = boss->getHeadXRot(i - 1) / (180 / PI);
(boss->getHeadYRot(i - 1) - mob->yBodyRot) / (180 / M_PI);
heads[i]->xRot = boss->getHeadXRot(i - 1) / (180 / M_PI);
}
}

View file

@ -104,26 +104,26 @@ void WolfModel::prepareMobModel(std::shared_ptr<LivingEntity> mob, float time,
if (wolf->isSitting()) {
upperBody->setPos(-1.0f, 11 + 13.0f - 8, -3);
upperBody->xRot = .40f * PI;
upperBody->yRot = .0f * PI;
upperBody->xRot = .40f * M_PI;
upperBody->yRot = .0f * M_PI;
body->setPos(0, 11 + 15 - legSize, 0);
body->xRot = .25f * PI;
body->xRot = .25f * M_PI;
tail->setPos(-1, 11 + 18 - legSize, 6);
leg0->setPos(-2.5f, 18 + 12 - legSize, 2);
leg0->xRot = 1.5f * PI;
leg0->xRot = 1.5f * M_PI;
leg1->setPos(.5f, 18 + 12 - legSize, 2);
leg1->xRot = 1.5f * PI;
leg1->xRot = 1.5f * M_PI;
leg2->xRot = 1.85f * PI;
leg2->xRot = 1.85f * M_PI;
leg2->setPos(-2.49f, 18 + 7.0f - legSize, -4);
leg3->xRot = 1.85f * PI;
leg3->xRot = 1.85f * M_PI;
leg3->setPos(.51f, 18 + 7.0f - legSize, -4);
} else {
body->setPos(0, 11 + 11 - legSize, 2);
body->xRot = 90 / (float)(180 / PI);
body->xRot = 90 / (float)(180 / M_PI);
upperBody->setPos(-1.0f, 11 + 11.0f - legSize, -3);
upperBody->xRot = body->xRot;
@ -136,8 +136,8 @@ void WolfModel::prepareMobModel(std::shared_ptr<LivingEntity> mob, float time,
leg3->setPos(.5f, 18 + 6 - legSize, -4);
leg0->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg2->xRot = (Mth::cos(time * 0.6662f + PI) * 1.4f) * r;
leg1->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
leg2->xRot = (Mth::cos(time * 0.6662f + M_PI) * 1.4f) * r;
leg3->xRot = (Mth::cos(time * 0.6662f) * 1.4f) * r;
}
@ -154,7 +154,7 @@ void WolfModel::setupAnim(float time, float r, float bob, float yRot,
std::shared_ptr<Entity> entity,
unsigned int uiBitmaskOverrideAnim) {
Model::setupAnim(time, r, bob, yRot, xRot, scale, entity);
head->xRot = xRot / (float)(180 / PI);
head->yRot = yRot / (float)(180 / PI);
head->xRot = xRot / (float)(180 / M_PI);
head->yRot = yRot / (float)(180 / M_PI);
tail->xRot = bob;
}

View file

@ -18,14 +18,14 @@ void ZombieModel::setupAnim(float time, float r, float bob, float yRot,
HumanoidModel::setupAnim(time, r, bob, yRot, xRot, scale, entity,
uiBitmaskOverrideAnim);
float attack2 = Mth::sin(attackTime * PI);
float attack = Mth::sin((1 - (1 - attackTime) * (1 - attackTime)) * PI);
float attack2 = Mth::sin(attackTime * M_PI);
float attack = Mth::sin((1 - (1 - attackTime) * (1 - attackTime)) * M_PI);
arm0->zRot = 0;
arm1->zRot = 0;
arm0->yRot = -(0.1f - attack2 * 0.6f);
arm1->yRot = +(0.1f - attack2 * 0.6f);
arm0->xRot = -(float)PI / 2.0f;
arm1->xRot = -(float)PI / 2.0f;
arm0->xRot = -(float)M_PI / 2.0f;
arm1->xRot = -(float)M_PI / 2.0f;
arm0->xRot -= attack2 * 1.2f - attack * 0.4f;
arm1->xRot -= attack2 * 1.2f - attack * 0.4f;
arm0->zRot += ((Mth::cos(bob * 0.09f)) * 0.05f + 0.05f);

View file

@ -119,9 +119,9 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
std::dynamic_pointer_cast<EnderDragon>(entity);
float ttt = dragon->oFlapTime + (dragon->flapTime - dragon->oFlapTime) * a;
jaw->xRot = (float)(Mth::sin(ttt * PI * 2) + 1) * 0.2f;
jaw->xRot = (float)(Mth::sin(ttt * M_PI * 2) + 1) * 0.2f;
float yo = (float)(Mth::sin(ttt * PI * 2 - 1) + 1);
float yo = (float)(Mth::sin(ttt * M_PI * 2 - 1) + 1);
yo = (yo * yo * 1 + yo * 2) * 0.05f;
glTranslatef(0, yo - 2.0f, -3);
@ -148,7 +148,7 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
yy += 2.0f;
float rr = 0;
float roff = ttt * PI * 2.0f;
float roff = ttt * M_PI * 2.0f;
yy = 20.0f;
zz = -12.0f;
double pComponents[3];
@ -158,14 +158,14 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
dragon->getLatencyPos(p, 5 - i, a);
rr = (float)Mth::cos(i * 0.45f + roff) * 0.15f;
neck->yRot = rotWrap(dragon->getHeadPartYRotDiff(i, start, p)) * PI /
neck->yRot = rotWrap(dragon->getHeadPartYRotDiff(i, start, p)) * M_PI /
180.0f * rotScale; // 4J replaced "p[0] - start[0] with
// call to getHeadPartYRotDiff
neck->xRot = rr + (float)(dragon->getHeadPartYOffset(i, start, p)) *
PI / 180.0f * rotScale *
M_PI / 180.0f * rotScale *
5.0f; // 4J replaced "p[1] - start[1]" with call
// to getHeadPartYOffset
neck->zRot = -rotWrap(p[0] - rot) * PI / 180.0f * rotScale;
neck->zRot = -rotWrap(p[0] - rot) * M_PI / 180.0f * rotScale;
neck->y = yy;
neck->z = zz;
@ -181,11 +181,11 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
head->x = xx;
dragon->getLatencyPos(p, 0, a);
head->yRot =
rotWrap(dragon->getHeadPartYRotDiff(6, start, p)) * PI / 180.0f *
rotWrap(dragon->getHeadPartYRotDiff(6, start, p)) * M_PI / 180.0f *
1; // 4J replaced "p[0] - start[0] with call to getHeadPartYRotDiff
head->xRot = (float)(dragon->getHeadPartYOffset(6, start, p)) * PI /
head->xRot = (float)(dragon->getHeadPartYOffset(6, start, p)) * M_PI /
180.0f * rotScale * 5.0f; // 4J Added
head->zRot = -rotWrap(p[0] - rot) * PI / 180 * 1;
head->zRot = -rotWrap(p[0] - rot) * M_PI / 180 * 1;
head->render(scale, usecompiled);
glPushMatrix();
glTranslatef(0, 1, 0);
@ -196,7 +196,7 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
glEnable(GL_CULL_FACE);
for (int i = 0; i < 2; i++) {
float flapTime = ttt * PI * 2;
float flapTime = ttt * M_PI * 2;
wing->xRot = 0.125f - (float)(Mth::cos(flapTime)) * 0.2f;
wing->yRot = 0.25f;
wing->zRot = (float)(Mth::sin(flapTime) + 0.125f) * 0.8f;
@ -221,8 +221,8 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
glCullFace(GL_BACK);
glDisable(GL_CULL_FACE);
rr = -(float)Mth::sin(ttt * PI * 2) * 0.0f;
roff = ttt * PI * 2;
rr = -(float)Mth::sin(ttt * M_PI * 2) * 0.0f;
roff = ttt * M_PI * 2;
yy = 10;
zz = 60;
xx = 0;
@ -230,9 +230,9 @@ void DragonModel::render(std::shared_ptr<Entity> entity, float time, float r,
for (int i = 0; i < 12; i++) {
dragon->getLatencyPos(p, 12 + i, a);
rr += Mth::sin(i * 0.45f + roff) * 0.05f;
neck->yRot = (rotWrap(p[0] - start[0]) * rotScale + 180) * PI / 180;
neck->xRot = rr + (float)(p[1] - start[1]) * PI / 180 * rotScale * 5;
neck->zRot = rotWrap(p[0] - rot) * PI / 180 * rotScale;
neck->yRot = (rotWrap(p[0] - start[0]) * rotScale + 180) * M_PI / 180;
neck->xRot = rr + (float)(p[1] - start[1]) * M_PI / 180 * rotScale * 5;
neck->zRot = rotWrap(p[0] - rot) * M_PI / 180 * rotScale;
neck->y = yy;
neck->z = zz;
neck->x = xx;

View file

@ -1,6 +1,6 @@
#pragma once
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "../../../../../Header Files/SkinBox.h"
class Mob;
class ModelPart;

View file

@ -3,7 +3,7 @@
#include "ModelPart.h"
#include "Cube.h"
const float ModelPart::RAD = (180.0f / PI);
const float ModelPart::RAD = (180.0f / M_PI);
void ModelPart::_init() {
xTexSize = 64.0f;

View file

@ -37,7 +37,7 @@
#include "Minecraft.World/net/minecraft/SharedConstants.h"
#include "Minecraft.World/net/minecraft/world/phys/AABB.h"
#include "Minecraft.World/net/minecraft/Pos.h"
#include "Minecraft.World/ConsoleJavaLibs/Socket.h"
#include "Minecraft.Client/Common/Source Files/Network/Socket.h"
#include "../Minecraft.h"
#include "../ProgressRenderer.h"
#include "../renderer/LevelRenderer.h"

View file

@ -3,7 +3,7 @@
#include "../../server/level/ServerChunkCache.h"
#include "Minecraft.World/net/minecraft/world/level/chunk/net.minecraft.world.level.chunk.h"
#include "Minecraft.World/net/minecraft/world/level/dimension/net.minecraft.world.level.dimension.h"
#include "Minecraft.World/ConsoleJavaLibs/Arrays.h"
#include "java/Arrays.h"
#include "Minecraft.World/ConsoleHelpers/StringHelpers.h"
#include "../../server/MinecraftServer.h"
#include "../../server/level/ServerLevel.h"

View file

@ -14,7 +14,7 @@
#include "Minecraft.World/net/minecraft/world/entity/item/PrimedTnt.h"
#include "Minecraft.World/net/minecraft/world/level/tile/Tile.h"
#include "Minecraft.World/net/minecraft/world/level/tile/entity/TileEntity.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
MultiPlayerLevel::ResetInfo::ResetInfo(int x, int y, int z, int tile,
int data) {

View file

@ -3,7 +3,7 @@
#include "Minecraft.World/ConsoleHelpers/HashExtension.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaIntHash.h"
#include "java/JavaIntHash.h"
class ClientConnection;
class MultiPlayerChunkCache;

View file

@ -1,5 +1,5 @@
#include "Minecraft.World/Header Files/stdafx.h"
// #include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "MultiPlayerLocalPlayer.h"
#include "ClientConnection.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"

View file

@ -1,8 +1,8 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "BubbleParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "Minecraft.World/net/minecraft/util/Mth.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
#include "Minecraft.World/net/minecraft/world/level/material/net.minecraft.world.level.material.h"

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "CritParticle.h"
#include "Minecraft.World/net/minecraft/world/entity/net.minecraft.world.entity.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "Minecraft.World/net/minecraft/world/phys/net.minecraft.world.phys.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "CritParticle2.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
void CritParticle2::_init(double xa, double ya, double za, float scale) {
xd *= 0.1f;

View file

@ -1,5 +1,5 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "DragonBreathParticle.h"
void DragonBreathParticle::init(Level* level, double x, double y, double z,

View file

@ -2,7 +2,7 @@
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
#include "Minecraft.World/net/minecraft/world/level/material/net.minecraft.world.level.material.h"
#include "Minecraft.World/net/minecraft/world/level/tile/net.minecraft.world.level.tile.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "Minecraft.World/net/minecraft/util/Mth.h"
#include "DripParticle.h"

View file

@ -1,5 +1,5 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "java/JavaMath.h"
#include "EnchantmentTableParticle.h"
EchantmentTableParticle::EchantmentTableParticle(Level* level, double x,

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "EnderParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/JavaMath.h"
#include "java/Random.h"
// 4J Stu - This class was originally "PortalParticle" but I have split the two
// uses of the particle End creatures/items (e.g. EnderMan, EyeOfEnder, etc) use

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "ExplodeParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/JavaMath.h"
#include "java/Random.h"
ExplodeParticle::ExplodeParticle(Level* level, double x, double y, double z,
double xa, double ya, double za)

View file

@ -246,10 +246,10 @@ void FireworksParticles::FireworksStarter::createParticleShape(
fadeColors, trail, flicker);
}
float baseAngle = random->nextFloat() * PI;
float baseAngle = random->nextFloat() * M_PI;
double angleMod = (flat ? .034 : .34);
for (int angleStep = 0; angleStep < 3; angleStep++) {
double angle = baseAngle + angleStep * PI * angleMod;
double angle = baseAngle + angleStep * M_PI * angleMod;
double ox = sx;
double oy = sy;
@ -434,7 +434,7 @@ void FireworksParticles::FireworksOverlayParticle::render(Tesselator* t,
float u1 = u0 + 32.0f / 128.0f;
float v0 = 16.0f / 128.0f;
float v1 = v0 + 32.0f / 128.0f;
float r = 7.1f * sin(((float)age + a - 1.0f) * .25f * PI);
float r = 7.1f * sin(((float)age + a - 1.0f) * .25f * M_PI);
alpha = 0.6f - ((float)age + a - 1.0f) * .25f * .5f;
float x = (float)(xo + (this->x - xo) * a - xOff);

View file

@ -1,6 +1,6 @@
#pragma once
#include "Particle.h"
#include "Minecraft.World/com/mojang/nbt/CompoundTag.h"
#include "nbt/CompoundTag.h"
class ParticleEngine;

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/JavaMath.h"
#include "java/Random.h"
#include "FlameParticle.h"
FlameParticle::FlameParticle(Level* level, double x, double y, double z,

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "HugeExplosionParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "../renderer/Textures.h"
#include "../renderer/Tesselator.h"
#include "../Lighting.h"

View file

@ -1,6 +1,6 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "HugeExplosionSeedParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/Random.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
HugeExplosionSeedParticle::HugeExplosionSeedParticle(Level* level, double x,

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "LavaParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/JavaMath.h"
#include "java/Random.h"
#include "Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
LavaParticle::LavaParticle(Level* level, double x, double y, double z)

View file

@ -1,7 +1,7 @@
#include "Minecraft.World/Header Files/stdafx.h"
#include "NetherPortalParticle.h"
#include "Minecraft.World/ConsoleJavaLibs/JavaMath.h"
#include "Minecraft.World/ConsoleJavaLibs/Random.h"
#include "java/JavaMath.h"
#include "java/Random.h"
#include "../Minecraft.h"
// 4J Stu - This class was originally "PortalParticle" but I have split the two

Some files were not shown because too many files have changed in this diff Show more