mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-04-05 23:13:33 +00:00
Compare commits
1 Commits
fix-ios-co
...
a45c01d013
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a45c01d013 |
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@@ -72,30 +72,6 @@ jobs:
|
|||||||
${{github.workspace}}/build/OpenAL32.dll
|
${{github.workspace}}/build/OpenAL32.dll
|
||||||
${{github.workspace}}/build/libz.dll
|
${{github.workspace}}/build/libz.dll
|
||||||
|
|
||||||
build-ios:
|
|
||||||
# credit to pengubow from deepfriedwaffles repo
|
|
||||||
name: Build iOS
|
|
||||||
runs-on: macos-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@main
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
cd project/iosproj
|
|
||||||
xcodebuild -scheme minecraftpe -derivedDataPath build -destination 'generic/platform=iOS' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
|
|
||||||
mkdir -p Payload
|
|
||||||
cp -R build/Build/Products/Debug-iphoneos/minecraftpe.app Payload/
|
|
||||||
zip -r minecraftpe.ipa Payload
|
|
||||||
rm -rf Payload
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@main
|
|
||||||
with:
|
|
||||||
name: minecraftpe-ios
|
|
||||||
path: project/iosproj/minecraftpe.ipa
|
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
name: Build Linux
|
name: Build Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -290,7 +266,8 @@ jobs:
|
|||||||
publish:
|
publish:
|
||||||
name: Publish
|
name: Publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ build-windows, build-ios, build-linux, build-android, build-web ]
|
needs: [ build-windows, build-linux, build-android, build-web ]
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -363,4 +340,4 @@ jobs:
|
|||||||
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip
|
||||||
@@ -39,6 +39,8 @@ if (${PLATFORM} STREQUAL "Desktop")
|
|||||||
set(EXTRA_LIBS pthread m)
|
set(EXTRA_LIBS pthread m)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include_directories("glad/include")
|
||||||
|
|
||||||
elseif (${PLATFORM} STREQUAL "Web")
|
elseif (${PLATFORM} STREQUAL "Web")
|
||||||
set(PLATFORM_CPP "PLATFORM_WEB")
|
set(PLATFORM_CPP "PLATFORM_WEB")
|
||||||
set(EXTRA_LIBS "idbfs.js")
|
set(EXTRA_LIBS "idbfs.js")
|
||||||
@@ -114,34 +116,38 @@ CPMAddPackage(
|
|||||||
# TODO: Clear this paths with *
|
# TODO: Clear this paths with *
|
||||||
file(GLOB SERVER_SOURCES
|
file(GLOB SERVER_SOURCES
|
||||||
"project/lib_projects/raknet/jni/RaknetSources/*.cpp"
|
"project/lib_projects/raknet/jni/RaknetSources/*.cpp"
|
||||||
"src/NinecraftApp.cpp"
|
|
||||||
"src/Performance.cpp"
|
"src/Performance.cpp"
|
||||||
"src/SharedConstants.cpp"
|
"src/SharedConstants.cpp"
|
||||||
|
"src/Minecraft.cpp"
|
||||||
|
"src/MinecraftServer.cpp"
|
||||||
|
"src/App.cpp"
|
||||||
|
"src/IPlatform.cpp"
|
||||||
|
|
||||||
"src/client/IConfigListener.cpp"
|
|
||||||
"src/client/Minecraft.cpp"
|
|
||||||
"src/client/OptionStrings.cpp"
|
|
||||||
"src/client/Option.cpp"
|
|
||||||
"src/client/Options.cpp"
|
|
||||||
"src/client/OptionsFile.cpp"
|
|
||||||
"src/client/ServerProfiler.cpp"
|
|
||||||
|
|
||||||
"src/client/gamemode/CreativeMode.cpp"
|
# "src/client/IConfigListener.cpp"
|
||||||
"src/client/gamemode/GameMode.cpp"
|
# "src/client/Minecraft.cpp"
|
||||||
"src/client/gamemode/SurvivalMode.cpp"
|
# "src/client/OptionStrings.cpp"
|
||||||
|
# "src/client/Option.cpp"
|
||||||
|
# "src/client/Options.cpp"
|
||||||
|
# "src/client/OptionsFile.cpp"
|
||||||
|
# "src/client/ServerProfiler.cpp"
|
||||||
|
|
||||||
"src/client/player/LocalPlayer.cpp"
|
# "src/client/gamemode/CreativeMode.cpp"
|
||||||
"src/client/player/RemotePlayer.cpp"
|
# "src/client/gamemode/GameMode.cpp"
|
||||||
"src/client/player/input/KeyboardInput.cpp"
|
# "src/client/gamemode/SurvivalMode.cpp"
|
||||||
|
|
||||||
|
# "src/client/player/LocalPlayer.cpp"
|
||||||
|
# "src/client/player/RemotePlayer.cpp"
|
||||||
|
# "src/client/player/input/KeyboardInput.cpp"
|
||||||
|
|
||||||
|
"src/gamemode/*.cpp"
|
||||||
|
|
||||||
"src/locale/I18n.cpp"
|
"src/locale/I18n.cpp"
|
||||||
|
|
||||||
"src/main.cpp"
|
|
||||||
"src/main_dedicated.cpp"
|
"src/main_dedicated.cpp"
|
||||||
|
|
||||||
"src/nbt/Tag.cpp"
|
"src/nbt/Tag.cpp"
|
||||||
|
|
||||||
"src/network/ClientSideNetworkHandler.cpp"
|
|
||||||
"src/network/NetEventCallback.cpp"
|
"src/network/NetEventCallback.cpp"
|
||||||
"src/network/Packet.cpp"
|
"src/network/Packet.cpp"
|
||||||
"src/network/RakNetInstance.cpp"
|
"src/network/RakNetInstance.cpp"
|
||||||
@@ -152,11 +158,7 @@ file(GLOB SERVER_SOURCES
|
|||||||
"src/platform/HttpClient.cpp"
|
"src/platform/HttpClient.cpp"
|
||||||
"src/platform/PngLoader.cpp"
|
"src/platform/PngLoader.cpp"
|
||||||
"src/platform/time.cpp"
|
"src/platform/time.cpp"
|
||||||
|
"src/platform/server/PlatformServer.cpp"
|
||||||
"src/platform/input/Controller.cpp"
|
|
||||||
"src/platform/input/Keyboard.cpp"
|
|
||||||
"src/platform/input/Mouse.cpp"
|
|
||||||
"src/platform/input/Multitouch.cpp"
|
|
||||||
|
|
||||||
"src/server/ArgumentsSettings.cpp"
|
"src/server/ArgumentsSettings.cpp"
|
||||||
"src/server/ServerLevel.cpp"
|
"src/server/ServerLevel.cpp"
|
||||||
@@ -369,7 +371,7 @@ if(${PLATFORM} MATCHES "Web")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Client
|
# Client
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM})
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" "${PLATFORM_CPP}")
|
||||||
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS})
|
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS})
|
||||||
|
|
||||||
if (OpenSSL_FOUND)
|
if (OpenSSL_FOUND)
|
||||||
|
|||||||
37
README.md
37
README.md
@@ -197,39 +197,4 @@ cmake --build .
|
|||||||
3. Run game:
|
3. Run game:
|
||||||
```
|
```
|
||||||
emrun --port 8080 .
|
emrun --port 8080 .
|
||||||
```
|
```
|
||||||
## iOS
|
|
||||||
### Xcode
|
|
||||||
> [Note!]
|
|
||||||
> There's a precompiled IPA artifact in the GitHub mirror under Actions for those who either don't have Macs or don't want to build themself. But if you want to build youself, you'll need a Mac with Xcode. Download Xcode from the Mac App Store.
|
|
||||||
|
|
||||||
### 1. Clone
|
|
||||||
Open your terminal and clone the repository
|
|
||||||
```bash
|
|
||||||
git clone https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
|
|
||||||
cd minecraft-pe-0.6.1
|
|
||||||
```
|
|
||||||
You can also build from the ios-support branch by checking out to it
|
|
||||||
```
|
|
||||||
git checkout ios-support
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Open in Xcode
|
|
||||||
|
|
||||||
The project file is in `minecraft-pe-0.6.1/project/iosproj/minecraftpe.xcodeproj`. Open it.
|
|
||||||
|
|
||||||
### 3. Configure Code Signing
|
|
||||||
|
|
||||||
Before you can deploy to an iPhone, you must sign the app with your own Apple Developer account:
|
|
||||||
|
|
||||||
1. Select the **minecraftpe** project in the left sidebar.
|
|
||||||
2. Go to **Signing & Capabilities**.
|
|
||||||
3. Change the **Bundle Identifier** to something unique (e.g., `com.yourname.mcpe`).
|
|
||||||
4. Select your **Team** from the dropdown menu.
|
|
||||||
|
|
||||||
### 4. Build and Run
|
|
||||||
|
|
||||||
1. Connect your iPhone via USB or LAN.
|
|
||||||
2. Select your device from the run destination menu at the top of Xcode.
|
|
||||||
3. Press **Cmd + R** (or the Play button).
|
|
||||||
4. **Note:** If you encounter a "Developer Mode" or "Untrusted Developer" error on your phone, go to **Settings > General > VPN & Device Management** to trust your certificate.
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
@@ -153,7 +153,6 @@ options.group.tweaks=Tweaks
|
|||||||
options.allowSprint=Allow sprint
|
options.allowSprint=Allow sprint
|
||||||
options.barOnTop=HUD above inventory
|
options.barOnTop=HUD above inventory
|
||||||
options.rpiCursor=Show Raspberry PI cursor
|
options.rpiCursor=Show Raspberry PI cursor
|
||||||
options.foliageTint=Tint Grass and Leaves
|
|
||||||
options.autoJump=Auto Jump
|
options.autoJump=Auto Jump
|
||||||
options.thirdperson=Third Person
|
options.thirdperson=Third Person
|
||||||
options.servervisible=Server Visible
|
options.servervisible=Server Visible
|
||||||
|
|||||||
@@ -209,8 +209,6 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/world/level/MobSpawner.cpp \
|
../../../src/world/level/MobSpawner.cpp \
|
||||||
../../../src/world/level/Region.cpp \
|
../../../src/world/level/Region.cpp \
|
||||||
../../../src/world/level/TickNextTickData.cpp \
|
../../../src/world/level/TickNextTickData.cpp \
|
||||||
../../../src/world/level/FoliageColor.cpp \
|
|
||||||
../../../src/world/level/GrassColor.cpp \
|
|
||||||
../../../src/world/level/biome/Biome.cpp \
|
../../../src/world/level/biome/Biome.cpp \
|
||||||
../../../src/world/level/biome/BiomeSource.cpp \
|
../../../src/world/level/biome/BiomeSource.cpp \
|
||||||
../../../src/world/level/chunk/LevelChunk.cpp \
|
../../../src/world/level/chunk/LevelChunk.cpp \
|
||||||
|
|||||||
@@ -183,8 +183,6 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/world/level/MobSpawner.cpp \
|
../../../src/world/level/MobSpawner.cpp \
|
||||||
../../../src/world/level/Region.cpp \
|
../../../src/world/level/Region.cpp \
|
||||||
../../../src/world/level/TickNextTickData.cpp \
|
../../../src/world/level/TickNextTickData.cpp \
|
||||||
../../../src/world/level/FoliageColor.cpp \
|
|
||||||
../../../src/world/level/GrassColor.cpp \
|
|
||||||
../../../src/world/level/biome/Biome.cpp \
|
../../../src/world/level/biome/Biome.cpp \
|
||||||
../../../src/world/level/biome/BiomeSource.cpp \
|
../../../src/world/level/biome/BiomeSource.cpp \
|
||||||
../../../src/world/level/chunk/LevelChunk.cpp \
|
../../../src/world/level/chunk/LevelChunk.cpp \
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
|
||||||
<dependencies>
|
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
|
|
||||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
|
||||||
</dependencies>
|
|
||||||
<scenes>
|
|
||||||
<!--View Controller-->
|
|
||||||
<scene sceneID="EHf-IW-A2E">
|
|
||||||
<objects>
|
|
||||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
|
||||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
|
|
||||||
<rect key="frame" x="0.0" y="626.5" width="375" height="20.5"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
||||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="minecraftpe" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
|
|
||||||
<rect key="frame" x="0.0" y="202" width="375" height="43"/>
|
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
|
||||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
|
|
||||||
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
|
|
||||||
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
|
|
||||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
|
|
||||||
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
|
|
||||||
</constraints>
|
|
||||||
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
|
|
||||||
</view>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="53" y="375"/>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
|
||||||
</document>
|
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A316B17517007ABBC6 /* GuiElement.cpp */; };
|
042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A316B17517007ABBC6 /* GuiElement.cpp */; };
|
||||||
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A516B17517007ABBC6 /* NinePatch.cpp */; };
|
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A516B17517007ABBC6 /* NinePatch.cpp */; };
|
||||||
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */; };
|
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A716B17517007ABBC6 /* OptionsGroup.cpp */; };
|
||||||
|
042A91B116B17517007ABBC6 /* OptionsPane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91A916B17517007ABBC6 /* OptionsPane.cpp */; };
|
||||||
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AB16B17517007ABBC6 /* TextBox.cpp */; };
|
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AB16B17517007ABBC6 /* TextBox.cpp */; };
|
||||||
044129071682FF9600B70EE6 /* MouseHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044129061682FF9600B70EE6 /* MouseHandler.cpp */; };
|
044129071682FF9600B70EE6 /* MouseHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 044129061682FF9600B70EE6 /* MouseHandler.cpp */; };
|
||||||
9D293CE716071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; };
|
9D293CE716071C08000305C8 /* CreateNewWorld_iphone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */; };
|
||||||
@@ -1146,33 +1147,6 @@
|
|||||||
D5F3B7DD14548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7C814548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib */; };
|
D5F3B7DD14548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7C814548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib */; };
|
||||||
D5F3B7DE14548E7900D25470 /* IASKSpecifierValuesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7C914548E7900D25470 /* IASKSpecifierValuesView.xib */; };
|
D5F3B7DE14548E7900D25470 /* IASKSpecifierValuesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7C914548E7900D25470 /* IASKSpecifierValuesView.xib */; };
|
||||||
D5F3B7E51454930400D25470 /* InAppSettings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7E41454930400D25470 /* InAppSettings.bundle */; };
|
D5F3B7E51454930400D25470 /* InAppSettings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = D5F3B7E41454930400D25470 /* InAppSettings.bundle */; };
|
||||||
F912B8CF2F6C3D5200BC60DF /* TextBox.h in Sources */ = {isa = PBXBuildFile; fileRef = 042A91AC16B17517007ABBC6 /* TextBox.h */; };
|
|
||||||
F99D341F2F736AA100DC153E /* HttpClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D341E2F736AA100DC153E /* HttpClient.cpp */; };
|
|
||||||
F99D34202F736AA100DC153E /* HttpClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D341E2F736AA100DC153E /* HttpClient.cpp */; };
|
|
||||||
F99D34232F736AD400DC153E /* TextOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34222F736AD400DC153E /* TextOption.cpp */; };
|
|
||||||
F99D34242F736AD400DC153E /* TextOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34222F736AD400DC153E /* TextOption.cpp */; };
|
|
||||||
F99D34272F736AFB00DC153E /* OptionsFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34262F736AFB00DC153E /* OptionsFile.cpp */; };
|
|
||||||
F99D34282F736AFB00DC153E /* OptionsFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34262F736AFB00DC153E /* OptionsFile.cpp */; };
|
|
||||||
F99D342B2F736B6F00DC153E /* OptionsItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342A2F736B6F00DC153E /* OptionsItem.cpp */; };
|
|
||||||
F99D342C2F736B6F00DC153E /* OptionsItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342A2F736B6F00DC153E /* OptionsItem.cpp */; };
|
|
||||||
F99D342F2F736BAD00DC153E /* ConsoleScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */; };
|
|
||||||
F99D34302F736BAD00DC153E /* ConsoleScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */; };
|
|
||||||
F99D34332F736BDA00DC153E /* CreditsScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34322F736BDA00DC153E /* CreditsScreen.cpp */; };
|
|
||||||
F99D34342F736BDA00DC153E /* CreditsScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34322F736BDA00DC153E /* CreditsScreen.cpp */; };
|
|
||||||
F99D34372F736C1000DC153E /* JoinByIPScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */; };
|
|
||||||
F99D34382F736C1000DC153E /* JoinByIPScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */; };
|
|
||||||
F99D343B2F736C3B00DC153E /* UsernameScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */; };
|
|
||||||
F99D343C2F736C3B00DC153E /* UsernameScreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */; };
|
|
||||||
F99D343F2F736C8400DC153E /* GuiElementContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */; };
|
|
||||||
F99D34402F736C8400DC153E /* GuiElementContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */; };
|
|
||||||
F99D34432F736F9400DC153E /* Option.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34422F736F9400DC153E /* Option.cpp */; };
|
|
||||||
F99D34442F736F9400DC153E /* Option.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34422F736F9400DC153E /* Option.cpp */; };
|
|
||||||
F99D34472F736FE800DC153E /* KeyOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34462F736FE800DC153E /* KeyOption.cpp */; };
|
|
||||||
F99D34482F736FE800DC153E /* KeyOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D34462F736FE800DC153E /* KeyOption.cpp */; };
|
|
||||||
F99D344B2F7370CF00DC153E /* Slider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D344A2F7370CF00DC153E /* Slider.cpp */; };
|
|
||||||
F99D344C2F7370CF00DC153E /* Slider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99D344A2F7370CF00DC153E /* Slider.cpp */; };
|
|
||||||
F99D344E2F7372A100DC153E /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F99D344D2F7372A100DC153E /* Launch Screen.storyboard */; };
|
|
||||||
F99D344F2F7372A100DC153E /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F99D344D2F7372A100DC153E /* Launch Screen.storyboard */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -1234,8 +1208,10 @@
|
|||||||
042A91A616B17517007ABBC6 /* NinePatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NinePatch.h; sourceTree = "<group>"; };
|
042A91A616B17517007ABBC6 /* NinePatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NinePatch.h; sourceTree = "<group>"; };
|
||||||
042A91A716B17517007ABBC6 /* OptionsGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsGroup.cpp; sourceTree = "<group>"; };
|
042A91A716B17517007ABBC6 /* OptionsGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsGroup.cpp; sourceTree = "<group>"; };
|
||||||
042A91A816B17517007ABBC6 /* OptionsGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsGroup.h; sourceTree = "<group>"; };
|
042A91A816B17517007ABBC6 /* OptionsGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsGroup.h; sourceTree = "<group>"; };
|
||||||
|
042A91A916B17517007ABBC6 /* OptionsPane.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionsPane.cpp; sourceTree = "<group>"; };
|
||||||
|
042A91AA16B17517007ABBC6 /* OptionsPane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsPane.h; sourceTree = "<group>"; };
|
||||||
042A91AB16B17517007ABBC6 /* TextBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBox.cpp; sourceTree = "<group>"; };
|
042A91AB16B17517007ABBC6 /* TextBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBox.cpp; sourceTree = "<group>"; };
|
||||||
042A91AC16B17517007ABBC6 /* TextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextBox.h; path = ../../src/client/gui/components/TextBox.h; sourceTree = SOURCE_ROOT; };
|
042A91AC16B17517007ABBC6 /* TextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBox.h; sourceTree = "<group>"; };
|
||||||
044129061682FF9600B70EE6 /* MouseHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseHandler.cpp; sourceTree = "<group>"; };
|
044129061682FF9600B70EE6 /* MouseHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseHandler.cpp; sourceTree = "<group>"; };
|
||||||
9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CreateNewWorld_iphone.xib; path = minecraftpe/dialogs/CreateNewWorld_iphone.xib; sourceTree = "<group>"; };
|
9D293CE616071C08000305C8 /* CreateNewWorld_iphone.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CreateNewWorld_iphone.xib; path = minecraftpe/dialogs/CreateNewWorld_iphone.xib; sourceTree = "<group>"; };
|
||||||
9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = worldname_iphone5_3.png; sourceTree = "<group>"; };
|
9D293CEA160720D6000305C8 /* worldname_iphone5_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = worldname_iphone5_3.png; sourceTree = "<group>"; };
|
||||||
@@ -2041,7 +2017,7 @@
|
|||||||
D5B50D6914CFF66F005F7284 /* Multitouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Multitouch.h; sourceTree = "<group>"; };
|
D5B50D6914CFF66F005F7284 /* Multitouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Multitouch.h; sourceTree = "<group>"; };
|
||||||
D5B50D6A14CFF66F005F7284 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = "<group>"; };
|
D5B50D6A14CFF66F005F7284 /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = "<group>"; };
|
||||||
D5B50D6B14CFF66F005F7284 /* time.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = time.cpp; sourceTree = "<group>"; };
|
D5B50D6B14CFF66F005F7284 /* time.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = time.cpp; sourceTree = "<group>"; };
|
||||||
D5B50D6C14CFF66F005F7284 /* time.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = time.h; sourceTree = "<group>"; };
|
D5B50D6C14CFF66F005F7284 /* time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time.h; sourceTree = "<group>"; };
|
||||||
D5B50E5614CFF66F005F7284 /* SharedConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedConstants.h; sourceTree = "<group>"; };
|
D5B50E5614CFF66F005F7284 /* SharedConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SharedConstants.h; sourceTree = "<group>"; };
|
||||||
D5B50E5714CFF66F005F7284 /* terrain_4444.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terrain_4444.h; sourceTree = "<group>"; };
|
D5B50E5714CFF66F005F7284 /* terrain_4444.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terrain_4444.h; sourceTree = "<group>"; };
|
||||||
D5B50E5814CFF66F005F7284 /* terrain_5551.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terrain_5551.h; sourceTree = "<group>"; };
|
D5B50E5814CFF66F005F7284 /* terrain_5551.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = terrain_5551.h; sourceTree = "<group>"; };
|
||||||
@@ -2432,31 +2408,6 @@
|
|||||||
D5F3B7C814548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IASKPSToggleSwitchSpecifierViewCell.xib; sourceTree = "<group>"; };
|
D5F3B7C814548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IASKPSToggleSwitchSpecifierViewCell.xib; sourceTree = "<group>"; };
|
||||||
D5F3B7C914548E7900D25470 /* IASKSpecifierValuesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IASKSpecifierValuesView.xib; sourceTree = "<group>"; };
|
D5F3B7C914548E7900D25470 /* IASKSpecifierValuesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IASKSpecifierValuesView.xib; sourceTree = "<group>"; };
|
||||||
D5F3B7E41454930400D25470 /* InAppSettings.bundle */ = {isa = PBXFileReference; explicitFileType = "wrapper.installer-pkg"; path = InAppSettings.bundle; sourceTree = "<group>"; };
|
D5F3B7E41454930400D25470 /* InAppSettings.bundle */ = {isa = PBXFileReference; explicitFileType = "wrapper.installer-pkg"; path = InAppSettings.bundle; sourceTree = "<group>"; };
|
||||||
F99D341D2F736AA100DC153E /* HttpClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = HttpClient.h; path = ../../src/platform/HttpClient.h; sourceTree = "<group>"; };
|
|
||||||
F99D341E2F736AA100DC153E /* HttpClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = HttpClient.cpp; path = ../../src/platform/HttpClient.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34212F736AD400DC153E /* TextOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TextOption.h; path = ../../src/client/gui/components/TextOption.h; sourceTree = "<group>"; };
|
|
||||||
F99D34222F736AD400DC153E /* TextOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = TextOption.cpp; path = ../../src/client/gui/components/TextOption.cpp; };
|
|
||||||
F99D34252F736AFB00DC153E /* OptionsFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsFile.h; path = ../../src/client/OptionsFile.h; sourceTree = "<group>"; sourceTree = "<group>"; };
|
|
||||||
F99D34262F736AFB00DC153E /* OptionsFile.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsFile.cpp; path = ../../src/client/OptionsFile.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34292F736B6F00DC153E /* OptionsItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionsItem.h; path = ../../src/client/gui/components/OptionsItem.h; sourceTree = "<group>"; };
|
|
||||||
F99D342A2F736B6F00DC153E /* OptionsItem.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = OptionsItem.cpp; path = ../../src/client/gui/components/OptionsItem.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D342D2F736BAD00DC153E /* ConsoleScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ConsoleScreen.h; path = ../../src/client/gui/screens/ConsoleScreen.h; sourceTree = "<group>"; };
|
|
||||||
F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = ConsoleScreen.cpp; path = ../../src/client/gui/screens/ConsoleScreen.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34312F736BDA00DC153E /* CreditsScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CreditsScreen.h; path = ../../src/client/gui/screens/CreditsScreen.h; sourceTree = "<group>"; };
|
|
||||||
F99D34322F736BDA00DC153E /* CreditsScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CreditsScreen.cpp; path = ../../src/client/gui/screens/CreditsScreen.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34352F736C1000DC153E /* JoinByIPScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JoinByIPScreen.h; path = ../../src/client/gui/screens/JoinByIPScreen.h; sourceTree = "<group>"; };
|
|
||||||
F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JoinByIPScreen.cpp; path = ../../src/client/gui/screens/JoinByIPScreen.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34392F736C3B00DC153E /* UsernameScreen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UsernameScreen.h; path = ../../src/client/gui/screens/UsernameScreen.h; sourceTree = "<group>"; };
|
|
||||||
F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UsernameScreen.cpp; path = ../../src/client/gui/screens/UsernameScreen.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D343D2F736C8400DC153E /* GuiElementContainer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GuiElementContainer.h; path = ../../src/client/gui/components/GuiElementContainer.h; sourceTree = "<group>"; };
|
|
||||||
F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = GuiElementContainer.cpp; path = ../../src/client/gui/components/GuiElementContainer.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34412F736F9400DC153E /* Option.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Option.h; path = ../../src/client/Option.h; sourceTree = "<group>"; };
|
|
||||||
F99D34422F736F9400DC153E /* Option.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Option.cpp; path = ../../src/client/Option.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34452F736FE800DC153E /* KeyOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = KeyOption.h; path = ../../src/client/gui/components/KeyOption.h; sourceTree = "<group>"; };
|
|
||||||
F99D34462F736FE800DC153E /* KeyOption.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = KeyOption.cpp; path = ../../src/client/gui/components/KeyOption.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D34492F7370CF00DC153E /* Slider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Slider.h; path = ../../src/client/gui/components/Slider.h; sourceTree = "<group>"; };
|
|
||||||
F99D344A2F7370CF00DC153E /* Slider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = Slider.cpp; path = ../../src/client/gui/components/Slider.cpp; sourceTree = "<group>"; };
|
|
||||||
F99D344D2F7372A100DC153E /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -3275,6 +3226,8 @@
|
|||||||
042A91A616B17517007ABBC6 /* NinePatch.h */,
|
042A91A616B17517007ABBC6 /* NinePatch.h */,
|
||||||
042A91A716B17517007ABBC6 /* OptionsGroup.cpp */,
|
042A91A716B17517007ABBC6 /* OptionsGroup.cpp */,
|
||||||
042A91A816B17517007ABBC6 /* OptionsGroup.h */,
|
042A91A816B17517007ABBC6 /* OptionsGroup.h */,
|
||||||
|
042A91A916B17517007ABBC6 /* OptionsPane.cpp */,
|
||||||
|
042A91AA16B17517007ABBC6 /* OptionsPane.h */,
|
||||||
042A91AB16B17517007ABBC6 /* TextBox.cpp */,
|
042A91AB16B17517007ABBC6 /* TextBox.cpp */,
|
||||||
042A91AC16B17517007ABBC6 /* TextBox.h */,
|
042A91AC16B17517007ABBC6 /* TextBox.h */,
|
||||||
D5B50C2814CFF66F005F7284 /* Button.cpp */,
|
D5B50C2814CFF66F005F7284 /* Button.cpp */,
|
||||||
@@ -4303,7 +4256,6 @@
|
|||||||
D5CF9C37144C225000E4244F = {
|
D5CF9C37144C225000E4244F = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
F99D344D2F7372A100DC153E /* Launch Screen.storyboard */,
|
|
||||||
D5E1BA9A1451C8A0007DCC4F /* Default@2x.png */,
|
D5E1BA9A1451C8A0007DCC4F /* Default@2x.png */,
|
||||||
9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */,
|
9D959AFF16036BEE00E23A6F /* Default-568h@2x.png */,
|
||||||
D5F07744145EF79B00EC30FB /* Default-Landscape~ipad.png */,
|
D5F07744145EF79B00EC30FB /* Default-Landscape~ipad.png */,
|
||||||
@@ -4315,30 +4267,6 @@
|
|||||||
D5CF9C45144C225000E4244F /* Frameworks */,
|
D5CF9C45144C225000E4244F /* Frameworks */,
|
||||||
D5CF9C43144C225000E4244F /* Products */,
|
D5CF9C43144C225000E4244F /* Products */,
|
||||||
D5B50C1614CFF66F005F7284 /* src */,
|
D5B50C1614CFF66F005F7284 /* src */,
|
||||||
F99D341D2F736AA100DC153E /* HttpClient.h */,
|
|
||||||
F99D341E2F736AA100DC153E /* HttpClient.cpp */,
|
|
||||||
F99D34212F736AD400DC153E /* TextOption.h */,
|
|
||||||
F99D34222F736AD400DC153E /* TextOption.cpp */,
|
|
||||||
F99D34252F736AFB00DC153E /* OptionsFile.h */,
|
|
||||||
F99D34262F736AFB00DC153E /* OptionsFile.cpp */,
|
|
||||||
F99D34292F736B6F00DC153E /* OptionsItem.h */,
|
|
||||||
F99D342A2F736B6F00DC153E /* OptionsItem.cpp */,
|
|
||||||
F99D342D2F736BAD00DC153E /* ConsoleScreen.h */,
|
|
||||||
F99D342E2F736BAD00DC153E /* ConsoleScreen.cpp */,
|
|
||||||
F99D34312F736BDA00DC153E /* CreditsScreen.h */,
|
|
||||||
F99D34322F736BDA00DC153E /* CreditsScreen.cpp */,
|
|
||||||
F99D34352F736C1000DC153E /* JoinByIPScreen.h */,
|
|
||||||
F99D34362F736C1000DC153E /* JoinByIPScreen.cpp */,
|
|
||||||
F99D34392F736C3B00DC153E /* UsernameScreen.h */,
|
|
||||||
F99D343A2F736C3B00DC153E /* UsernameScreen.cpp */,
|
|
||||||
F99D343D2F736C8400DC153E /* GuiElementContainer.h */,
|
|
||||||
F99D343E2F736C8400DC153E /* GuiElementContainer.cpp */,
|
|
||||||
F99D34412F736F9400DC153E /* Option.h */,
|
|
||||||
F99D34422F736F9400DC153E /* Option.cpp */,
|
|
||||||
F99D34452F736FE800DC153E /* KeyOption.h */,
|
|
||||||
F99D34462F736FE800DC153E /* KeyOption.cpp */,
|
|
||||||
F99D34492F7370CF00DC153E /* Slider.h */,
|
|
||||||
F99D344A2F7370CF00DC153E /* Slider.cpp */,
|
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -4599,16 +4527,10 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 0420;
|
LastUpgradeCheck = 0420;
|
||||||
TargetAttributes = {
|
|
||||||
D5CF9C41144C225000E4244F = {
|
|
||||||
DevelopmentTeam = PZUVNW8F2U;
|
|
||||||
ProvisioningStyle = Automatic;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
buildConfigurationList = D5CF9C3C144C225000E4244F /* Build configuration list for PBXProject "minecraftpe" */;
|
buildConfigurationList = D5CF9C3C144C225000E4244F /* Build configuration list for PBXProject "minecraftpe" */;
|
||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
developmentRegion = en;
|
developmentRegion = English;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
knownRegions = (
|
knownRegions = (
|
||||||
en,
|
en,
|
||||||
@@ -4677,7 +4599,6 @@
|
|||||||
D5B50A5614CFF492005F7284 /* pig.png in Resources */,
|
D5B50A5614CFF492005F7284 /* pig.png in Resources */,
|
||||||
D5B50A5814CFF492005F7284 /* sheep_fur.png in Resources */,
|
D5B50A5814CFF492005F7284 /* sheep_fur.png in Resources */,
|
||||||
D5B50A5A14CFF492005F7284 /* sheep.png in Resources */,
|
D5B50A5A14CFF492005F7284 /* sheep.png in Resources */,
|
||||||
F99D344F2F7372A100DC153E /* Launch Screen.storyboard in Resources */,
|
|
||||||
D5B50A5C14CFF492005F7284 /* skeleton.png in Resources */,
|
D5B50A5C14CFF492005F7284 /* skeleton.png in Resources */,
|
||||||
D5B50A5E14CFF492005F7284 /* spider.png in Resources */,
|
D5B50A5E14CFF492005F7284 /* spider.png in Resources */,
|
||||||
D5B50A6014CFF492005F7284 /* zombie.png in Resources */,
|
D5B50A6014CFF492005F7284 /* zombie.png in Resources */,
|
||||||
@@ -5014,7 +4935,6 @@
|
|||||||
D5ACF26F15C03DBF00E21C22 /* sand2.m4a in Resources */,
|
D5ACF26F15C03DBF00E21C22 /* sand2.m4a in Resources */,
|
||||||
D5ACF27115C03DBF00E21C22 /* sand3.m4a in Resources */,
|
D5ACF27115C03DBF00E21C22 /* sand3.m4a in Resources */,
|
||||||
D5ACF27315C03DBF00E21C22 /* sand4.m4a in Resources */,
|
D5ACF27315C03DBF00E21C22 /* sand4.m4a in Resources */,
|
||||||
F99D344E2F7372A100DC153E /* Launch Screen.storyboard in Resources */,
|
|
||||||
D5ACF27515C03DBF00E21C22 /* snow1.m4a in Resources */,
|
D5ACF27515C03DBF00E21C22 /* snow1.m4a in Resources */,
|
||||||
D5ACF27715C03DBF00E21C22 /* snow2.m4a in Resources */,
|
D5ACF27715C03DBF00E21C22 /* snow2.m4a in Resources */,
|
||||||
D5ACF27915C03DBF00E21C22 /* snow3.m4a in Resources */,
|
D5ACF27915C03DBF00E21C22 /* snow3.m4a in Resources */,
|
||||||
@@ -5091,22 +5011,18 @@
|
|||||||
D58BB544146A0B910002C9F5 /* IASKSettingsStore.m in Sources */,
|
D58BB544146A0B910002C9F5 /* IASKSettingsStore.m in Sources */,
|
||||||
D58BB545146A0B910002C9F5 /* IASKSettingsStoreFile.m in Sources */,
|
D58BB545146A0B910002C9F5 /* IASKSettingsStoreFile.m in Sources */,
|
||||||
D58BB546146A0B910002C9F5 /* IASKSettingsStoreUserDefaults.m in Sources */,
|
D58BB546146A0B910002C9F5 /* IASKSettingsStoreUserDefaults.m in Sources */,
|
||||||
F99D34232F736AD400DC153E /* TextOption.cpp in Sources */,
|
|
||||||
D58BB547146A0B910002C9F5 /* IASKSpecifier.m in Sources */,
|
D58BB547146A0B910002C9F5 /* IASKSpecifier.m in Sources */,
|
||||||
D58BB548146A0B910002C9F5 /* IASKPSSliderSpecifierViewCell.m in Sources */,
|
D58BB548146A0B910002C9F5 /* IASKPSSliderSpecifierViewCell.m in Sources */,
|
||||||
D58BB549146A0B910002C9F5 /* IASKPSTextFieldSpecifierViewCell.m in Sources */,
|
D58BB549146A0B910002C9F5 /* IASKPSTextFieldSpecifierViewCell.m in Sources */,
|
||||||
D58BB54A146A0B910002C9F5 /* IASKPSTitleValueSpecifierViewCell.m in Sources */,
|
D58BB54A146A0B910002C9F5 /* IASKPSTitleValueSpecifierViewCell.m in Sources */,
|
||||||
D58BB54B146A0B910002C9F5 /* IASKPSToggleSwitchSpecifierViewCell.m in Sources */,
|
D58BB54B146A0B910002C9F5 /* IASKPSToggleSwitchSpecifierViewCell.m in Sources */,
|
||||||
F99D343B2F736C3B00DC153E /* UsernameScreen.cpp in Sources */,
|
|
||||||
D58BB54C146A0B910002C9F5 /* IASKSlider.m in Sources */,
|
D58BB54C146A0B910002C9F5 /* IASKSlider.m in Sources */,
|
||||||
D58BB54D146A0B910002C9F5 /* IASKSwitch.m in Sources */,
|
D58BB54D146A0B910002C9F5 /* IASKSwitch.m in Sources */,
|
||||||
F99D34302F736BAD00DC153E /* ConsoleScreen.cpp in Sources */,
|
|
||||||
D58BB54E146A0B910002C9F5 /* IASKTextField.m in Sources */,
|
D58BB54E146A0B910002C9F5 /* IASKTextField.m in Sources */,
|
||||||
D58BB550146A0B910002C9F5 /* PVRTexture.m in Sources */,
|
D58BB550146A0B910002C9F5 /* PVRTexture.m in Sources */,
|
||||||
D5D43CC9146AF4B4002ED842 /* RenameMPWorldViewController.mm in Sources */,
|
D5D43CC9146AF4B4002ED842 /* RenameMPWorldViewController.mm in Sources */,
|
||||||
D5B50F7014CFF670005F7284 /* AppPlatform_iOS.mm in Sources */,
|
D5B50F7014CFF670005F7284 /* AppPlatform_iOS.mm in Sources */,
|
||||||
D5B50F7414CFF670005F7284 /* CreativeMode.cpp in Sources */,
|
D5B50F7414CFF670005F7284 /* CreativeMode.cpp in Sources */,
|
||||||
F99D34432F736F9400DC153E /* Option.cpp in Sources */,
|
|
||||||
D5B50F7614CFF670005F7284 /* GameMode.cpp in Sources */,
|
D5B50F7614CFF670005F7284 /* GameMode.cpp in Sources */,
|
||||||
D5B50F7814CFF670005F7284 /* Button.cpp in Sources */,
|
D5B50F7814CFF670005F7284 /* Button.cpp in Sources */,
|
||||||
D5B50F7A14CFF670005F7284 /* ImageButton.cpp in Sources */,
|
D5B50F7A14CFF670005F7284 /* ImageButton.cpp in Sources */,
|
||||||
@@ -5151,7 +5067,6 @@
|
|||||||
D5B50FC814CFF670005F7284 /* KeyboardInput.cpp in Sources */,
|
D5B50FC814CFF670005F7284 /* KeyboardInput.cpp in Sources */,
|
||||||
D5B50FCA14CFF670005F7284 /* TouchscreenInput.cpp in Sources */,
|
D5B50FCA14CFF670005F7284 /* TouchscreenInput.cpp in Sources */,
|
||||||
D5B50FCC14CFF670005F7284 /* LocalPlayer.cpp in Sources */,
|
D5B50FCC14CFF670005F7284 /* LocalPlayer.cpp in Sources */,
|
||||||
F99D34482F736FE800DC153E /* KeyOption.cpp in Sources */,
|
|
||||||
D5B50FCE14CFF670005F7284 /* Chunk.cpp in Sources */,
|
D5B50FCE14CFF670005F7284 /* Chunk.cpp in Sources */,
|
||||||
D5B50FD014CFF670005F7284 /* Frustum.cpp in Sources */,
|
D5B50FD014CFF670005F7284 /* Frustum.cpp in Sources */,
|
||||||
D5B50FD214CFF670005F7284 /* ChickenRenderer.cpp in Sources */,
|
D5B50FD214CFF670005F7284 /* ChickenRenderer.cpp in Sources */,
|
||||||
@@ -5210,7 +5125,6 @@
|
|||||||
D5B5113014CFF670005F7284 /* TripodCamera.cpp in Sources */,
|
D5B5113014CFF670005F7284 /* TripodCamera.cpp in Sources */,
|
||||||
D5B5113214CFF670005F7284 /* Mob.cpp in Sources */,
|
D5B5113214CFF670005F7284 /* Mob.cpp in Sources */,
|
||||||
D5B5113414CFF670005F7284 /* MobCategory.cpp in Sources */,
|
D5B5113414CFF670005F7284 /* MobCategory.cpp in Sources */,
|
||||||
F99D34282F736AFB00DC153E /* OptionsFile.cpp in Sources */,
|
|
||||||
D5B5113814CFF670005F7284 /* PathFinderMob.cpp in Sources */,
|
D5B5113814CFF670005F7284 /* PathFinderMob.cpp in Sources */,
|
||||||
D5B5113A14CFF670005F7284 /* Inventory.cpp in Sources */,
|
D5B5113A14CFF670005F7284 /* Inventory.cpp in Sources */,
|
||||||
D5B5113C14CFF670005F7284 /* Player.cpp in Sources */,
|
D5B5113C14CFF670005F7284 /* Player.cpp in Sources */,
|
||||||
@@ -5222,7 +5136,6 @@
|
|||||||
D5B5114814CFF670005F7284 /* Item.cpp in Sources */,
|
D5B5114814CFF670005F7284 /* Item.cpp in Sources */,
|
||||||
D5B5114A14CFF670005F7284 /* ItemInstance.cpp in Sources */,
|
D5B5114A14CFF670005F7284 /* ItemInstance.cpp in Sources */,
|
||||||
D5B5114C14CFF670005F7284 /* PickaxeItem.cpp in Sources */,
|
D5B5114C14CFF670005F7284 /* PickaxeItem.cpp in Sources */,
|
||||||
F99D344B2F7370CF00DC153E /* Slider.cpp in Sources */,
|
|
||||||
D5B5114E14CFF670005F7284 /* ShovelItem.cpp in Sources */,
|
D5B5114E14CFF670005F7284 /* ShovelItem.cpp in Sources */,
|
||||||
D5B5115014CFF670005F7284 /* Biome.cpp in Sources */,
|
D5B5115014CFF670005F7284 /* Biome.cpp in Sources */,
|
||||||
D5B5115214CFF670005F7284 /* BiomeSource.cpp in Sources */,
|
D5B5115214CFF670005F7284 /* BiomeSource.cpp in Sources */,
|
||||||
@@ -5273,7 +5186,6 @@
|
|||||||
D5251DBA1538192700FC82C8 /* CloudServer.cpp in Sources */,
|
D5251DBA1538192700FC82C8 /* CloudServer.cpp in Sources */,
|
||||||
D5251DBE1538192700FC82C8 /* CommandParserInterface.cpp in Sources */,
|
D5251DBE1538192700FC82C8 /* CommandParserInterface.cpp in Sources */,
|
||||||
D5251DC01538192700FC82C8 /* ConnectionGraph2.cpp in Sources */,
|
D5251DC01538192700FC82C8 /* ConnectionGraph2.cpp in Sources */,
|
||||||
F99D34402F736C8400DC153E /* GuiElementContainer.cpp in Sources */,
|
|
||||||
D5251DC21538192700FC82C8 /* ConsoleServer.cpp in Sources */,
|
D5251DC21538192700FC82C8 /* ConsoleServer.cpp in Sources */,
|
||||||
D5251DC41538192700FC82C8 /* DataCompressor.cpp in Sources */,
|
D5251DC41538192700FC82C8 /* DataCompressor.cpp in Sources */,
|
||||||
D5251DC61538192700FC82C8 /* DirectoryDeltaTransfer.cpp in Sources */,
|
D5251DC61538192700FC82C8 /* DirectoryDeltaTransfer.cpp in Sources */,
|
||||||
@@ -5298,8 +5210,6 @@
|
|||||||
D5251DEC1538192700FC82C8 /* HTTPConnection.cpp in Sources */,
|
D5251DEC1538192700FC82C8 /* HTTPConnection.cpp in Sources */,
|
||||||
D5251DEE1538192700FC82C8 /* IncrementalReadInterface.cpp in Sources */,
|
D5251DEE1538192700FC82C8 /* IncrementalReadInterface.cpp in Sources */,
|
||||||
D5251DF01538192700FC82C8 /* Itoa.cpp in Sources */,
|
D5251DF01538192700FC82C8 /* Itoa.cpp in Sources */,
|
||||||
F99D34202F736AA100DC153E /* HttpClient.cpp in Sources */,
|
|
||||||
F99D34382F736C1000DC153E /* JoinByIPScreen.cpp in Sources */,
|
|
||||||
D5251DF21538192700FC82C8 /* LinuxStrings.cpp in Sources */,
|
D5251DF21538192700FC82C8 /* LinuxStrings.cpp in Sources */,
|
||||||
D5251DF41538192700FC82C8 /* LocklessTypes.cpp in Sources */,
|
D5251DF41538192700FC82C8 /* LocklessTypes.cpp in Sources */,
|
||||||
D5251DF61538192700FC82C8 /* LogCommandParser.cpp in Sources */,
|
D5251DF61538192700FC82C8 /* LogCommandParser.cpp in Sources */,
|
||||||
@@ -5328,7 +5238,6 @@
|
|||||||
D5251E2A1538192700FC82C8 /* RakSleep.cpp in Sources */,
|
D5251E2A1538192700FC82C8 /* RakSleep.cpp in Sources */,
|
||||||
D5251E2C1538192700FC82C8 /* RakString.cpp in Sources */,
|
D5251E2C1538192700FC82C8 /* RakString.cpp in Sources */,
|
||||||
D5251E2E1538192700FC82C8 /* RakThread.cpp in Sources */,
|
D5251E2E1538192700FC82C8 /* RakThread.cpp in Sources */,
|
||||||
F99D34332F736BDA00DC153E /* CreditsScreen.cpp in Sources */,
|
|
||||||
D5251E301538192700FC82C8 /* RakWString.cpp in Sources */,
|
D5251E301538192700FC82C8 /* RakWString.cpp in Sources */,
|
||||||
D5251E321538192700FC82C8 /* Rand.cpp in Sources */,
|
D5251E321538192700FC82C8 /* Rand.cpp in Sources */,
|
||||||
D5251E341538192700FC82C8 /* rdlmalloc.cpp in Sources */,
|
D5251E341538192700FC82C8 /* rdlmalloc.cpp in Sources */,
|
||||||
@@ -5371,7 +5280,6 @@
|
|||||||
D5951EEB159349100043A12A /* TileEntity.cpp in Sources */,
|
D5951EEB159349100043A12A /* TileEntity.cpp in Sources */,
|
||||||
D5951EEF159349680043A12A /* FurnaceScreen.cpp in Sources */,
|
D5951EEF159349680043A12A /* FurnaceScreen.cpp in Sources */,
|
||||||
D5951EF215934A2D0043A12A /* Feature.cpp in Sources */,
|
D5951EF215934A2D0043A12A /* Feature.cpp in Sources */,
|
||||||
F99D342C2F736B6F00DC153E /* OptionsItem.cpp in Sources */,
|
|
||||||
D5951EF815934AC50043A12A /* BaseContainerMenu.cpp in Sources */,
|
D5951EF815934AC50043A12A /* BaseContainerMenu.cpp in Sources */,
|
||||||
D5951EFA15934AC50043A12A /* FurnaceMenu.cpp in Sources */,
|
D5951EFA15934AC50043A12A /* FurnaceMenu.cpp in Sources */,
|
||||||
D5D381F315A1A1CF00B6C50E /* FillingContainer.cpp in Sources */,
|
D5D381F315A1A1CF00B6C50E /* FillingContainer.cpp in Sources */,
|
||||||
@@ -5431,10 +5339,8 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
F912B8CF2F6C3D5200BC60DF /* TextBox.h in Sources */,
|
|
||||||
D5CF9C57144C225000E4244F /* main.mm in Sources */,
|
D5CF9C57144C225000E4244F /* main.mm in Sources */,
|
||||||
D5CF9C5B144C225000E4244F /* minecraftpeAppDelegate.mm in Sources */,
|
D5CF9C5B144C225000E4244F /* minecraftpeAppDelegate.mm in Sources */,
|
||||||
F99D343C2F736C3B00DC153E /* UsernameScreen.cpp in Sources */,
|
|
||||||
D5CF9C65144C225000E4244F /* EAGLView.m in Sources */,
|
D5CF9C65144C225000E4244F /* EAGLView.m in Sources */,
|
||||||
D5CFA01D144C453900E4244F /* minecraftpeViewController.mm in Sources */,
|
D5CFA01D144C453900E4244F /* minecraftpeViewController.mm in Sources */,
|
||||||
D5A55E4914500EDE00A7571B /* CreateNewWorldViewController.mm in Sources */,
|
D5A55E4914500EDE00A7571B /* CreateNewWorldViewController.mm in Sources */,
|
||||||
@@ -5448,7 +5354,6 @@
|
|||||||
D5F3B7D014548E7900D25470 /* IASKSettingsStoreUserDefaults.m in Sources */,
|
D5F3B7D014548E7900D25470 /* IASKSettingsStoreUserDefaults.m in Sources */,
|
||||||
D5F3B7D114548E7900D25470 /* IASKSpecifier.m in Sources */,
|
D5F3B7D114548E7900D25470 /* IASKSpecifier.m in Sources */,
|
||||||
D5F3B7D214548E7900D25470 /* IASKPSSliderSpecifierViewCell.m in Sources */,
|
D5F3B7D214548E7900D25470 /* IASKPSSliderSpecifierViewCell.m in Sources */,
|
||||||
F99D34472F736FE800DC153E /* KeyOption.cpp in Sources */,
|
|
||||||
D5F3B7D314548E7900D25470 /* IASKPSTextFieldSpecifierViewCell.m in Sources */,
|
D5F3B7D314548E7900D25470 /* IASKPSTextFieldSpecifierViewCell.m in Sources */,
|
||||||
D5F3B7D414548E7900D25470 /* IASKPSTitleValueSpecifierViewCell.m in Sources */,
|
D5F3B7D414548E7900D25470 /* IASKPSTitleValueSpecifierViewCell.m in Sources */,
|
||||||
D5F3B7D514548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.m in Sources */,
|
D5F3B7D514548E7900D25470 /* IASKPSToggleSwitchSpecifierViewCell.m in Sources */,
|
||||||
@@ -5560,13 +5465,11 @@
|
|||||||
D5B5112D14CFF670005F7284 /* PrimedTnt.cpp in Sources */,
|
D5B5112D14CFF670005F7284 /* PrimedTnt.cpp in Sources */,
|
||||||
D5B5112F14CFF670005F7284 /* TripodCamera.cpp in Sources */,
|
D5B5112F14CFF670005F7284 /* TripodCamera.cpp in Sources */,
|
||||||
D5B5113114CFF670005F7284 /* Mob.cpp in Sources */,
|
D5B5113114CFF670005F7284 /* Mob.cpp in Sources */,
|
||||||
F99D34442F736F9400DC153E /* Option.cpp in Sources */,
|
|
||||||
D5B5113314CFF670005F7284 /* MobCategory.cpp in Sources */,
|
D5B5113314CFF670005F7284 /* MobCategory.cpp in Sources */,
|
||||||
D5B5113714CFF670005F7284 /* PathFinderMob.cpp in Sources */,
|
D5B5113714CFF670005F7284 /* PathFinderMob.cpp in Sources */,
|
||||||
D5B5113914CFF670005F7284 /* Inventory.cpp in Sources */,
|
D5B5113914CFF670005F7284 /* Inventory.cpp in Sources */,
|
||||||
D5B5113B14CFF670005F7284 /* Player.cpp in Sources */,
|
D5B5113B14CFF670005F7284 /* Player.cpp in Sources */,
|
||||||
D5B5113D14CFF670005F7284 /* Arrow.cpp in Sources */,
|
D5B5113D14CFF670005F7284 /* Arrow.cpp in Sources */,
|
||||||
F99D343F2F736C8400DC153E /* GuiElementContainer.cpp in Sources */,
|
|
||||||
D5B5113F14CFF670005F7284 /* Recipes.cpp in Sources */,
|
D5B5113F14CFF670005F7284 /* Recipes.cpp in Sources */,
|
||||||
D5B5114114CFF670005F7284 /* ToolRecipes.cpp in Sources */,
|
D5B5114114CFF670005F7284 /* ToolRecipes.cpp in Sources */,
|
||||||
D5B5114314CFF670005F7284 /* WeaponRecipes.cpp in Sources */,
|
D5B5114314CFF670005F7284 /* WeaponRecipes.cpp in Sources */,
|
||||||
@@ -5604,12 +5507,10 @@
|
|||||||
D5B5118514CFF670005F7284 /* HitResult.cpp in Sources */,
|
D5B5118514CFF670005F7284 /* HitResult.cpp in Sources */,
|
||||||
D5B5118B14D03342005F7284 /* SynchedEntityData.cpp in Sources */,
|
D5B5118B14D03342005F7284 /* SynchedEntityData.cpp in Sources */,
|
||||||
D5B5118E14DEA27F005F7284 /* DeathScreen.cpp in Sources */,
|
D5B5118E14DEA27F005F7284 /* DeathScreen.cpp in Sources */,
|
||||||
F99D34242F736AD400DC153E /* TextOption.cpp in Sources */,
|
|
||||||
D5B5119114DEA2B7005F7284 /* LevelData.cpp in Sources */,
|
D5B5119114DEA2B7005F7284 /* LevelData.cpp in Sources */,
|
||||||
D5B5119414DEA2EF005F7284 /* DyePowderItem.cpp in Sources */,
|
D5B5119414DEA2EF005F7284 /* DyePowderItem.cpp in Sources */,
|
||||||
D584926D14FD234400741128 /* SharedConstants.cpp in Sources */,
|
D584926D14FD234400741128 /* SharedConstants.cpp in Sources */,
|
||||||
D584927314FD236700741128 /* MoveControl.cpp in Sources */,
|
D584927314FD236700741128 /* MoveControl.cpp in Sources */,
|
||||||
F99D344C2F7370CF00DC153E /* Slider.cpp in Sources */,
|
|
||||||
D584928614FD240D00741128 /* IConfigListener.cpp in Sources */,
|
D584928614FD240D00741128 /* IConfigListener.cpp in Sources */,
|
||||||
D584928914FD2FAF00741128 /* Path.cpp in Sources */,
|
D584928914FD2FAF00741128 /* Path.cpp in Sources */,
|
||||||
D5B86281153810BD00F3238A /* I18n.cpp in Sources */,
|
D5B86281153810BD00F3238A /* I18n.cpp in Sources */,
|
||||||
@@ -5661,7 +5562,6 @@
|
|||||||
D5251E011538192700FC82C8 /* NatTypeDetectionServer.cpp in Sources */,
|
D5251E011538192700FC82C8 /* NatTypeDetectionServer.cpp in Sources */,
|
||||||
D5251E031538192700FC82C8 /* NetworkIDManager.cpp in Sources */,
|
D5251E031538192700FC82C8 /* NetworkIDManager.cpp in Sources */,
|
||||||
D5251E051538192700FC82C8 /* NetworkIDObject.cpp in Sources */,
|
D5251E051538192700FC82C8 /* NetworkIDObject.cpp in Sources */,
|
||||||
F99D34372F736C1000DC153E /* JoinByIPScreen.cpp in Sources */,
|
|
||||||
D5251E071538192700FC82C8 /* PacketConsoleLogger.cpp in Sources */,
|
D5251E071538192700FC82C8 /* PacketConsoleLogger.cpp in Sources */,
|
||||||
D5251E091538192700FC82C8 /* PacketFileLogger.cpp in Sources */,
|
D5251E091538192700FC82C8 /* PacketFileLogger.cpp in Sources */,
|
||||||
D5251E0B1538192700FC82C8 /* PacketizedTCP.cpp in Sources */,
|
D5251E0B1538192700FC82C8 /* PacketizedTCP.cpp in Sources */,
|
||||||
@@ -5691,13 +5591,11 @@
|
|||||||
D5251E411538192700FC82C8 /* SendToThread.cpp in Sources */,
|
D5251E411538192700FC82C8 /* SendToThread.cpp in Sources */,
|
||||||
D5251E431538192700FC82C8 /* SHA1.cpp in Sources */,
|
D5251E431538192700FC82C8 /* SHA1.cpp in Sources */,
|
||||||
D5251E451538192700FC82C8 /* SignaledEvent.cpp in Sources */,
|
D5251E451538192700FC82C8 /* SignaledEvent.cpp in Sources */,
|
||||||
F99D34342F736BDA00DC153E /* CreditsScreen.cpp in Sources */,
|
|
||||||
D5251E471538192700FC82C8 /* SimpleMutex.cpp in Sources */,
|
D5251E471538192700FC82C8 /* SimpleMutex.cpp in Sources */,
|
||||||
D5251E491538192700FC82C8 /* SocketLayer.cpp in Sources */,
|
D5251E491538192700FC82C8 /* SocketLayer.cpp in Sources */,
|
||||||
D5251E4B1538192700FC82C8 /* StringCompressor.cpp in Sources */,
|
D5251E4B1538192700FC82C8 /* StringCompressor.cpp in Sources */,
|
||||||
D5251E4D1538192700FC82C8 /* StringTable.cpp in Sources */,
|
D5251E4D1538192700FC82C8 /* StringTable.cpp in Sources */,
|
||||||
D5251E4F1538192700FC82C8 /* SuperFastHash.cpp in Sources */,
|
D5251E4F1538192700FC82C8 /* SuperFastHash.cpp in Sources */,
|
||||||
F99D342B2F736B6F00DC153E /* OptionsItem.cpp in Sources */,
|
|
||||||
D5251E511538192700FC82C8 /* TableSerializer.cpp in Sources */,
|
D5251E511538192700FC82C8 /* TableSerializer.cpp in Sources */,
|
||||||
D5251E531538192700FC82C8 /* TCPInterface.cpp in Sources */,
|
D5251E531538192700FC82C8 /* TCPInterface.cpp in Sources */,
|
||||||
D5251E551538192700FC82C8 /* TeamBalancer.cpp in Sources */,
|
D5251E551538192700FC82C8 /* TeamBalancer.cpp in Sources */,
|
||||||
@@ -5720,7 +5618,6 @@
|
|||||||
D5951EDD159348C50043A12A /* ItemPane.cpp in Sources */,
|
D5951EDD159348C50043A12A /* ItemPane.cpp in Sources */,
|
||||||
D5951EE3159349000043A12A /* FurnaceTile.cpp in Sources */,
|
D5951EE3159349000043A12A /* FurnaceTile.cpp in Sources */,
|
||||||
D5951EE8159349100043A12A /* FurnaceTileEntity.cpp in Sources */,
|
D5951EE8159349100043A12A /* FurnaceTileEntity.cpp in Sources */,
|
||||||
F99D342F2F736BAD00DC153E /* ConsoleScreen.cpp in Sources */,
|
|
||||||
D5951EEA159349100043A12A /* TileEntity.cpp in Sources */,
|
D5951EEA159349100043A12A /* TileEntity.cpp in Sources */,
|
||||||
D5951EEE159349680043A12A /* FurnaceScreen.cpp in Sources */,
|
D5951EEE159349680043A12A /* FurnaceScreen.cpp in Sources */,
|
||||||
D5951EF115934A2D0043A12A /* Feature.cpp in Sources */,
|
D5951EF115934A2D0043A12A /* Feature.cpp in Sources */,
|
||||||
@@ -5757,7 +5654,6 @@
|
|||||||
D544941E15D13F45005FA9B0 /* PlayerRenderer.cpp in Sources */,
|
D544941E15D13F45005FA9B0 /* PlayerRenderer.cpp in Sources */,
|
||||||
D544942215D13F5E005FA9B0 /* RemotePlayer.cpp in Sources */,
|
D544942215D13F5E005FA9B0 /* RemotePlayer.cpp in Sources */,
|
||||||
D5B17ED515E226F50056E751 /* Throwable.cpp in Sources */,
|
D5B17ED515E226F50056E751 /* Throwable.cpp in Sources */,
|
||||||
F99D341F2F736AA100DC153E /* HttpClient.cpp in Sources */,
|
|
||||||
D5B17ED915E2273F0056E751 /* SurvivalMode.cpp in Sources */,
|
D5B17ED915E2273F0056E751 /* SurvivalMode.cpp in Sources */,
|
||||||
D5B17EDD15E227670056E751 /* TrapDoorTile.cpp in Sources */,
|
D5B17EDD15E227670056E751 /* TrapDoorTile.cpp in Sources */,
|
||||||
D5B17EE115E260910056E751 /* MoveFolder.mm in Sources */,
|
D5B17EE115E260910056E751 /* MoveFolder.mm in Sources */,
|
||||||
@@ -5793,7 +5689,6 @@
|
|||||||
0400453A16A4125C003EB6FA /* FallingTileRenderer.cpp in Sources */,
|
0400453A16A4125C003EB6FA /* FallingTileRenderer.cpp in Sources */,
|
||||||
0413970716A82E1E008A9F1A /* ArmorItem.cpp in Sources */,
|
0413970716A82E1E008A9F1A /* ArmorItem.cpp in Sources */,
|
||||||
0413970D16A82E6B008A9F1A /* CraftingFilters.cpp in Sources */,
|
0413970D16A82E6B008A9F1A /* CraftingFilters.cpp in Sources */,
|
||||||
F99D34272F736AFB00DC153E /* OptionsFile.cpp in Sources */,
|
|
||||||
0413970E16A82E6B008A9F1A /* StonecutterScreen.cpp in Sources */,
|
0413970E16A82E6B008A9F1A /* StonecutterScreen.cpp in Sources */,
|
||||||
0413971116A82E7B008A9F1A /* ArmorScreen.cpp in Sources */,
|
0413971116A82E7B008A9F1A /* ArmorScreen.cpp in Sources */,
|
||||||
0413971516A82EB9008A9F1A /* ArmorRecipes.cpp in Sources */,
|
0413971516A82EB9008A9F1A /* ArmorRecipes.cpp in Sources */,
|
||||||
@@ -5802,6 +5697,7 @@
|
|||||||
042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */,
|
042A91AE16B17517007ABBC6 /* GuiElement.cpp in Sources */,
|
||||||
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
|
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
|
||||||
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
|
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
|
||||||
|
042A91B116B17517007ABBC6 /* OptionsPane.cpp in Sources */,
|
||||||
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
|
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -5839,29 +5735,25 @@
|
|||||||
D50BE20815EE05B8008AA75E /* Ad-Hoc */ = {
|
D50BE20815EE05B8008AA75E /* Ad-Hoc */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
ARCHS = "$(ARCHS_STANDARD)";
|
ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Mojang AB";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Mojang AB";
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = PUBLISH;
|
GCC_PREPROCESSOR_DEFINITIONS = PUBLISH;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "C93D3524-5C6F-466E-B12B-833663B7EAE0";
|
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "C93D3524-5C6F-466E-B12B-833663B7EAE0";
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = "Ad-Hoc";
|
name = "Ad-Hoc";
|
||||||
@@ -5873,26 +5765,15 @@
|
|||||||
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||||
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = "";
|
||||||
"$(SRCROOT)/../../src",
|
|
||||||
"$(SRCROOT)/../../src/client/gui/components",
|
|
||||||
"$(SRCROOT)/../../src/world",
|
|
||||||
"$(SRCROOT)/../../src/platform/input",
|
|
||||||
"$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views",
|
|
||||||
);
|
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
VALID_ARCHS = "i386 armv6 armv7";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
WRAPPER_EXTENSION = app;
|
WRAPPER_EXTENSION = app;
|
||||||
};
|
};
|
||||||
name = "Ad-Hoc";
|
name = "Ad-Hoc";
|
||||||
@@ -5965,28 +5846,24 @@
|
|||||||
D5A20ADB146AAD9C00A52FEC /* AppStore */ = {
|
D5A20ADB146AAD9C00A52FEC /* AppStore */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
ARCHS = "$(ARCHS_STANDARD)";
|
ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Mojang AB";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Mojang AB";
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "64BA8967-1A9A-4980-972C-42E75AD5E023";
|
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "64BA8967-1A9A-4980-972C-42E75AD5E023";
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = AppStore;
|
name = AppStore;
|
||||||
@@ -5999,19 +5876,11 @@
|
|||||||
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = PUBLISH;
|
GCC_PREPROCESSOR_DEFINITIONS = PUBLISH;
|
||||||
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = "";
|
||||||
"$(SRCROOT)/../../src",
|
|
||||||
"$(SRCROOT)/../../src/client/gui/components",
|
|
||||||
"$(SRCROOT)/../../src/world",
|
|
||||||
"$(SRCROOT)/../../src/platform/input",
|
|
||||||
"$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views",
|
|
||||||
);
|
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
OTHER_CFLAGS = (
|
OTHER_CFLAGS = (
|
||||||
"-DNS_BLOCK_ASSERTIONS=1",
|
"-DNS_BLOCK_ASSERTIONS=1",
|
||||||
"-DANDROID_PUBLISH",
|
"-DANDROID_PUBLISH",
|
||||||
@@ -6019,10 +5888,8 @@
|
|||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "1B194957-98CF-49B7-A0E7-76692B4B722D";
|
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "1B194957-98CF-49B7-A0E7-76692B4B722D";
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
VALID_ARCHS = "i386 armv6 armv7";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
WRAPPER_EXTENSION = app;
|
WRAPPER_EXTENSION = app;
|
||||||
};
|
};
|
||||||
name = AppStore;
|
name = AppStore;
|
||||||
@@ -6055,8 +5922,8 @@
|
|||||||
D5CF9C6C144C225000E4244F /* Debug */ = {
|
D5CF9C6C144C225000E4244F /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
ARCHS = "$(ARCHS_STANDARD)";
|
ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
@@ -6068,50 +5935,41 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
VALIDATE_PRODUCT = YES;
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
D5CF9C6D144C225000E4244F /* Release */ = {
|
D5CF9C6D144C225000E4244F /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
ARCHS = "$(ARCHS_STANDARD)";
|
ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
COPY_PHASE_STRIP = YES;
|
COPY_PHASE_STRIP = YES;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = PUBLISH;
|
GCC_PREPROCESSOR_DEFINITIONS = PUBLISH;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = NO;
|
||||||
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@@ -6119,34 +5977,19 @@
|
|||||||
D5CF9C6F144C225000E4244F /* Debug */ = {
|
D5CF9C6F144C225000E4244F /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
DEVELOPMENT_TEAM = PZUVNW8F2U;
|
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
||||||
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = "";
|
||||||
"$(SRCROOT)/../../src",
|
|
||||||
"$(SRCROOT)/../../src/client/gui/components",
|
|
||||||
"$(SRCROOT)/../../src/world",
|
|
||||||
"$(SRCROOT)/../../src/platform/input",
|
|
||||||
"$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views",
|
|
||||||
);
|
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
VALID_ARCHS = "i386 armv6 armv7";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
WRAPPER_EXTENSION = app;
|
WRAPPER_EXTENSION = app;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@@ -6154,34 +5997,19 @@
|
|||||||
D5CF9C70144C225000E4244F /* Release */ = {
|
D5CF9C70144C225000E4244F /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
|
||||||
CODE_SIGN_STYLE = Automatic;
|
|
||||||
DEVELOPMENT_TEAM = PZUVNW8F2U;
|
|
||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
GCC_PREFIX_HEADER = "minecraftpe/minecraftpe-Prefix.pch";
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = "";
|
GCC_PREPROCESSOR_DEFINITIONS = "";
|
||||||
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
"GCC_THUMB_SUPPORT[arch=armv7]" = NO;
|
||||||
GCC_VERSION = "";
|
GCC_VERSION = com.apple.compilers.llvmgcc42;
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = "";
|
||||||
"$(SRCROOT)/../../src",
|
|
||||||
"$(SRCROOT)/../../src/client/gui/components",
|
|
||||||
"$(SRCROOT)/../../src/world",
|
|
||||||
"$(SRCROOT)/../../src/platform/input",
|
|
||||||
"$(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views",
|
|
||||||
);
|
|
||||||
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
INFOPLIST_FILE = "minecraftpe/minecraftpe-Info.plist";
|
||||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.games";
|
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "com.mojang.mcpe-arm64";
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
|
||||||
RUN_CLANG_STATIC_ANALYZER = NO;
|
RUN_CLANG_STATIC_ANALYZER = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos6.0;
|
||||||
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
VALID_ARCHS = "i386 armv6 armv7";
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../src $(SRCROOT)/../lib_projects/InAppSettingsKit/Models $(SRCROOT)/../../src/client/gui/components $(SRCROOT)/../../src/world $(SRCROOT)/../../src/platform/input $(SRCROOT)/../../project/lib_projects/InAppSettingsKit/Views";
|
|
||||||
USE_HEADERMAP = NO;
|
|
||||||
WRAPPER_EXTENSION = app;
|
WRAPPER_EXTENSION = app;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
<string>com.mojang.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
@@ -58,8 +58,6 @@
|
|||||||
<array>
|
<array>
|
||||||
<string>minecraft.ttf</string>
|
<string>minecraft.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
<key>UILaunchStoryboardName</key>
|
|
||||||
<string>Launch Screen</string>
|
|
||||||
<key>UIPrerenderedIcon</key>
|
<key>UIPrerenderedIcon</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIRequiresPersistentWiFi</key>
|
<key>UIRequiresPersistentWiFi</key>
|
||||||
|
|||||||
26
src/App.cpp
Normal file
26
src/App.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include "App.h"
|
||||||
|
#include "IPlatform.h"
|
||||||
|
|
||||||
|
#include "platform/server/PlatformServer.h"
|
||||||
|
#include "platform/glfw/PlatformGlfw.h"
|
||||||
|
|
||||||
|
std::unique_ptr<IPlatform> App::CreatePlatform() {
|
||||||
|
#if defined(STANDALONE_SERVER)
|
||||||
|
return std::make_unique<PlatformServer>();
|
||||||
|
#elif defined(PLATFORM_DESKTOP)
|
||||||
|
return std::make_unique<PlatformGlfw>();
|
||||||
|
#else
|
||||||
|
static_assert(false, "Unsupported platform!");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::run() {
|
||||||
|
init();
|
||||||
|
|
||||||
|
m_platform->runMainLoop(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::swapBuffers() {
|
||||||
|
m_platform->swapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
92
src/App.h
92
src/App.h
@@ -1,6 +1,6 @@
|
|||||||
#ifndef APP_H__
|
#pragma once
|
||||||
#define APP_H__
|
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define NO_EGL
|
#define NO_EGL
|
||||||
#endif
|
#endif
|
||||||
@@ -8,47 +8,36 @@
|
|||||||
#define NO_EGL
|
#define NO_EGL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "AppPlatform.h"
|
#include <IPlatform.h>
|
||||||
#ifndef NO_EGL
|
#ifndef NO_EGL
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#endif
|
#endif
|
||||||
#include "platform/log.h"
|
|
||||||
|
|
||||||
typedef struct AppContext {
|
|
||||||
#ifndef NO_EGL
|
|
||||||
EGLDisplay display;
|
|
||||||
EGLContext context;
|
|
||||||
EGLSurface surface;
|
|
||||||
#endif
|
|
||||||
AppPlatform* platform;
|
|
||||||
bool doRender;
|
|
||||||
} AppContext;
|
|
||||||
|
|
||||||
|
|
||||||
class App
|
// typedef struct AppContext {
|
||||||
{
|
// #ifndef NO_EGL
|
||||||
|
// EGLDisplay display;
|
||||||
|
// EGLContext context;
|
||||||
|
// EGLSurface surface;
|
||||||
|
// #endif
|
||||||
|
// AppPlatform* platform;
|
||||||
|
// bool doRender;
|
||||||
|
// } AppContext;
|
||||||
|
|
||||||
|
class App {
|
||||||
|
protected:
|
||||||
|
std::unique_ptr<IPlatform> m_platform;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
App()
|
static std::unique_ptr<IPlatform> CreatePlatform();
|
||||||
: _finished(false),
|
|
||||||
_inited(false)
|
App(std::unique_ptr<IPlatform> platform) : m_platform(std::move(platform)), m_finished(false), m_inited(false) {}
|
||||||
{
|
App() = delete;
|
||||||
_context.platform = 0;
|
|
||||||
}
|
|
||||||
virtual ~App() {}
|
virtual ~App() {}
|
||||||
|
|
||||||
void init(AppContext& c) {
|
void run();
|
||||||
_context = c;
|
|
||||||
init();
|
|
||||||
_inited = true;
|
|
||||||
}
|
|
||||||
bool isInited() { return _inited; }
|
|
||||||
|
|
||||||
virtual AppPlatform* platform() { return _context.platform; }
|
bool isInited() { return m_inited; }
|
||||||
|
|
||||||
void onGraphicsReset(AppContext& c) {
|
|
||||||
_context = c;
|
|
||||||
onGraphicsReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void audioEngineOn () {}
|
virtual void audioEngineOn () {}
|
||||||
virtual void audioEngineOff() {}
|
virtual void audioEngineOff() {}
|
||||||
@@ -58,30 +47,25 @@ public:
|
|||||||
virtual void loadState(void* state, int stateSize) {}
|
virtual void loadState(void* state, int stateSize) {}
|
||||||
virtual bool saveState(void** state, int* stateSize) { return false; }
|
virtual bool saveState(void** state, int* stateSize) { return false; }
|
||||||
|
|
||||||
void swapBuffers() {
|
void swapBuffers();
|
||||||
#ifndef NO_EGL
|
// {
|
||||||
if (_context.doRender)
|
// #ifndef NO_EGL
|
||||||
eglSwapBuffers(_context.display, _context.surface);
|
// if (_context.doRender)
|
||||||
#endif
|
// eglSwapBuffers(_context.display, _context.surface);
|
||||||
}
|
// #endif
|
||||||
|
// m_platform->swapBuffers();
|
||||||
|
// }
|
||||||
|
|
||||||
virtual void draw() {}
|
virtual void update() = 0;
|
||||||
virtual void update() {};// = 0;
|
|
||||||
virtual void setSize(int width, int height) {}
|
|
||||||
|
|
||||||
virtual void quit() { _finished = true; }
|
virtual void quit() { m_finished = true; }
|
||||||
virtual bool wantToQuit() { return _finished; }
|
virtual bool wantToQuit() { return m_finished; }
|
||||||
virtual bool handleBack(bool isDown) { return false; }
|
virtual bool handleBack(bool isDown) { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void init() {}
|
virtual void init() { m_inited = true;}
|
||||||
//virtual void onGraphicsLost() = 0;
|
|
||||||
virtual void onGraphicsReset() = 0;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _inited;
|
bool m_inited = false;
|
||||||
bool _finished;
|
bool m_finished = false;
|
||||||
AppContext _context;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
#endif//APP_H__
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#ifndef _MINECRAFT_APPCONSTANTS_H_
|
|
||||||
#define _MINECRAFT_APPCONSTANTS_H_
|
|
||||||
|
|
||||||
|
|
||||||
#define APP_VERSION_STRING "Demo"
|
|
||||||
#define APP_NAME "Minecraft - Pocket Edition " APP_VERSION_STRING
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
#ifndef APPPLATFORM_H__
|
|
||||||
#define APPPLATFORM_H__
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include <cstring>
|
|
||||||
#include "client/renderer/TextureData.h"
|
|
||||||
|
|
||||||
typedef std::vector<std::string> StringVector;
|
|
||||||
|
|
||||||
/*
|
|
||||||
typedef struct UserInput
|
|
||||||
{
|
|
||||||
static const int STATUS_INVALID = -1;
|
|
||||||
static const int STATUS_NOTINITED = -2;
|
|
||||||
static const int STATUS_OK = 1;
|
|
||||||
static const int STATUS_CANCEL = 0;
|
|
||||||
|
|
||||||
UserInput(int id)
|
|
||||||
: _id(id),
|
|
||||||
status(STATUS_NOTINITED)
|
|
||||||
{}
|
|
||||||
UserInput(int id, int status)
|
|
||||||
: _id(id),
|
|
||||||
status(status)
|
|
||||||
{}
|
|
||||||
int getId() { return _id; }
|
|
||||||
|
|
||||||
int status;
|
|
||||||
private:
|
|
||||||
int _id;
|
|
||||||
} UserInput;
|
|
||||||
|
|
||||||
|
|
||||||
class UserInputStatus {
|
|
||||||
int _status;
|
|
||||||
public:
|
|
||||||
UserInputStatus(int status)
|
|
||||||
: _status(status)
|
|
||||||
{}
|
|
||||||
bool isAnswered() { return _status >= 0; }
|
|
||||||
bool isOk() { return _status == UserInput::STATUS_OK; }
|
|
||||||
bool isCancel() { return _status == UserInput::STATUS_CANCEL; }
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
class BinaryBlob {
|
|
||||||
public:
|
|
||||||
BinaryBlob()
|
|
||||||
: data(NULL),
|
|
||||||
size(-1) {}
|
|
||||||
|
|
||||||
BinaryBlob(unsigned char* data, unsigned int size)
|
|
||||||
: data(data),
|
|
||||||
size(size) {}
|
|
||||||
|
|
||||||
unsigned char* data;
|
|
||||||
int size;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PlatformStringVars {
|
|
||||||
public:
|
|
||||||
static const int DEVICE_BUILD_MODEL = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class AppPlatform
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AppPlatform() : keyboardVisible(false) {}
|
|
||||||
virtual ~AppPlatform() {}
|
|
||||||
|
|
||||||
virtual void saveScreenshot(const std::string& filename, int glWidth, int glHeight) {}
|
|
||||||
virtual TextureData loadTexture(const std::string& filename_, bool textureFolder) { return TextureData(); }
|
|
||||||
virtual TextureData loadTextureFromMemory(const unsigned char* data, size_t size) { return TextureData(); }
|
|
||||||
|
|
||||||
virtual void playSound(const std::string& fn, float volume, float pitch) {}
|
|
||||||
|
|
||||||
virtual void hideCursor(bool hide) {}
|
|
||||||
|
|
||||||
virtual void showDialog(int dialogId) {}
|
|
||||||
virtual void createUserInput() {}
|
|
||||||
|
|
||||||
bool is_big_endian(void) {
|
|
||||||
union {
|
|
||||||
unsigned int i;
|
|
||||||
char c[4];
|
|
||||||
} bint = {0x01020304};
|
|
||||||
return bint.c[0] == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void createUserInput(int dialogId)
|
|
||||||
{
|
|
||||||
showDialog(dialogId);
|
|
||||||
createUserInput();
|
|
||||||
}
|
|
||||||
virtual int getUserInputStatus() { return 0; }
|
|
||||||
virtual StringVector getUserInput() { return StringVector(); }
|
|
||||||
|
|
||||||
virtual std::string getDateString(int s) { return ""; }
|
|
||||||
//virtual void createUserInputScreen(const char* types) {}
|
|
||||||
|
|
||||||
virtual void uploadPlatformDependentData(int id, void* data) {}
|
|
||||||
virtual BinaryBlob readAssetFile(const std::string& filename) { return BinaryBlob(); }
|
|
||||||
virtual void _tick() {}
|
|
||||||
|
|
||||||
virtual int getScreenWidth() { return 854; }
|
|
||||||
virtual int getScreenHeight() { return 480; }
|
|
||||||
virtual float getPixelsPerMillimeter() { return 10; }
|
|
||||||
|
|
||||||
virtual bool isNetworkEnabled(bool onlyWifiAllowed) { return true; }
|
|
||||||
|
|
||||||
virtual bool isPowerVR() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
virtual int getKeyFromKeyCode(int keyCode, int metaState, int deviceId) {return 0;}
|
|
||||||
#ifdef __APPLE__
|
|
||||||
virtual bool isSuperFast() = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void openURL(const std::string& url) {}
|
|
||||||
|
|
||||||
virtual void finish() {}
|
|
||||||
|
|
||||||
virtual bool supportsTouchscreen() { return false; }
|
|
||||||
|
|
||||||
virtual void vibrate(int milliSeconds) {}
|
|
||||||
|
|
||||||
virtual std::string getPlatformStringVar(int stringId) {
|
|
||||||
return "<getPlatformStringVar NotImplemented>";
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void showKeyboard() {
|
|
||||||
keyboardVisible = true;
|
|
||||||
}
|
|
||||||
virtual void hideKeyboard() {
|
|
||||||
keyboardVisible = false;
|
|
||||||
}
|
|
||||||
virtual bool isKeyboardVisible() {return keyboardVisible;}
|
|
||||||
protected:
|
|
||||||
bool keyboardVisible;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*APPPLATFORM_H__*/
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#include "AppPlatform_glfw.h"
|
|
||||||
|
|
||||||
float AppPlatform_glfw::getPixelsPerMillimeter() {
|
|
||||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
|
||||||
|
|
||||||
int width_mm, height_mm;
|
|
||||||
glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm);
|
|
||||||
|
|
||||||
const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
|
||||||
|
|
||||||
return (float)mode->width / (float)width_mm;
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
#ifndef APPPLATFORM_GLFW_H__
|
|
||||||
#define APPPLATFORM_GLFW_H__
|
|
||||||
|
|
||||||
#include "AppPlatform.h"
|
|
||||||
#include "platform/log.h"
|
|
||||||
#include "platform/HttpClient.h"
|
|
||||||
#include "platform/PngLoader.h"
|
|
||||||
#include "client/renderer/gles.h"
|
|
||||||
#include "world/level/storage/FolderMethods.h"
|
|
||||||
#include <png.h>
|
|
||||||
#include <cmath>
|
|
||||||
#include <fstream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
#include <ctime>
|
|
||||||
#include "util/StringUtils.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#include <shellapi.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
#include <emscripten/html5.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void png_funcReadFile(png_structp pngPtr, png_bytep data, png_size_t length) {
|
|
||||||
((std::istream*)png_get_io_ptr(pngPtr))->read((char*)data, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
class AppPlatform_glfw: public AppPlatform
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AppPlatform_glfw()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BinaryBlob readAssetFile(const std::string& filename) override {
|
|
||||||
FILE* fp = fopen(("data/" + filename).c_str(), "r");
|
|
||||||
if (!fp)
|
|
||||||
return BinaryBlob();
|
|
||||||
|
|
||||||
int size = getRemainingFileSize(fp);
|
|
||||||
|
|
||||||
BinaryBlob blob;
|
|
||||||
blob.size = size;
|
|
||||||
blob.data = new unsigned char[size];
|
|
||||||
|
|
||||||
fread(blob.data, 1, size, fp);
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return blob;
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveScreenshot(const std::string& filename, int glWidth, int glHeight) override {
|
|
||||||
//@todo
|
|
||||||
}
|
|
||||||
|
|
||||||
__inline unsigned int rgbToBgr(unsigned int p) {
|
|
||||||
return (p & 0xff00ff00) | ((p >> 16) & 0xff) | ((p << 16) & 0xff0000);
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureData loadTexture(const std::string& filename_, bool textureFolder) override
|
|
||||||
{
|
|
||||||
// Support fetching PNG textures via HTTP/HTTPS (for skins, etc)
|
|
||||||
if (Util::startsWith(filename_, "http://") || Util::startsWith(filename_, "https://")) {
|
|
||||||
std::vector<unsigned char> body;
|
|
||||||
if (HttpClient::download(filename_, body) && !body.empty()) {
|
|
||||||
return loadTextureFromMemory(body.data(), body.size());
|
|
||||||
}
|
|
||||||
return TextureData();
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureData out;
|
|
||||||
|
|
||||||
std::string filename = textureFolder? "data/images/" + filename_
|
|
||||||
: filename_;
|
|
||||||
std::ifstream source(filename.c_str(), std::ios::binary);
|
|
||||||
|
|
||||||
if (!source) {
|
|
||||||
LOGI("Couldn't find file: %s\n", filename.c_str());
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<unsigned char> fileData((std::istreambuf_iterator<char>(source)), std::istreambuf_iterator<char>());
|
|
||||||
source.close();
|
|
||||||
|
|
||||||
if (fileData.empty()) {
|
|
||||||
LOGI("Couldn't read file: %s\n", filename.c_str());
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
return loadTextureFromMemory(fileData.data(), fileData.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureData loadTextureFromMemory(const unsigned char* data, size_t size) override {
|
|
||||||
return loadPngFromMemory(data, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::string getDateString(int s) override {
|
|
||||||
time_t tm = s;
|
|
||||||
|
|
||||||
char mbstr[100];
|
|
||||||
std::strftime(mbstr, sizeof(mbstr), "%F %T", std::localtime(&tm));
|
|
||||||
|
|
||||||
return std::string(mbstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int getScreenWidth() override {
|
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
int w, h;
|
|
||||||
emscripten_get_canvas_element_size("canvas", &w, &h);
|
|
||||||
|
|
||||||
return w;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 854;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual int getScreenHeight() override {
|
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
int w, h;
|
|
||||||
emscripten_get_canvas_element_size("canvas", &w, &h);
|
|
||||||
|
|
||||||
return h;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 480;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual float getPixelsPerMillimeter() override;
|
|
||||||
|
|
||||||
virtual bool supportsTouchscreen() override { return false; /* glfw supports only mouse and keyboard */ }
|
|
||||||
|
|
||||||
virtual void hideCursor(bool hide) override {
|
|
||||||
int isHide = hide ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_HIDDEN;
|
|
||||||
glfwSetInputMode(window, GLFW_CURSOR, isHide);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void openURL(const std::string& url) override {
|
|
||||||
#ifdef _WIN32
|
|
||||||
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
|
||||||
#elif __linux__
|
|
||||||
std::string command = "xdg-open " + url;
|
|
||||||
system(command.c_str());
|
|
||||||
#elif __EMSCRIPTEN__
|
|
||||||
emscripten_run_script(std::string("window.open('" + url + "', '_blank')").c_str());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWwindow* window;
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
#endif /*APPPLATFORM_GLFW_H__*/
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#ifndef ERRORCODES_H__
|
|
||||||
#define ERRORCODES_H__
|
|
||||||
|
|
||||||
namespace ErrorCodes {
|
|
||||||
|
|
||||||
enum Enum {
|
|
||||||
Unknown,
|
|
||||||
ContainerRefStillExistsAfterDestruction
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /*ERRORCODES_H__*/
|
|
||||||
14
src/IPlatform.cpp
Normal file
14
src/IPlatform.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <IPlatform.h>
|
||||||
|
#include <App.h>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
void IPlatform::runMainLoop(App& app) {
|
||||||
|
while(!app.wantToQuit()) app.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteVector IPlatform::readAssetFile(const std::string& path) {
|
||||||
|
std::ifstream instream(path, std::ios::in | std::ios::binary);
|
||||||
|
std::vector<uint8_t> data((std::istreambuf_iterator<char>(instream)), std::istreambuf_iterator<char>());
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
81
src/IPlatform.h
Executable file
81
src/IPlatform.h
Executable file
@@ -0,0 +1,81 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include "client/renderer/TextureData.h"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
typedef std::vector<std::string> StringVector;
|
||||||
|
typedef std::vector<uint8_t> ByteVector;
|
||||||
|
|
||||||
|
class App;
|
||||||
|
|
||||||
|
class IPlatform {
|
||||||
|
public:
|
||||||
|
IPlatform() : keyboardVisible(false), windowSizeChanged(false), m_targetFrametime(0.f) {}
|
||||||
|
virtual ~IPlatform() {}
|
||||||
|
|
||||||
|
virtual bool init() { return true; }
|
||||||
|
virtual void swapBuffers() {}
|
||||||
|
|
||||||
|
virtual void runMainLoop(App& app);
|
||||||
|
|
||||||
|
virtual ByteVector readAssetFile(const std::string& path);
|
||||||
|
|
||||||
|
|
||||||
|
// Mojang functions here
|
||||||
|
virtual TextureData loadTexture(const std::string& filename_, bool textureFolder) { return TextureData(); }
|
||||||
|
virtual TextureData loadTextureFromMemory(const unsigned char* data, size_t size) { return TextureData(); }
|
||||||
|
|
||||||
|
virtual void playSound(const std::string& fn, float volume, float pitch) {}
|
||||||
|
|
||||||
|
virtual void hideCursor(bool hide) {}
|
||||||
|
|
||||||
|
virtual std::string getDateString(int s) = 0;
|
||||||
|
|
||||||
|
virtual void uploadPlatformDependentData(int id, void* data) {}
|
||||||
|
// virtual BinaryBlob readAssetFile(const std::string& filename) { return BinaryBlob(); }
|
||||||
|
virtual void _tick() {}
|
||||||
|
|
||||||
|
virtual int getScreenWidth() { return 854; }
|
||||||
|
virtual int getScreenHeight() { return 480; }
|
||||||
|
virtual float getPixelsPerMillimeter() { return 10; }
|
||||||
|
|
||||||
|
virtual bool isNetworkEnabled(bool onlyWifiAllowed) { return true; }
|
||||||
|
|
||||||
|
virtual bool isPowerVR() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
virtual int getKeyFromKeyCode(int keyCode, int metaState, int deviceId) {return 0;}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
virtual bool isSuperFast() = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
virtual void openURL(const std::string& url) {}
|
||||||
|
|
||||||
|
virtual void finish() {}
|
||||||
|
|
||||||
|
virtual bool supportsTouchscreen() { return false; }
|
||||||
|
|
||||||
|
virtual void vibrate(int milliSeconds) {}
|
||||||
|
|
||||||
|
virtual std::string getPlatformStringVar(int stringId) = 0;
|
||||||
|
|
||||||
|
virtual void showKeyboard() { keyboardVisible = true; }
|
||||||
|
|
||||||
|
virtual void hideKeyboard() { keyboardVisible = false; }
|
||||||
|
|
||||||
|
virtual bool isKeyboardVisible() { return keyboardVisible; }
|
||||||
|
|
||||||
|
virtual void setTargetFPS(int fps) { m_targetFrametime = 1.0 / fps; }
|
||||||
|
|
||||||
|
bool isWindowSizeChanged() { return windowSizeChanged; }
|
||||||
|
|
||||||
|
virtual void setVSync(bool on) { vsync = on; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool keyboardVisible;
|
||||||
|
bool windowSizeChanged;
|
||||||
|
bool vsync;
|
||||||
|
|
||||||
|
double m_targetFrametime;
|
||||||
|
};
|
||||||
502
src/Minecraft.cpp
Executable file
502
src/Minecraft.cpp
Executable file
@@ -0,0 +1,502 @@
|
|||||||
|
#include <Minecraft.h>
|
||||||
|
#include "gamemode/CreativeMode.h"
|
||||||
|
#include "gamemode/SurvivalMode.h"
|
||||||
|
#include "gamemode/CreatorMode.h"
|
||||||
|
#include "world/entity/player/Player.h"
|
||||||
|
#include "world/item/Item.h"
|
||||||
|
#include "world/item/ItemInstance.h"
|
||||||
|
#include "world/item/crafting/Recipes.h"
|
||||||
|
#include "world/level/Level.h"
|
||||||
|
#include "world/level/tile/entity/TileEntity.h"
|
||||||
|
#include <string>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include "client/gui/Screen.h"
|
||||||
|
#include "world/level/storage/ExternalFileLevelStorageSource.h"
|
||||||
|
|
||||||
|
#if defined(APPLE_DEMO_PROMOTION)
|
||||||
|
#define NO_NETWORK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(RPI)
|
||||||
|
#define CREATORMODE
|
||||||
|
#endif
|
||||||
|
#include "network/RakNetInstance.h"
|
||||||
|
#include "network/ClientSideNetworkHandler.h"
|
||||||
|
#include "network/ServerSideNetworkHandler.h"
|
||||||
|
//#include "network/Packet.h"
|
||||||
|
#include "world/entity/player/Inventory.h"
|
||||||
|
#include "world/level/tile/Tile.h"
|
||||||
|
#include "world/level/storage/LevelStorageSource.h"
|
||||||
|
#include "world/level/storage/LevelStorage.h"
|
||||||
|
#include "world/level/chunk/ChunkSource.h"
|
||||||
|
|
||||||
|
#include "platform/CThread.h"
|
||||||
|
#include <IPlatform.h>
|
||||||
|
#include "util/PerfTimer.h"
|
||||||
|
#include "util/PerfRenderer.h"
|
||||||
|
|
||||||
|
#include "world/entity/MobFactory.h"
|
||||||
|
#include "world/level/MobSpawner.h"
|
||||||
|
#include "util/Mth.h"
|
||||||
|
#include "world/entity/MobCategory.h"
|
||||||
|
#include "server/ServerLevel.h"
|
||||||
|
|
||||||
|
#ifdef CREATORMODE
|
||||||
|
#include "server/CreatorLevel.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "network/command/CommandServer.h"
|
||||||
|
|
||||||
|
/*static*/
|
||||||
|
const char* Minecraft::progressMessages[] = {
|
||||||
|
"Locating server",
|
||||||
|
"Building terrain",
|
||||||
|
"Preparing",
|
||||||
|
"Saving chunks"
|
||||||
|
};
|
||||||
|
|
||||||
|
// int Minecraft::customDebugId = Minecraft::CDI_NONE;
|
||||||
|
bool Minecraft::_hasInitedStatics = false;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning( disable : 4355 ) // 'this' pointer in initialization list which is perfectly legal
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Minecraft::Minecraft() :
|
||||||
|
// #ifdef __APPLE__
|
||||||
|
// _isSuperFast(false),
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
// #if defined(NO_NETWORK)
|
||||||
|
// raknetInstance = new IRakNetInstance();
|
||||||
|
// #else
|
||||||
|
// raknetInstance = new RakNetInstance();
|
||||||
|
// #endif
|
||||||
|
// #ifndef STANDALONE_SERVER
|
||||||
|
// soundEngine = new SoundEngine(20.0f);
|
||||||
|
// soundEngine->init(this, &options);
|
||||||
|
// #endif
|
||||||
|
// //setupPieces();
|
||||||
|
|
||||||
|
// #if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
||||||
|
// signal(SIGPIPE, SIG_IGN);
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// externalCacheStoragePath = '.';
|
||||||
|
// externalCacheStoragePath = '.';
|
||||||
|
// }
|
||||||
|
|
||||||
|
Minecraft::~Minecraft() {
|
||||||
|
delete netCallback;
|
||||||
|
delete raknetInstance;
|
||||||
|
delete gameMode;
|
||||||
|
|
||||||
|
if (level != NULL) {
|
||||||
|
level->saveGame();
|
||||||
|
if (level->getChunkSource())
|
||||||
|
level->getChunkSource()->saveAll(true);
|
||||||
|
delete level->getLevelStorage();
|
||||||
|
delete level;
|
||||||
|
level = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete player;
|
||||||
|
delete storageSource;
|
||||||
|
delete _commandServer;
|
||||||
|
|
||||||
|
MobFactory::clearStaticTestMobs();
|
||||||
|
|
||||||
|
// Note: Don't tear down statics if we run on Android
|
||||||
|
// (we might change this in the future)
|
||||||
|
#ifndef ANDROID
|
||||||
|
Biome::teardownBiomes();
|
||||||
|
Item ::teardownItems();
|
||||||
|
Tile ::teardownTiles();
|
||||||
|
Material::teardownMaterials();
|
||||||
|
Recipes ::teardownRecipes();
|
||||||
|
TileEntity::teardownTileEntities();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only called by server
|
||||||
|
void Minecraft::selectLevel( const std::string& levelId, const std::string& levelName, const LevelSettings& settings ) {
|
||||||
|
level = (Level*)new ServerLevel(
|
||||||
|
storageSource->selectLevel(levelId, false),
|
||||||
|
levelName,
|
||||||
|
settings,
|
||||||
|
SharedConstants::GeneratorVersion
|
||||||
|
);
|
||||||
|
|
||||||
|
// note: settings is useless beyond this point, since it's
|
||||||
|
// either copied to LevelData (or LevelData read from file)
|
||||||
|
setLevel(level, "Generating level");
|
||||||
|
setIsCreativeMode(level->getLevelData()->getGameType() == GameType::Creative);
|
||||||
|
_running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::setLevel(Level* level, const std::string& message, Player* forceInsertPlayer) {
|
||||||
|
LOGI("Seed is %ld\n", level->getSeed());
|
||||||
|
|
||||||
|
if (level != NULL) {
|
||||||
|
level->raknetInstance = raknetInstance;
|
||||||
|
gameMode->initLevel(level);
|
||||||
|
|
||||||
|
this->level = level;
|
||||||
|
_hasSignaledGeneratingLevelFinished = false;
|
||||||
|
#ifdef STANDALONE_SERVER
|
||||||
|
const bool threadedLevelCreation = false;
|
||||||
|
#else
|
||||||
|
const bool threadedLevelCreation = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (threadedLevelCreation) {
|
||||||
|
// Threaded
|
||||||
|
// "Lock"
|
||||||
|
isGeneratingLevel = true;
|
||||||
|
generateLevelThread = new CThread(Minecraft::prepareLevel_tspawn, this);
|
||||||
|
} else {
|
||||||
|
// Non-threaded
|
||||||
|
generateLevel("Currently not used", level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->lastTickTime = 0;
|
||||||
|
this->_running = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::prepareLevel(const std::string& title) {
|
||||||
|
LOGI("status: 1\n");
|
||||||
|
progressStageStatusId = 1;
|
||||||
|
|
||||||
|
Stopwatch A, B, C, D;
|
||||||
|
A.start();
|
||||||
|
|
||||||
|
Stopwatch L;
|
||||||
|
|
||||||
|
// Dont update lights if we load the level (ok, actually just with leveldata version=1.+(?))
|
||||||
|
if (!level->isNew())
|
||||||
|
level->setUpdateLights(false);
|
||||||
|
|
||||||
|
int Max = CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH;
|
||||||
|
int pp = 0;
|
||||||
|
for (int x = 8; x < (CHUNK_CACHE_WIDTH * CHUNK_WIDTH); x += CHUNK_WIDTH) {
|
||||||
|
for (int z = 8; z < (CHUNK_CACHE_WIDTH * CHUNK_WIDTH); z += CHUNK_WIDTH) {
|
||||||
|
progressStagePercentage = 100 * pp++ / Max;
|
||||||
|
//printf("level generation progress %d\n", progressStagePercentage);
|
||||||
|
B.start();
|
||||||
|
level->getTile(x, 64, z);
|
||||||
|
B.stop();
|
||||||
|
L.start();
|
||||||
|
if (level->isNew())
|
||||||
|
while (level->updateLights())
|
||||||
|
;
|
||||||
|
L.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
A.stop();
|
||||||
|
level->setUpdateLights(true);
|
||||||
|
|
||||||
|
C.start();
|
||||||
|
for (int x = 0; x < CHUNK_CACHE_WIDTH; x++)
|
||||||
|
{
|
||||||
|
for (int z = 0; z < CHUNK_CACHE_WIDTH; z++)
|
||||||
|
{
|
||||||
|
LevelChunk* chunk = level->getChunk(x, z);
|
||||||
|
if (chunk && !chunk->createdFromSave)
|
||||||
|
{
|
||||||
|
chunk->unsaved = false;
|
||||||
|
chunk->clearUpdateMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
C.stop();
|
||||||
|
|
||||||
|
LOGI("status: 3\n");
|
||||||
|
progressStageStatusId = 3;
|
||||||
|
if (level->isNew()) {
|
||||||
|
level->setInitialSpawn(); // @note: should obviously be called from Level itself
|
||||||
|
level->saveLevelData();
|
||||||
|
level->getChunkSource()->saveAll(false);
|
||||||
|
level->saveGame();
|
||||||
|
} else {
|
||||||
|
level->saveLevelData();
|
||||||
|
level->loadEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
progressStagePercentage = -1;
|
||||||
|
progressStageStatusId = 2;
|
||||||
|
LOGI("status: 2\n");
|
||||||
|
|
||||||
|
D.start();
|
||||||
|
level->prepare();
|
||||||
|
D.stop();
|
||||||
|
|
||||||
|
A.print("Generate level: ");
|
||||||
|
L.print(" - light: ");
|
||||||
|
B.print(" - getTl: ");
|
||||||
|
C.print(" - clear: ");
|
||||||
|
D.print(" - prepr: ");
|
||||||
|
progressStageStatusId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::update() {
|
||||||
|
|
||||||
|
timer.advanceTime();
|
||||||
|
raknetInstance->runEvents(netCallback);
|
||||||
|
|
||||||
|
TIMER_PUSH("tick");
|
||||||
|
int toTick = timer.ticks;
|
||||||
|
timer.ticks = 0;
|
||||||
|
for (int i = 0; i < toTick; ++i, ++ticks) tick(i, toTick-1);
|
||||||
|
|
||||||
|
TIMER_POP_PUSH("updatelights");
|
||||||
|
{
|
||||||
|
if (level && !isGeneratingLevel) {
|
||||||
|
level->updateLights();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TIMER_POP();
|
||||||
|
|
||||||
|
|
||||||
|
// Restart the server if (our modded) RakNet reports an error
|
||||||
|
if (level && raknetInstance->isProbablyBroken() && raknetInstance->isServer()) {
|
||||||
|
restartServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::restartServer() {
|
||||||
|
if (!level) return;
|
||||||
|
|
||||||
|
raknetInstance->resetIsBroken();
|
||||||
|
|
||||||
|
hostMultiplayer();
|
||||||
|
if (netCallback) netCallback->levelGenerated(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::tick(int nTick, int maxTick) {
|
||||||
|
if (missTime > 0) missTime--;
|
||||||
|
|
||||||
|
TIMER_PUSH("gameMode");
|
||||||
|
if (level) {
|
||||||
|
gameMode->tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
TIMER_POP_PUSH("commandServer");
|
||||||
|
if (level && _commandServer) {
|
||||||
|
_commandServer->tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ongoing level generation in a (perhaps) different thread. When it's
|
||||||
|
// ready, _levelGenerated() is called once and any threads are deleted.
|
||||||
|
//
|
||||||
|
if (isGeneratingLevel) {
|
||||||
|
return;
|
||||||
|
} else if (!_hasSignaledGeneratingLevelFinished) {
|
||||||
|
if (generateLevelThread) {
|
||||||
|
delete generateLevelThread;
|
||||||
|
generateLevelThread = NULL;
|
||||||
|
}
|
||||||
|
_levelGenerated();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normal game loop, run before or efter level generation
|
||||||
|
//
|
||||||
|
if (level != NULL) {
|
||||||
|
TIMER_POP_PUSH("level");
|
||||||
|
level->tickEntities();
|
||||||
|
level->tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
TIMER_POP();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Minecraft::isOnlineClient() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Minecraft::isOnline() {
|
||||||
|
return netCallback != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::init()
|
||||||
|
{
|
||||||
|
// WHY DO WE NEED THIS ON MODERN PLATFORMS :sob:
|
||||||
|
// Global initialization goes here
|
||||||
|
Mth::initMth();
|
||||||
|
|
||||||
|
if (raknetInstance != nullptr) {
|
||||||
|
delete raknetInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
raknetInstance = new RakNetInstance();
|
||||||
|
|
||||||
|
// If we're running Android, only initialize
|
||||||
|
// the first time class is instanced
|
||||||
|
#ifdef ANDROID
|
||||||
|
if (!_hasInitedStatics) {
|
||||||
|
_hasInitedStatics = true;
|
||||||
|
#endif
|
||||||
|
Material::initMaterials();
|
||||||
|
MobCategory::initMobCategories();
|
||||||
|
Tile::initTiles();
|
||||||
|
Item::initItems();
|
||||||
|
Biome::initBiomes();
|
||||||
|
TileEntity::initTileEntities();
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
setIsCreativeMode(false); // false means it's Survival Mode
|
||||||
|
|
||||||
|
#if !defined(NO_STORAGE)
|
||||||
|
storageSource = new ExternalFileLevelStorageSource(externalStoragePath, externalCacheStoragePath);
|
||||||
|
#else
|
||||||
|
storageSource = new MemoryLevelStorageSource();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Server-only featire @todo server class app
|
||||||
|
hostMultiplayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Multiplayer
|
||||||
|
//
|
||||||
|
|
||||||
|
void Minecraft::hostMultiplayer(int port) {
|
||||||
|
// Tear down last instance
|
||||||
|
raknetInstance->disconnect();
|
||||||
|
delete netCallback;
|
||||||
|
netCallback = nullptr;
|
||||||
|
|
||||||
|
#if !defined(NO_NETWORK)
|
||||||
|
netCallback = new ServerSideNetworkHandler(this, raknetInstance);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Level generation
|
||||||
|
//
|
||||||
|
/*static*/
|
||||||
|
|
||||||
|
void* Minecraft::prepareLevel_tspawn(void *p_param) {
|
||||||
|
Minecraft* mc = (Minecraft*) p_param;
|
||||||
|
mc->generateLevel("Currently not used", mc->level);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::generateLevel( const std::string& message, Level* level ) {
|
||||||
|
Stopwatch s;
|
||||||
|
s.start();
|
||||||
|
prepareLevel(message);
|
||||||
|
s.stop();
|
||||||
|
s.print("Level generated: ");
|
||||||
|
|
||||||
|
// "Unlock"
|
||||||
|
isGeneratingLevel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::_levelGenerated() {
|
||||||
|
level->validateSpawn();
|
||||||
|
|
||||||
|
if (raknetInstance->isServer())
|
||||||
|
raknetInstance->announceServer(getServerName());
|
||||||
|
|
||||||
|
if (netCallback) {
|
||||||
|
netCallback->levelGenerated(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
_hasSignaledGeneratingLevelFinished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player* Minecraft::respawnPlayer(int playerId) {
|
||||||
|
for (unsigned int i = 0; i < level->players.size(); ++i) {
|
||||||
|
if (level->players[i]->entityId == playerId) {
|
||||||
|
resetPlayer(level->players[i]);
|
||||||
|
return level->players[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::resetPlayer(Player* player) {
|
||||||
|
level->validateSpawn();
|
||||||
|
player->reset();
|
||||||
|
|
||||||
|
Pos p;
|
||||||
|
if(player->hasRespawnPosition()) {
|
||||||
|
p = player->getRespawnPosition();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p = level->getSharedSpawnPos();
|
||||||
|
}
|
||||||
|
player->setPos((float)p.x + 0.5f, (float)p.y + 1.0f, (float)p.z + 0.5f);
|
||||||
|
player->resetPos(true);
|
||||||
|
|
||||||
|
if (isCreativeMode())
|
||||||
|
player->inventory->clearInventoryWithDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Minecraft::getProgressStatusId() {
|
||||||
|
return progressStageStatusId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* Minecraft::getProgressMessage()
|
||||||
|
{
|
||||||
|
return progressMessages[progressStageStatusId];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Minecraft::isLevelGenerated()
|
||||||
|
{
|
||||||
|
return level != NULL && !isGeneratingLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelStorageSource* Minecraft::getLevelSource()
|
||||||
|
{
|
||||||
|
return storageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::setIsCreativeMode(bool isCreative)
|
||||||
|
{
|
||||||
|
#ifdef CREATORMODE
|
||||||
|
delete gameMode;
|
||||||
|
gameMode = new CreatorMode(this);
|
||||||
|
_isCreativeMode = true;
|
||||||
|
#else
|
||||||
|
if (!gameMode || isCreative != _isCreativeMode)
|
||||||
|
{
|
||||||
|
delete gameMode;
|
||||||
|
if (isCreative) gameMode = new CreativeMode(*this);
|
||||||
|
else gameMode = new SurvivalMode(*this);
|
||||||
|
_isCreativeMode = isCreative;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Minecraft::isCreativeMode() {
|
||||||
|
return _isCreativeMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
ICreator* Minecraft::getCreator()
|
||||||
|
{
|
||||||
|
#ifdef CREATORMODE
|
||||||
|
return ((CreatorMode*)gameMode)->getCreator();
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::optionUpdated(OptionId option, bool value ) {
|
||||||
|
if(netCallback != NULL && option == OPTIONS_SERVER_VISIBLE) {
|
||||||
|
ServerSideNetworkHandler* ss = (ServerSideNetworkHandler*) netCallback;
|
||||||
|
ss->allowIncomingConnections(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Minecraft::optionUpdated(OptionId option, float value ) {}
|
||||||
|
|
||||||
|
void Minecraft::optionUpdated(OptionId option, int value ) {}
|
||||||
140
src/Minecraft.h
Executable file
140
src/Minecraft.h
Executable file
@@ -0,0 +1,140 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT__Minecraft_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT__Minecraft_H__
|
||||||
|
|
||||||
|
#include "client/Options.h"
|
||||||
|
#include "client/Timer.h"
|
||||||
|
|
||||||
|
//#include "../network/RakNetInstance.h"
|
||||||
|
#include "world/phys/HitResult.h"
|
||||||
|
|
||||||
|
#include "App.h"
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
class Level;
|
||||||
|
class LocalPlayer;
|
||||||
|
class IInputHolder;
|
||||||
|
class Mob;
|
||||||
|
class Player;
|
||||||
|
class Entity;
|
||||||
|
class ICreator;
|
||||||
|
class GameMode;
|
||||||
|
class CThread;
|
||||||
|
class LevelStorageSource;
|
||||||
|
class BuildActionIntention;
|
||||||
|
class PerfRenderer;
|
||||||
|
class LevelSettings;
|
||||||
|
class IRakNetInstance;
|
||||||
|
class NetEventCallback;
|
||||||
|
class CommandServer;
|
||||||
|
struct PingedCompatibleServer;
|
||||||
|
|
||||||
|
class Minecraft: public App {
|
||||||
|
public:
|
||||||
|
using App::App;
|
||||||
|
virtual ~Minecraft();
|
||||||
|
|
||||||
|
virtual void init();
|
||||||
|
virtual void update();
|
||||||
|
virtual void restartServer();
|
||||||
|
virtual void tick(int nTick, int maxTick);
|
||||||
|
|
||||||
|
virtual bool isOnlineClient();
|
||||||
|
virtual bool isOnline();
|
||||||
|
|
||||||
|
virtual void setIsCreativeMode(bool isCreative);
|
||||||
|
|
||||||
|
virtual void optionUpdated(OptionId option, bool value);
|
||||||
|
virtual void optionUpdated(OptionId option, float value);
|
||||||
|
virtual void optionUpdated(OptionId option, int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get public name that will be listed in JoinGame menu
|
||||||
|
*/
|
||||||
|
virtual std::string getServerName() { return "Unknown"; }
|
||||||
|
|
||||||
|
void toggleDimension() {}
|
||||||
|
bool isCreativeMode();
|
||||||
|
|
||||||
|
virtual void selectLevel(const std::string& levelId, const std::string& levelName, const LevelSettings& settings);
|
||||||
|
virtual void setLevel(Level* level, const std::string& message = "", Player* forceInsertPlayer = NULL);
|
||||||
|
|
||||||
|
virtual void onBlockDestroyed(Player* player, int x, int y, int z, int face) {}
|
||||||
|
|
||||||
|
void generateLevel( const std::string& message, Level* level );
|
||||||
|
LevelStorageSource* getLevelSource();
|
||||||
|
|
||||||
|
virtual void hostMultiplayer(int port=19132);
|
||||||
|
Player* respawnPlayer(int playerId);
|
||||||
|
void respawnPlayer();
|
||||||
|
void resetPlayer(Player* player);
|
||||||
|
void doActuallyRespawnPlayer();
|
||||||
|
|
||||||
|
void prepareLevel(const std::string& message);
|
||||||
|
|
||||||
|
int getProgressStatusId();
|
||||||
|
const char* getProgressMessage();
|
||||||
|
|
||||||
|
ICreator* getCreator();
|
||||||
|
|
||||||
|
bool isLevelGenerated();
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
bool _isSuperFast = false;
|
||||||
|
bool isSuperFast() { return _isSuperFast; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void _levelGenerated();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void* prepareLevel_tspawn(void *p_param);
|
||||||
|
public:
|
||||||
|
Level* level = nullptr;
|
||||||
|
CommandServer* _commandServer = nullptr;
|
||||||
|
GameMode* gameMode = nullptr;
|
||||||
|
IRakNetInstance* raknetInstance = nullptr;
|
||||||
|
NetEventCallback* netCallback = nullptr;
|
||||||
|
|
||||||
|
int commandPort = 4711;
|
||||||
|
|
||||||
|
int lastTime = 0;
|
||||||
|
int lastTickTime = -1;
|
||||||
|
int missTime = 0;
|
||||||
|
int ticks = 0;
|
||||||
|
|
||||||
|
CThread* generateLevelThread = nullptr;
|
||||||
|
// static int customDebugId;
|
||||||
|
|
||||||
|
HitResult hitResult;
|
||||||
|
volatile int progressStagePercentage = 0;
|
||||||
|
|
||||||
|
// This field is initialized in main()
|
||||||
|
// It sets the base path to where worlds can be written (sdcard on android)
|
||||||
|
std::string externalStoragePath;
|
||||||
|
std::string externalCacheStoragePath;
|
||||||
|
protected:
|
||||||
|
Timer timer{20};
|
||||||
|
// @note @attn @warn: this is dangerous as fuck!
|
||||||
|
volatile bool isGeneratingLevel = false;
|
||||||
|
bool _hasSignaledGeneratingLevelFinished = true;
|
||||||
|
|
||||||
|
LevelStorageSource* storageSource;
|
||||||
|
bool _running;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
volatile int progressStageStatusId = 0;
|
||||||
|
static const char* progressMessages[];
|
||||||
|
|
||||||
|
int _licenseId;
|
||||||
|
|
||||||
|
bool _isCreativeMode;
|
||||||
|
Player* _pendingRemovePlayer; // @attn @todo @fix: remove this shait and fix the respawn behaviour
|
||||||
|
|
||||||
|
// from NinecraftApp
|
||||||
|
bool _verbose = true;
|
||||||
|
int _lastTickMs = 0;
|
||||||
|
|
||||||
|
static bool _hasInitedStatics;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT__Minecraft_H__*/
|
||||||
2864
src/client/Minecraft.cpp → src/MinecraftClient.cpp
Executable file → Normal file
2864
src/client/Minecraft.cpp → src/MinecraftClient.cpp
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
142
src/MinecraftClient.h
Normal file
142
src/MinecraftClient.h
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "client/gui/Font.h"
|
||||||
|
#include "client/gui/Screen.h"
|
||||||
|
#include "client/particle/ParticleEngine.h"
|
||||||
|
#include "client/player/LocalPlayer.h"
|
||||||
|
#include "client/renderer/GameRenderer.h"
|
||||||
|
#include "client/renderer/Textures.h"
|
||||||
|
#include "client/sound/SoundEngine.h"
|
||||||
|
#include <Minecraft.h>
|
||||||
|
|
||||||
|
#include <client/MouseHandler.h>
|
||||||
|
#include <client/gui/Gui.h>
|
||||||
|
#include <client/gui/screens/ScreenChooser.h>
|
||||||
|
#include <client/PixelCalc.h>
|
||||||
|
#include <client/renderer/LevelRenderer.h>
|
||||||
|
|
||||||
|
class MinecraftClient : public Minecraft {
|
||||||
|
public:
|
||||||
|
using Minecraft::Minecraft;
|
||||||
|
~MinecraftClient();
|
||||||
|
|
||||||
|
void init() override;
|
||||||
|
|
||||||
|
void update() override;
|
||||||
|
|
||||||
|
void setSize(int width, int height);
|
||||||
|
void reloadOptions();
|
||||||
|
|
||||||
|
bool supportNonTouchScreen();
|
||||||
|
bool useTouchscreen();
|
||||||
|
void grabMouse();
|
||||||
|
void releaseMouse();
|
||||||
|
|
||||||
|
void setScreen(Screen*);
|
||||||
|
void leaveGame(bool renameLevel = false);
|
||||||
|
|
||||||
|
void setLevel(Level* level, const std::string& message = "", Player* forceInsertPlayer = NULL) override;
|
||||||
|
|
||||||
|
void updateStats();
|
||||||
|
|
||||||
|
void restartServer() override;
|
||||||
|
|
||||||
|
bool handleBack(bool isDown) override;
|
||||||
|
|
||||||
|
void onGraphicsReset();
|
||||||
|
void initGLStates();
|
||||||
|
|
||||||
|
void tick(int nTick, int maxTick) override;
|
||||||
|
void tickInput();
|
||||||
|
|
||||||
|
void handleBuildAction(BuildActionIntention* action);
|
||||||
|
|
||||||
|
bool isOnlineClient() override;
|
||||||
|
|
||||||
|
void pauseGame(bool isBackPaused);
|
||||||
|
void gameLostFocus();
|
||||||
|
|
||||||
|
void respawnPlayer();
|
||||||
|
|
||||||
|
void audioEngineOn() override;
|
||||||
|
void audioEngineOff() override;
|
||||||
|
|
||||||
|
void setIsCreativeMode(bool isCreative) override;
|
||||||
|
|
||||||
|
void optionUpdated(OptionId option, bool value) override;
|
||||||
|
void optionUpdated(OptionId option, float value) override;
|
||||||
|
void optionUpdated(OptionId option, int value) override;
|
||||||
|
|
||||||
|
LocalPlayer* getPlayer() { return player; }
|
||||||
|
Font* getFont() { return font; }
|
||||||
|
Textures& textures() { return m_textures; }
|
||||||
|
Options& options() { return m_options;}
|
||||||
|
Screen* getScreen() { return m_screen; }
|
||||||
|
Gui& gui() { return m_gui; }
|
||||||
|
ParticleEngine* getParticleEngine() {return particleEngine; }
|
||||||
|
|
||||||
|
int getScreenWidth() { return width; }
|
||||||
|
int getScreenHeigth() { return height; }
|
||||||
|
|
||||||
|
virtual void hostMultiplayer(int port) override;
|
||||||
|
|
||||||
|
bool isPowerVR() { return _powerVr; }
|
||||||
|
bool isKindleFire(int kindleVersion);
|
||||||
|
bool transformResolution(int* w, int* h);
|
||||||
|
|
||||||
|
virtual std::string getServerName() override;
|
||||||
|
|
||||||
|
void locateMultiplayer();
|
||||||
|
void cancelLocateMultiplayer();
|
||||||
|
bool joinMultiplayer(const PingedCompatibleServer& server);
|
||||||
|
bool joinMultiplayerFromString(const std::string& server);
|
||||||
|
|
||||||
|
void onBlockDestroyed(Player* player, int x, int y, int z, int face) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void _reloadInput();
|
||||||
|
void _levelGenerated() override;
|
||||||
|
|
||||||
|
int width = 1, height = 1;
|
||||||
|
|
||||||
|
Font* font = nullptr;
|
||||||
|
// @warn This is unsafe cuz Gui may call some MinecraftClient method while MinecraftClient is not ready
|
||||||
|
MouseHandler mouseHandler;
|
||||||
|
|
||||||
|
LevelRenderer* levelRenderer = nullptr;
|
||||||
|
GameRenderer* gameRenderer = nullptr;
|
||||||
|
ParticleEngine* particleEngine = nullptr;
|
||||||
|
SoundEngine* soundEngine = nullptr;
|
||||||
|
PerfRenderer* _perfRenderer = nullptr;
|
||||||
|
|
||||||
|
bool mouseGrabbed = false;
|
||||||
|
|
||||||
|
PixelCalc pixelCalc;
|
||||||
|
PixelCalc pixelCalcUi;
|
||||||
|
|
||||||
|
Screen* m_screen = nullptr;
|
||||||
|
|
||||||
|
bool screenMutex = false;
|
||||||
|
bool hasScheduledScreen = false;
|
||||||
|
Screen* scheduledScreen = nullptr;
|
||||||
|
|
||||||
|
int m_frames = 0;
|
||||||
|
|
||||||
|
volatile bool pause = false;
|
||||||
|
|
||||||
|
// @todo make static
|
||||||
|
LocalPlayer* player = nullptr;
|
||||||
|
IInputHolder* inputHolder = nullptr;
|
||||||
|
Mob* cameraTargetPlayer = nullptr;
|
||||||
|
|
||||||
|
bool _supportsNonTouchscreen = false;
|
||||||
|
bool isLookingForMultiplayer = false;
|
||||||
|
bool _powerVr = false;
|
||||||
|
|
||||||
|
Options m_options{*this};
|
||||||
|
|
||||||
|
Textures m_textures{m_options, *m_platform};
|
||||||
|
|
||||||
|
ScreenChooser screenChooser{*this};
|
||||||
|
|
||||||
|
Gui m_gui{*this};
|
||||||
|
};
|
||||||
15
src/MinecraftServer.cpp
Normal file
15
src/MinecraftServer.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include "MinecraftServer.h"
|
||||||
|
#include <Minecraft.h>
|
||||||
|
#include <network/RakNetInstance.h>
|
||||||
|
|
||||||
|
|
||||||
|
void MinecraftServer::hostMultiplayer(int port) {
|
||||||
|
Minecraft::hostMultiplayer(port);
|
||||||
|
|
||||||
|
raknetInstance->host("Server", port, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string MinecraftServer::getServerName() {
|
||||||
|
// @todo read server name from config
|
||||||
|
return "Dedicated server 0.6.1";
|
||||||
|
}
|
||||||
10
src/MinecraftServer.h
Normal file
10
src/MinecraftServer.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Minecraft.h>
|
||||||
|
|
||||||
|
class MinecraftServer : public Minecraft {
|
||||||
|
public:
|
||||||
|
using Minecraft::Minecraft;
|
||||||
|
|
||||||
|
void hostMultiplayer(int port) override;
|
||||||
|
std::string getServerName() override;
|
||||||
|
};
|
||||||
@@ -1,428 +0,0 @@
|
|||||||
#include "NinecraftApp.h"
|
|
||||||
//#include <EGL/egl.h>
|
|
||||||
|
|
||||||
#ifdef RPI
|
|
||||||
//#define NO_STORAGE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "platform/input/Mouse.h"
|
|
||||||
#include "platform/input/Multitouch.h"
|
|
||||||
|
|
||||||
#include "world/item/Item.h"
|
|
||||||
#include "world/level/Level.h"
|
|
||||||
#include "world/level/biome/Biome.h"
|
|
||||||
#include "world/level/material/Material.h"
|
|
||||||
#include "world/entity/MobCategory.h"
|
|
||||||
//#include "world/level/storage/FolderMethods.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "client/gui/screens/StartMenuScreen.h"
|
|
||||||
#include "client/gui/screens/UsernameScreen.h"
|
|
||||||
#endif
|
|
||||||
#include "client/player/LocalPlayer.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "client/renderer/gles.h"
|
|
||||||
#include "client/renderer/Chunk.h"
|
|
||||||
#include "client/renderer/LevelRenderer.h"
|
|
||||||
#include "client/renderer/Tesselator.h"
|
|
||||||
#endif
|
|
||||||
// sorry for raknet dependency, but I'm too lazy to find another getTime method
|
|
||||||
#include "raknet/GetTime.h"
|
|
||||||
#include "network/RakNetInstance.h"
|
|
||||||
#include "network/ClientSideNetworkHandler.h"
|
|
||||||
#include "client/gui/screens/ProgressScreen.h"
|
|
||||||
|
|
||||||
//#include "world/entity/player/Inventory2.h"
|
|
||||||
|
|
||||||
#if !defined(DEMO_MODE) && !defined(APPLE_DEMO_PROMOTION) && !defined(NO_STORAGE)
|
|
||||||
#include "world/level/storage/ExternalFileLevelStorageSource.h"
|
|
||||||
#else
|
|
||||||
#include "world/level/storage/MemoryLevelStorageSource.h"
|
|
||||||
#endif
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "client/renderer/Textures.h"
|
|
||||||
#include "client/renderer/entity/ItemRenderer.h"
|
|
||||||
#endif
|
|
||||||
#include "world/item/crafting/Recipes.h"
|
|
||||||
#include "world/level/tile/entity/TileEntity.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "client/renderer/EntityTileRenderer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool NinecraftApp::_hasInitedStatics = false;
|
|
||||||
|
|
||||||
NinecraftApp::NinecraftApp()
|
|
||||||
: _verbose(true),
|
|
||||||
_lastTickMs(0),
|
|
||||||
_frames(0)
|
|
||||||
{
|
|
||||||
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
|
||||||
signal(SIGPIPE, SIG_IGN);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
NinecraftApp::~NinecraftApp()
|
|
||||||
{
|
|
||||||
teardown();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::init()
|
|
||||||
{
|
|
||||||
// Global initialization goes here
|
|
||||||
Mth::initMth();
|
|
||||||
|
|
||||||
//#ifdef DEMO_MODE
|
|
||||||
//writeDemoFile();
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
// If we're running Android, only initialize
|
|
||||||
// the first time class is instanced
|
|
||||||
#ifdef ANDROID
|
|
||||||
if (!_hasInitedStatics) {
|
|
||||||
_hasInitedStatics = true;
|
|
||||||
#endif
|
|
||||||
Material::initMaterials();
|
|
||||||
MobCategory::initMobCategories();
|
|
||||||
Tile::initTiles();
|
|
||||||
Item::initItems();
|
|
||||||
Biome::initBiomes();
|
|
||||||
TileEntity::initTileEntities();
|
|
||||||
|
|
||||||
#ifdef ANDROID
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
initGLStates();
|
|
||||||
Tesselator::instance.init();
|
|
||||||
I18n::loadLanguage(platform(), "en_US");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!externalStoragePath.empty()) {
|
|
||||||
options.setOptionsFilePath(externalStoragePath);
|
|
||||||
}
|
|
||||||
Minecraft::init();
|
|
||||||
|
|
||||||
#if !defined(DEMO_MODE) && !defined(APPLE_DEMO_PROMOTION) && !defined(NO_STORAGE)
|
|
||||||
storageSource = new ExternalFileLevelStorageSource(externalStoragePath, externalCacheStoragePath);
|
|
||||||
#else
|
|
||||||
storageSource = new MemoryLevelStorageSource();
|
|
||||||
#endif
|
|
||||||
_running = false;
|
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
LOGI("This: %p\n", this);
|
|
||||||
screenChooser.setScreen(SCREEN_STARTMENU);
|
|
||||||
|
|
||||||
if (options.getBooleanValue(OPTIONS_FIRST_LAUNCH)) {
|
|
||||||
options.toggle(OPTIONS_FIRST_LAUNCH);
|
|
||||||
setScreen(new UsernameScreen());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
hostMultiplayer();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::teardown()
|
|
||||||
{
|
|
||||||
// Note: Don't tear down statics if we run on Android
|
|
||||||
// (we might change this in the future)
|
|
||||||
#ifndef ANDROID
|
|
||||||
Biome::teardownBiomes();
|
|
||||||
Item ::teardownItems();
|
|
||||||
Tile ::teardownTiles();
|
|
||||||
Material::teardownMaterials();
|
|
||||||
Recipes ::teardownRecipes();
|
|
||||||
TileEntity::teardownTileEntities();
|
|
||||||
#endif
|
|
||||||
#ifdef WIN32
|
|
||||||
ItemRenderer::teardown_static();
|
|
||||||
if (EntityTileRenderer::instance != NULL) {
|
|
||||||
delete EntityTileRenderer::instance;
|
|
||||||
EntityTileRenderer::instance = NULL;
|
|
||||||
}
|
|
||||||
TileEntityRenderDispatcher::destroy();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::update()
|
|
||||||
{
|
|
||||||
++_frames;
|
|
||||||
|
|
||||||
// Generate Multitouch active pointer list
|
|
||||||
Multitouch::commit();
|
|
||||||
|
|
||||||
#ifndef ANDROID_PUBLISH
|
|
||||||
//testCreationAndDestruction();
|
|
||||||
//testJoiningAndDestruction();
|
|
||||||
#endif /*ANDROID_PUBLISH*/
|
|
||||||
|
|
||||||
Minecraft::update();
|
|
||||||
|
|
||||||
swapBuffers();
|
|
||||||
Mouse::reset2();
|
|
||||||
|
|
||||||
// Restart the server if (our modded) RakNet reports an error
|
|
||||||
if (level && raknetInstance->isProbablyBroken() && raknetInstance->isServer()) {
|
|
||||||
restartServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
updateStats();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::updateStats()
|
|
||||||
{
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
if (Options::debugGl)
|
|
||||||
LOGI("--------------------------------------------\n");
|
|
||||||
|
|
||||||
//*
|
|
||||||
int now = getTimeMs();
|
|
||||||
//int since = now - _lastTickMs;
|
|
||||||
|
|
||||||
if (now >= lastTime + 1000)
|
|
||||||
{
|
|
||||||
if (player) {
|
|
||||||
LOGI("%d fps \t%3d chunk updates. (%.2f, %.2f, %.2f)\n",
|
|
||||||
_frames, Chunk::updates, player->x, player->y, player->z);
|
|
||||||
Chunk::resetUpdates();
|
|
||||||
|
|
||||||
//static int _n = 0;
|
|
||||||
//if (++_n % 5 == -1) { // @note: -1
|
|
||||||
// static char filename[256];
|
|
||||||
// sprintf(filename, "%s/games/com.mojang/img_%.4d.jpg", externalStoragePath.c_str(), _n/5);
|
|
||||||
// _context.platform->saveScreenshot(filename, width, height);
|
|
||||||
//}
|
|
||||||
|
|
||||||
LOGI("%s", levelRenderer->gatherStats1().c_str());
|
|
||||||
//printf("Texture swaps (this frame): %d\n", Textures::textureChanges);
|
|
||||||
} else {
|
|
||||||
LOGI("%d fps\n", _frames);
|
|
||||||
}
|
|
||||||
|
|
||||||
//const int* pointerIds;
|
|
||||||
//int pointerCount = Multitouch::getActivePointerIds(&pointerIds);
|
|
||||||
//if (pointerCount) {
|
|
||||||
// std::string s = "Pointers (";
|
|
||||||
// s += (char)(48 + pointerCount);
|
|
||||||
// s += ": ";
|
|
||||||
// for (int i = 0; i < pointerCount; ++i) {
|
|
||||||
// s += (char)(48 + pointerIds[i]);
|
|
||||||
// s += ", ";
|
|
||||||
// }
|
|
||||||
// LOGI("%s\n", s.c_str());
|
|
||||||
//}
|
|
||||||
|
|
||||||
lastTime = now;
|
|
||||||
_frames = 0;
|
|
||||||
#ifdef GLDEBUG
|
|
||||||
while (1) {
|
|
||||||
int error = glGetError();
|
|
||||||
if (error == GL_NO_ERROR) break;
|
|
||||||
|
|
||||||
LOGI("#################### GL-ERROR: %d\t#####################\n", error);
|
|
||||||
LOGI("#################### GL-ERROR: %d\t#####################\n", error);
|
|
||||||
LOGI("#################### GL-ERROR: %d\t#####################\n", error);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
Textures::textureChanges = 0;
|
|
||||||
/**/
|
|
||||||
#endif /* STANDALONE_SERVER */
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::initGLStates()
|
|
||||||
{
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
//glShadeModel2(GL_SMOOTH);
|
|
||||||
//glClearDepthf(1.0f);
|
|
||||||
glEnable2(GL_DEPTH_TEST);
|
|
||||||
glDepthFunc(GL_LEQUAL);
|
|
||||||
glDepthRangef(0, 1);
|
|
||||||
glEnable2(GL_ALPHA_TEST);
|
|
||||||
glAlphaFunc(GL_GREATER, 0.1f);
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
glCullFace(GL_BACK);
|
|
||||||
|
|
||||||
glEnable2(GL_TEXTURE_2D);
|
|
||||||
#ifndef _EMSCRIPTEN_
|
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
|
||||||
#endif
|
|
||||||
// Both updates isPowerVR flag in java and returns if the graphics chip is PowerVR SGX or not
|
|
||||||
_powerVr = platform()->isPowerVR();
|
|
||||||
#ifdef __APPLE__
|
|
||||||
_isSuperFast = platform()->isSuperFast();
|
|
||||||
#endif
|
|
||||||
//glLineWidth(4);
|
|
||||||
#endif /* STANDALONE_SERVER */
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::restartServer() {
|
|
||||||
if (!level) return;
|
|
||||||
|
|
||||||
for (int i = level->players.size()-1; i >= 0; --i) {
|
|
||||||
Player* p = level->players[i];
|
|
||||||
if (p != player)
|
|
||||||
level->removeEntity(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
raknetInstance->resetIsBroken();
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
gui.addMessage("This server has restarted!");
|
|
||||||
#endif
|
|
||||||
hostMultiplayer();
|
|
||||||
if (netCallback) netCallback->levelGenerated(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NinecraftApp::handleBack(bool isDown)
|
|
||||||
{
|
|
||||||
if (isGeneratingLevel)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (level)
|
|
||||||
{
|
|
||||||
if (!isDown)
|
|
||||||
{
|
|
||||||
if (screen)
|
|
||||||
{
|
|
||||||
if (!screen->handleBackEvent(isDown))
|
|
||||||
{
|
|
||||||
if (player->containerMenu) player->closeContainer();
|
|
||||||
setScreen(NULL);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
pauseGame(true);
|
|
||||||
}
|
|
||||||
//leaveGame();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (screen)
|
|
||||||
{
|
|
||||||
return screen->handleBackEvent(isDown);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NinecraftApp::onGraphicsReset()
|
|
||||||
{
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
initGLStates();
|
|
||||||
Tesselator::instance.init();
|
|
||||||
|
|
||||||
Minecraft::onGraphicsReset();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef ANDROID_PUBLISH
|
|
||||||
|
|
||||||
static int _state = -1;
|
|
||||||
static int _stateTicksLeft = 0;
|
|
||||||
void NinecraftApp::testCreationAndDestruction()
|
|
||||||
{
|
|
||||||
if (_state == -1) {
|
|
||||||
_stateTicksLeft = 100;
|
|
||||||
_state = 0;
|
|
||||||
}
|
|
||||||
if (_state == 0) {
|
|
||||||
if (--_stateTicksLeft <= 0)
|
|
||||||
_state = 1;
|
|
||||||
}
|
|
||||||
else if (_state == 1) {
|
|
||||||
getLevelSource()->deleteLevel("perf");
|
|
||||||
int seed = getEpochTimeS();
|
|
||||||
LOGI(">seed %d\n", seed);
|
|
||||||
selectLevel("perf", "perf", LevelSettings(seed, GameType::Creative));
|
|
||||||
hostMultiplayer();
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
setScreen(new ProgressScreen());
|
|
||||||
#endif
|
|
||||||
_state = 2;
|
|
||||||
_stateTicksLeft = 1000;//25000;//00;
|
|
||||||
}
|
|
||||||
else if (_state == 2) {
|
|
||||||
if (isLevelGenerated()) {
|
|
||||||
if (--_stateTicksLeft <= 0) {
|
|
||||||
_state = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (_state == 3) {
|
|
||||||
leaveGame();
|
|
||||||
_state = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void NinecraftApp::testJoiningAndDestruction()
|
|
||||||
{
|
|
||||||
if (_state == -1) {
|
|
||||||
//LightUpdate sz[2] = { LightUpdate(LightLayer::Block, 0, 0, 0, 1, 1, 1),
|
|
||||||
// LightUpdate(LightLayer::Sky, 0, 0, 0, 1, 1, 1) };
|
|
||||||
//LOGI("size of lightupdate: %lu == %d\n", sizeof(LightUpdate), (const char*)&sz[1] - (const char*)&sz[0]);
|
|
||||||
_stateTicksLeft = 100;
|
|
||||||
_state = 0;
|
|
||||||
}
|
|
||||||
if (_state == 0) {
|
|
||||||
if (--_stateTicksLeft <= 0) {
|
|
||||||
raknetInstance->clearServerList();
|
|
||||||
locateMultiplayer();
|
|
||||||
_state = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_state == 1) {
|
|
||||||
if (!raknetInstance->getServerList().empty()) {
|
|
||||||
PingedCompatibleServer s = raknetInstance->getServerList().at(0);
|
|
||||||
if (s.name.GetLength() > 0) {
|
|
||||||
joinMultiplayer(s);
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
setScreen(new ProgressScreen());
|
|
||||||
#endif
|
|
||||||
_state = 2;
|
|
||||||
_stateTicksLeft = 80;//1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (_state == 2) {
|
|
||||||
if (isLevelGenerated()) {
|
|
||||||
if (--_stateTicksLeft <= 0) {
|
|
||||||
_state = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (_state == 3) {
|
|
||||||
leaveGame();
|
|
||||||
_stateTicksLeft = 50;
|
|
||||||
_state = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /*ANDROID_PUBLISH*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
void NinecraftApp::writeDemoFile() {
|
|
||||||
std::string path = externalStoragePath + "/games";
|
|
||||||
|
|
||||||
if (createFolderIfNotExists(path.c_str())) {
|
|
||||||
path += "/com.mojang";
|
|
||||||
if (createFolderIfNotExists(path.c_str())) {
|
|
||||||
path += "/minecraftpe";
|
|
||||||
if (createFolderIfNotExists(path.c_str())) {
|
|
||||||
path += "/played_demo";
|
|
||||||
FILE* fp = fopen(path.c_str(), "w");
|
|
||||||
if (fp) fclose(fp);
|
|
||||||
}}}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NinecraftApp::hasPlayedDemo() {
|
|
||||||
std::string filename = externalStoragePath + "/games/com.mojang/minecraftpe/played_demo";
|
|
||||||
FILE* fp = fopen(filename.c_str(), "r");
|
|
||||||
if (!fp) return false;
|
|
||||||
fclose(fp);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
#ifndef NINECRAFTAPP_H__
|
|
||||||
#define NINECRAFTAPP_H__
|
|
||||||
|
|
||||||
#include "world/Pos.h"
|
|
||||||
#include "App.h"
|
|
||||||
#include "client/Minecraft.h"
|
|
||||||
#include "world/level/storage/MemoryLevelStorage.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
class Level;
|
|
||||||
class LocalPlayer;
|
|
||||||
class ExternalFileLevelStorageSource;
|
|
||||||
|
|
||||||
class NinecraftApp: public Minecraft
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NinecraftApp();
|
|
||||||
~NinecraftApp();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
void teardown();
|
|
||||||
|
|
||||||
void update();
|
|
||||||
|
|
||||||
virtual bool handleBack(bool isDown);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void onGraphicsReset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void initGLStates();
|
|
||||||
void restartServer();
|
|
||||||
|
|
||||||
void updateStats();
|
|
||||||
|
|
||||||
//void writeDemoFile();
|
|
||||||
//bool hasPlayedDemo();
|
|
||||||
|
|
||||||
#ifndef ANDROID_PUBLISH
|
|
||||||
void testCreationAndDestruction();
|
|
||||||
void testJoiningAndDestruction();
|
|
||||||
#endif /*ANDROID_PUBLISH*/
|
|
||||||
|
|
||||||
bool _verbose;
|
|
||||||
int _frames;
|
|
||||||
int _lastTickMs;
|
|
||||||
|
|
||||||
static bool _hasInitedStatics;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif//NINECRAFTAPP_H__
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT__KeyMapping_H__
|
|
||||||
#define NET_MINECRAFT_CLIENT__KeyMapping_H__
|
|
||||||
|
|
||||||
//package net.minecraft.client;
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class KeyMapping
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string name;
|
|
||||||
int key;
|
|
||||||
|
|
||||||
KeyMapping() {}
|
|
||||||
|
|
||||||
KeyMapping(const std::string& name_, int key_)
|
|
||||||
: name(name_),
|
|
||||||
key(key_)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT__KeyMapping_H__*/
|
|
||||||
@@ -1,230 +0,0 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT__Minecraft_H__
|
|
||||||
#define NET_MINECRAFT_CLIENT__Minecraft_H__
|
|
||||||
|
|
||||||
#include "Options.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "MouseHandler.h"
|
|
||||||
#include "gui/Gui.h"
|
|
||||||
#include "gui/screens/ScreenChooser.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "Timer.h"
|
|
||||||
|
|
||||||
//#include "../network/RakNetInstance.h"
|
|
||||||
#include "../world/phys/HitResult.h"
|
|
||||||
|
|
||||||
class Level;
|
|
||||||
class LocalPlayer;
|
|
||||||
class IInputHolder;
|
|
||||||
class Mob;
|
|
||||||
class Player;
|
|
||||||
class LevelRenderer;
|
|
||||||
class GameRenderer;
|
|
||||||
class ParticleEngine;
|
|
||||||
class Entity;
|
|
||||||
class ICreator;
|
|
||||||
class GameMode;
|
|
||||||
class Textures;
|
|
||||||
class CThread;
|
|
||||||
class SoundEngine;
|
|
||||||
class Screen;
|
|
||||||
class Font;
|
|
||||||
class LevelStorageSource;
|
|
||||||
class BuildActionIntention;
|
|
||||||
class PerfRenderer;
|
|
||||||
class LevelSettings;
|
|
||||||
class IRakNetInstance;
|
|
||||||
class NetEventCallback;
|
|
||||||
class CommandServer;
|
|
||||||
struct PingedCompatibleServer;
|
|
||||||
//class ExternalFileLevelStorageSource;
|
|
||||||
|
|
||||||
|
|
||||||
#include "../App.h"
|
|
||||||
#include "PixelCalc.h"
|
|
||||||
class AppPlatform;
|
|
||||||
class AppPlatform_android;
|
|
||||||
|
|
||||||
class Minecraft: public App
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
Minecraft();
|
|
||||||
public:
|
|
||||||
virtual ~Minecraft();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
void setSize(int width, int height);
|
|
||||||
void reloadOptions();
|
|
||||||
|
|
||||||
bool supportNonTouchScreen();
|
|
||||||
bool useTouchscreen();
|
|
||||||
void grabMouse();
|
|
||||||
void releaseMouse();
|
|
||||||
|
|
||||||
void handleBuildAction(BuildActionIntention*);
|
|
||||||
|
|
||||||
void toggleDimension(){}
|
|
||||||
bool isCreativeMode();
|
|
||||||
void setIsCreativeMode(bool isCreative);
|
|
||||||
void setScreen(Screen*);
|
|
||||||
|
|
||||||
virtual void selectLevel(const std::string& levelId, const std::string& levelName, const LevelSettings& settings);
|
|
||||||
virtual void setLevel(Level* level, const std::string& message = "", LocalPlayer* forceInsertPlayer = NULL);
|
|
||||||
|
|
||||||
void generateLevel( const std::string& message, Level* level );
|
|
||||||
LevelStorageSource* getLevelSource();
|
|
||||||
|
|
||||||
bool isLookingForMultiplayer;
|
|
||||||
void locateMultiplayer();
|
|
||||||
void cancelLocateMultiplayer();
|
|
||||||
bool joinMultiplayer(const PingedCompatibleServer& server);
|
|
||||||
bool joinMultiplayerFromString(const std::string& server);
|
|
||||||
void hostMultiplayer(int port=19132);
|
|
||||||
Player* respawnPlayer(int playerId);
|
|
||||||
void respawnPlayer();
|
|
||||||
void resetPlayer(Player* player);
|
|
||||||
void doActuallyRespawnPlayer();
|
|
||||||
|
|
||||||
void update();
|
|
||||||
|
|
||||||
void tick(int nTick, int maxTick);
|
|
||||||
void tickInput();
|
|
||||||
|
|
||||||
bool isOnlineClient();
|
|
||||||
bool isOnline();
|
|
||||||
void pauseGame(bool isBackPaused);
|
|
||||||
void gameLostFocus();
|
|
||||||
|
|
||||||
void prepareLevel(const std::string& message);
|
|
||||||
|
|
||||||
void leaveGame(bool renameLevel = false);
|
|
||||||
|
|
||||||
int getProgressStatusId();
|
|
||||||
const char* getProgressMessage();
|
|
||||||
|
|
||||||
ICreator* getCreator();
|
|
||||||
|
|
||||||
// void onGraphicsLost() {}
|
|
||||||
void onGraphicsReset();
|
|
||||||
|
|
||||||
bool isLevelGenerated();
|
|
||||||
|
|
||||||
void handleMouseDown(int button, bool down);
|
|
||||||
|
|
||||||
void audioEngineOn();
|
|
||||||
void audioEngineOff();
|
|
||||||
|
|
||||||
bool isPowerVR() { return _powerVr; }
|
|
||||||
bool isKindleFire(int kindleVersion);
|
|
||||||
bool transformResolution(int* w, int* h);
|
|
||||||
void optionUpdated(OptionId option, bool value);
|
|
||||||
void optionUpdated(OptionId option, float value);
|
|
||||||
void optionUpdated(OptionId option, int value);
|
|
||||||
#ifdef __APPLE__
|
|
||||||
bool _isSuperFast;
|
|
||||||
bool isSuperFast() { return _isSuperFast; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void _levelGenerated();
|
|
||||||
|
|
||||||
private:
|
|
||||||
static void* prepareLevel_tspawn(void *p_param);
|
|
||||||
|
|
||||||
void _reloadInput();
|
|
||||||
public:
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
|
|
||||||
// Vars that the platform is allowed to use in the future
|
|
||||||
int commandPort;
|
|
||||||
int reserved_d1, reserved_d2;
|
|
||||||
float reserved_f1, reserved_f2;
|
|
||||||
|
|
||||||
Options options;
|
|
||||||
|
|
||||||
static bool useAmbientOcclusion;
|
|
||||||
//static bool threadInterrupt;
|
|
||||||
|
|
||||||
volatile bool pause;
|
|
||||||
|
|
||||||
LevelRenderer* levelRenderer;
|
|
||||||
GameRenderer* gameRenderer;
|
|
||||||
ParticleEngine* particleEngine;
|
|
||||||
SoundEngine* soundEngine;
|
|
||||||
|
|
||||||
GameMode* gameMode;
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
Textures* textures;
|
|
||||||
ScreenChooser screenChooser;
|
|
||||||
Font* font;
|
|
||||||
#endif
|
|
||||||
IRakNetInstance* raknetInstance;
|
|
||||||
NetEventCallback* netCallback;
|
|
||||||
|
|
||||||
int lastTime;
|
|
||||||
int lastTickTime;
|
|
||||||
float ticksSinceLastUpdate;
|
|
||||||
|
|
||||||
Level* level;
|
|
||||||
|
|
||||||
LocalPlayer* player;
|
|
||||||
IInputHolder* inputHolder;
|
|
||||||
Mob* cameraTargetPlayer;
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
Gui gui;
|
|
||||||
#endif
|
|
||||||
CThread* generateLevelThread;
|
|
||||||
Screen* screen;
|
|
||||||
static int customDebugId;
|
|
||||||
|
|
||||||
static const int CDI_NONE = 0;
|
|
||||||
static const int CDI_GRAPHICS = 1;
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
MouseHandler mouseHandler;
|
|
||||||
#endif
|
|
||||||
bool mouseGrabbed;
|
|
||||||
|
|
||||||
PixelCalc pixelCalc;
|
|
||||||
PixelCalc pixelCalcUi;
|
|
||||||
|
|
||||||
HitResult hitResult;
|
|
||||||
volatile int progressStagePercentage;
|
|
||||||
|
|
||||||
// This field is initialized in main()
|
|
||||||
// It sets the base path to where worlds can be written (sdcard on android)
|
|
||||||
std::string externalStoragePath;
|
|
||||||
std::string externalCacheStoragePath;
|
|
||||||
protected:
|
|
||||||
Timer timer;
|
|
||||||
// @note @attn @warn: this is dangerous as fuck!
|
|
||||||
volatile bool isGeneratingLevel;
|
|
||||||
bool _hasSignaledGeneratingLevelFinished;
|
|
||||||
|
|
||||||
LevelStorageSource* storageSource;
|
|
||||||
bool _running;
|
|
||||||
bool _powerVr;
|
|
||||||
|
|
||||||
private:
|
|
||||||
volatile int progressStageStatusId;
|
|
||||||
static const char* progressMessages[];
|
|
||||||
|
|
||||||
int missTime;
|
|
||||||
int ticks;
|
|
||||||
bool screenMutex;
|
|
||||||
bool hasScheduledScreen;
|
|
||||||
Screen* scheduledScreen;
|
|
||||||
|
|
||||||
int _licenseId;
|
|
||||||
bool _supportsNonTouchscreen;
|
|
||||||
|
|
||||||
bool _isCreativeMode;
|
|
||||||
//int _respawnPlayerTicks;
|
|
||||||
Player* _pendingRemovePlayer; // @attn @todo @fix: remove this shait and fix the respawn behaviour
|
|
||||||
// shit* lmao
|
|
||||||
|
|
||||||
PerfRenderer* _perfRenderer;
|
|
||||||
CommandServer* _commandServer;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT__Minecraft_H__*/
|
|
||||||
@@ -104,4 +104,4 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_value;
|
std::string m_value;
|
||||||
};
|
};
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
#include "OptionStrings.h"
|
|
||||||
#include "Minecraft.h"
|
|
||||||
#include "../platform/log.h"
|
|
||||||
#include "../world/Difficulty.h"
|
#include "../world/Difficulty.h"
|
||||||
#include <cmath>
|
#include <MinecraftClient.h>
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
bool Options::debugGl = false;
|
bool Options::debugGl = false;
|
||||||
|
|
||||||
@@ -60,8 +55,6 @@ OptionBool useTouchscreen("useTouchscreen", true);
|
|||||||
|
|
||||||
OptionBool serverVisible("servervisible", true);
|
OptionBool serverVisible("servervisible", true);
|
||||||
|
|
||||||
OptionBool foliageTint("foliagetint", false);
|
|
||||||
|
|
||||||
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
||||||
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
||||||
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
||||||
@@ -138,8 +131,6 @@ void Options::initTable() {
|
|||||||
|
|
||||||
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
||||||
|
|
||||||
m_options[OPTIONS_KEY_FORWARD] = &keyForward;
|
m_options[OPTIONS_KEY_FORWARD] = &keyForward;
|
||||||
@@ -164,7 +155,6 @@ void Options::initTable() {
|
|||||||
m_options[OPTIONS_BAR_ON_TOP] = &barOnTop;
|
m_options[OPTIONS_BAR_ON_TOP] = &barOnTop;
|
||||||
m_options[OPTIONS_ALLOW_SPRINT] = &allowSprint;
|
m_options[OPTIONS_ALLOW_SPRINT] = &allowSprint;
|
||||||
m_options[OPTIONS_RPI_CURSOR] = &rpiCursor;
|
m_options[OPTIONS_RPI_CURSOR] = &rpiCursor;
|
||||||
m_options[OPTIONS_FOLIAGE_TINT] = &foliageTint;
|
|
||||||
|
|
||||||
m_options[OPTIONS_AUTOJUMP] = &autoJump;
|
m_options[OPTIONS_AUTOJUMP] = &autoJump;
|
||||||
m_options[OPTIONS_LAST_IP] = &lastIp;
|
m_options[OPTIONS_LAST_IP] = &lastIp;
|
||||||
@@ -295,13 +285,13 @@ void Options::setOptionsFilePath(const std::string& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Options::notifyOptionUpdate(OptionId key, bool value) {
|
void Options::notifyOptionUpdate(OptionId key, bool value) {
|
||||||
minecraft->optionUpdated(key, value);
|
minecraft.optionUpdated(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Options::notifyOptionUpdate(OptionId key, float value) {
|
void Options::notifyOptionUpdate(OptionId key, float value) {
|
||||||
minecraft->optionUpdated(key, value);
|
minecraft.optionUpdated(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Options::notifyOptionUpdate(OptionId key, int value) {
|
void Options::notifyOptionUpdate(OptionId key, int value) {
|
||||||
minecraft->optionUpdated(key, value);
|
minecraft.optionUpdated(key, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,8 @@
|
|||||||
//#include "locale/Language.h"
|
//#include "locale/Language.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdio>
|
#include <platform/input/Keyboard.h>
|
||||||
#include "../platform/input/Keyboard.h"
|
#include <util/StringUtils.h>
|
||||||
#include "../util/StringUtils.h"
|
|
||||||
#include "OptionsFile.h"
|
#include "OptionsFile.h"
|
||||||
#include "Option.h"
|
#include "Option.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
@@ -84,24 +83,19 @@ enum OptionId {
|
|||||||
OPTIONS_LAST_IP,
|
OPTIONS_LAST_IP,
|
||||||
|
|
||||||
OPTIONS_RPI_CURSOR,
|
OPTIONS_RPI_CURSOR,
|
||||||
OPTIONS_FOLIAGE_TINT,
|
|
||||||
// Should be last!
|
// Should be last!
|
||||||
OPTIONS_COUNT
|
OPTIONS_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
typedef std::vector<std::string> StringVector;
|
typedef std::vector<std::string> StringVector;
|
||||||
|
|
||||||
class Options
|
class Options
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// deepfriedwaffles: for iOS, was getting compile errors saying: No member named 'sound' in 'Options' and No member named 'music' in 'Options' so I floated them here. 1.0f means full volume out of the box, but if everything is too loud, you might want to try adjusting this
|
|
||||||
float sound = 1.0f;
|
|
||||||
float music = 1.0f;
|
|
||||||
|
|
||||||
static bool debugGl;
|
static bool debugGl;
|
||||||
|
|
||||||
Options(Minecraft* minecraft, const std::string& workingDirectory = "")
|
Options(MinecraftClient& minecraft, const std::string& workingDirectory = "")
|
||||||
: minecraft(minecraft) {
|
: minecraft(minecraft) {
|
||||||
// elements werent initialized so i was getting a garbage pointer and a crash
|
// elements werent initialized so i was getting a garbage pointer and a crash
|
||||||
m_options.fill(nullptr);
|
m_options.fill(nullptr);
|
||||||
@@ -166,7 +160,7 @@ private:
|
|||||||
std::array<Option*, OPTIONS_COUNT> m_options;
|
std::array<Option*, OPTIONS_COUNT> m_options;
|
||||||
OptionsFile optionsFile;
|
OptionsFile optionsFile;
|
||||||
|
|
||||||
Minecraft* minecraft;
|
MinecraftClient& minecraft;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT__Options_H__*/
|
#endif /*NET_MINECRAFT_CLIENT__Options_H__*/
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
#include "CreativeMode.h"
|
|
||||||
#include "../Minecraft.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../particle/ParticleEngine.h"
|
|
||||||
#endif
|
|
||||||
#include "../player/LocalPlayer.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../renderer/LevelRenderer.h"
|
|
||||||
#include "../sound/SoundEngine.h"
|
|
||||||
#endif
|
|
||||||
#include "../../world/level/Level.h"
|
|
||||||
//#include "../../network/Packet.h"
|
|
||||||
#include "../../network/packet/RemoveBlockPacket.h"
|
|
||||||
#include "../../world/entity/player/Abilities.h"
|
|
||||||
|
|
||||||
static const int DestructionTickDelay = 5;
|
|
||||||
|
|
||||||
CreativeMode::CreativeMode(Minecraft* minecraft)
|
|
||||||
: super(minecraft)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreativeMode::startDestroyBlock(int x, int y, int z, int face) {
|
|
||||||
if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id)
|
|
||||||
return;
|
|
||||||
|
|
||||||
creativeDestroyBlock(x, y, z, face);
|
|
||||||
destroyDelay = DestructionTickDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreativeMode::creativeDestroyBlock(int x, int y, int z, int face) {
|
|
||||||
minecraft->level->extinguishFire(x, y, z, face);
|
|
||||||
destroyBlock(x, y, z, face);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreativeMode::continueDestroyBlock(int x, int y, int z, int face) {
|
|
||||||
destroyDelay--;
|
|
||||||
if (destroyDelay <= 0) {
|
|
||||||
destroyDelay = DestructionTickDelay;
|
|
||||||
creativeDestroyBlock(x, y, z, face);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreativeMode::stopDestroyBlock() {
|
|
||||||
destroyDelay = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreativeMode::initAbilities( Abilities& abilities ) {
|
|
||||||
abilities.mayfly = true;
|
|
||||||
abilities.instabuild = true;
|
|
||||||
abilities.invulnerable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreativeMode::isCreativeType() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
#include "CreatorMode.h"
|
|
||||||
#include "../Minecraft.h"
|
|
||||||
#include "../particle/ParticleEngine.h"
|
|
||||||
#include "../player/LocalPlayer.h"
|
|
||||||
#include "../renderer/LevelRenderer.h"
|
|
||||||
#include "../sound/SoundEngine.h"
|
|
||||||
#include "../../world/level/Level.h"
|
|
||||||
//#include "../../network/Packet.h"
|
|
||||||
#include "../../network/packet/RemoveBlockPacket.h"
|
|
||||||
#include "../../world/entity/player/Abilities.h"
|
|
||||||
|
|
||||||
static const int DestructionTickDelay = 5;
|
|
||||||
|
|
||||||
class Creator: public ICreator {
|
|
||||||
//virtual void getEvents();
|
|
||||||
|
|
||||||
public:
|
|
||||||
Creator(/*int eventLifeTime*/)
|
|
||||||
: _tileEvents(32),
|
|
||||||
_tickId(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTick(int tick) {
|
|
||||||
_tickId = tick;
|
|
||||||
}
|
|
||||||
|
|
||||||
EventList<TileEvent>& getTileEvents() { return _tileEvents; }
|
|
||||||
|
|
||||||
void addevent_blockUse(int entityId, int x, int y, int z, int face) {
|
|
||||||
TileEvent t = {
|
|
||||||
entityId,
|
|
||||||
x,y,z,
|
|
||||||
face
|
|
||||||
};
|
|
||||||
_tileEvents.add(t, _tickId);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
EventList<TileEvent> _tileEvents;
|
|
||||||
int _tickId;
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatorMode::CreatorMode(Minecraft* minecraft)
|
|
||||||
: super(minecraft)
|
|
||||||
{
|
|
||||||
_creator = new Creator();
|
|
||||||
}
|
|
||||||
|
|
||||||
CreatorMode::~CreatorMode() {
|
|
||||||
delete _creator;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatorMode::startDestroyBlock(int x, int y, int z, int face) {
|
|
||||||
if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CreatorDestroyBlock(x, y, z, face);
|
|
||||||
destroyDelay = DestructionTickDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatorMode::CreatorDestroyBlock(int x, int y, int z, int face) {
|
|
||||||
minecraft->level->extinguishFire(x, y, z, face);
|
|
||||||
destroyBlock(x, y, z, face);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatorMode::continueDestroyBlock(int x, int y, int z, int face) {
|
|
||||||
destroyDelay--;
|
|
||||||
if (destroyDelay <= 0) {
|
|
||||||
destroyDelay = DestructionTickDelay;
|
|
||||||
CreatorDestroyBlock(x, y, z, face);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreatorMode::useItemOn( Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit ) {
|
|
||||||
if (item && item->id == ((Item*)Item::sword_iron)->id)
|
|
||||||
_creator->addevent_blockUse(player->entityId, x, y, z, face);
|
|
||||||
return super::useItemOn(player, level, item, x, y, z, face, hit);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatorMode::stopDestroyBlock() {
|
|
||||||
destroyDelay = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatorMode::initAbilities( Abilities& abilities ) {
|
|
||||||
abilities.mayfly = true;
|
|
||||||
abilities.instabuild = true;
|
|
||||||
abilities.invulnerable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CreatorMode::isCreativeType() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ICreator* CreatorMode::getCreator() {
|
|
||||||
return _creator;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreatorMode::tick() {
|
|
||||||
_creator->setTick(minecraft->level->getTime());
|
|
||||||
super::tick();
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
#include "SurvivalMode.h"
|
|
||||||
#include "../Minecraft.h"
|
|
||||||
#include "../player/LocalPlayer.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../particle/ParticleEngine.h"
|
|
||||||
#include "../sound/SoundEngine.h"
|
|
||||||
#endif
|
|
||||||
#include "../../world/level/Level.h"
|
|
||||||
#include "../../world/entity/player/Abilities.h"
|
|
||||||
|
|
||||||
SurvivalMode::SurvivalMode( Minecraft* minecraft )
|
|
||||||
: super(minecraft),
|
|
||||||
xDestroyBlock(-1),
|
|
||||||
yDestroyBlock(-1),
|
|
||||||
zDestroyBlock(-1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurvivalMode::continueDestroyBlock( int x, int y, int z, int face ) {
|
|
||||||
if (destroyDelay > 0) {
|
|
||||||
destroyDelay--;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x == xDestroyBlock && y == yDestroyBlock && z == zDestroyBlock) {
|
|
||||||
int t = minecraft->level->getTile(x, y, z);
|
|
||||||
if (t == 0) return;
|
|
||||||
Tile* tile = Tile::tiles[t];
|
|
||||||
|
|
||||||
destroyProgress += tile->getDestroyProgress(minecraft->player);
|
|
||||||
|
|
||||||
if ((++destroyTicks & 3) == 1) {
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
if (tile != NULL) {
|
|
||||||
minecraft->soundEngine->play(tile->soundType->getStepSound(), x + 0.5f, y + 0.5f, z + 0.5f, (tile->soundType->getVolume() + 1) / 8, tile->soundType->getPitch() * 0.5f);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destroyProgress >= 1) {
|
|
||||||
destroyBlock(x, y, z, face);
|
|
||||||
destroyProgress = 0;
|
|
||||||
oDestroyProgress = 0;
|
|
||||||
destroyTicks = 0;
|
|
||||||
destroyDelay = 5;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
destroyProgress = 0;
|
|
||||||
oDestroyProgress = 0;
|
|
||||||
destroyTicks = 0;
|
|
||||||
xDestroyBlock = x;
|
|
||||||
yDestroyBlock = y;
|
|
||||||
zDestroyBlock = z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SurvivalMode::destroyBlock( int x, int y, int z, int face ) {
|
|
||||||
int t = minecraft->level->getTile(x, y, z);
|
|
||||||
int data = minecraft->level->getData(x, y, z);
|
|
||||||
bool changed = GameMode::destroyBlock(x, y, z, face);
|
|
||||||
bool couldDestroy = minecraft->player->canDestroy(Tile::tiles[t]);
|
|
||||||
|
|
||||||
ItemInstance* item = minecraft->player->inventory->getSelected();
|
|
||||||
if (item != NULL) {
|
|
||||||
item->mineBlock(t, x, y, z);
|
|
||||||
if (item->count == 0) {
|
|
||||||
//item->snap(minecraft->player);
|
|
||||||
minecraft->player->inventory->clearSlot(minecraft->player->inventory->selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (changed && couldDestroy) {
|
|
||||||
ItemInstance instance(t, 1, data);
|
|
||||||
Tile::tiles[t]->playerDestroy(minecraft->level, minecraft->player, x, y, z, data);
|
|
||||||
}
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurvivalMode::stopDestroyBlock() {
|
|
||||||
destroyProgress = 0;
|
|
||||||
destroyDelay = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurvivalMode::initAbilities( Abilities& abilities ) {
|
|
||||||
abilities.flying = false;
|
|
||||||
abilities.mayfly = false;
|
|
||||||
abilities.instabuild = false;
|
|
||||||
abilities.invulnerable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SurvivalMode::startDestroyBlock( int x, int y, int z, int face ) {
|
|
||||||
if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int t = minecraft->level->getTile(x, y, z);
|
|
||||||
if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft->level, x, y, z, minecraft->player);
|
|
||||||
if (t > 0 && Tile::tiles[t]->getDestroyProgress(minecraft->player) >= 1)
|
|
||||||
destroyBlock(x, y, z, face);
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
#include "Gui.h"
|
#include "Gui.h"
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
#include "MinecraftClient.h"
|
||||||
#include "client/Options.h"
|
#include "client/Options.h"
|
||||||
#include "platform/input/Keyboard.h"
|
#include "platform/input/Keyboard.h"
|
||||||
#include "screens/IngameBlockSelectionScreen.h"
|
#include "screens/IngameBlockSelectionScreen.h"
|
||||||
#include "screens/ChatScreen.h"
|
#include "screens/ChatScreen.h"
|
||||||
#include "screens/ConsoleScreen.h"
|
#include "screens/ConsoleScreen.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../player/LocalPlayer.h"
|
#include "../player/LocalPlayer.h"
|
||||||
#include "../renderer/Tesselator.h"
|
#include "../renderer/Tesselator.h"
|
||||||
#include "../renderer/TileRenderer.h"
|
#include "../renderer/TileRenderer.h"
|
||||||
@@ -29,39 +30,23 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#define MAX_MESSAGE_WIDTH 240
|
||||||
|
|
||||||
float Gui::InvGuiScale = 1.0f / 3.0f;
|
float Gui::InvGuiScale = 1.0f / 3.0f;
|
||||||
float Gui::GuiScale = 1.0f / Gui::InvGuiScale;
|
float Gui::GuiScale = 1.0f / Gui::InvGuiScale;
|
||||||
const float Gui::DropTicks = 40.0f;
|
const float Gui::DropTicks = 40.0f;
|
||||||
|
|
||||||
//#include <android/log.h>
|
//#include <android/log.h>
|
||||||
|
|
||||||
Gui::Gui(Minecraft* minecraft)
|
// @todo virtual controlConfigurationChanged() when player switches from keyboard to touch for example
|
||||||
: minecraft(minecraft),
|
Gui::Gui(MinecraftClient& minecraft) : minecraft(minecraft), _openInventorySlot(minecraft.useTouchscreen()) {
|
||||||
tickCount(0),
|
|
||||||
progress(0),
|
|
||||||
overlayMessageTime(0),
|
|
||||||
animateOverlayMessageColor(false),
|
|
||||||
chatScrollOffset(0),
|
|
||||||
tbr(1),
|
|
||||||
_inventoryNeedsUpdate(true),
|
|
||||||
_flashSlotId(-1),
|
|
||||||
_flashSlotStartTime(-1),
|
|
||||||
_slotFont(NULL),
|
|
||||||
_numSlots(4),
|
|
||||||
_currentDropTicks(-1),
|
|
||||||
_currentDropSlot(-1),
|
|
||||||
MAX_MESSAGE_WIDTH(240),
|
|
||||||
itemNameOverlayTime(2),
|
|
||||||
_openInventorySlot(minecraft->useTouchscreen())
|
|
||||||
{
|
|
||||||
glGenBuffers2(1, &_inventoryRc.vboId);
|
glGenBuffers2(1, &_inventoryRc.vboId);
|
||||||
glGenBuffers2(1, &rcFeedbackInner.vboId);
|
glGenBuffers2(1, &rcFeedbackInner.vboId);
|
||||||
glGenBuffers2(1, &rcFeedbackOuter.vboId);
|
glGenBuffers2(1, &rcFeedbackOuter.vboId);
|
||||||
//Gui::InvGuiScale = 1.0f / (int) (3 * Minecraft::width / 854);
|
//Gui::InvGuiScale = 1.0f / (int) (3 * Minecraft::width / 854);
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui::~Gui()
|
Gui::~Gui() {
|
||||||
{
|
|
||||||
if (_slotFont)
|
if (_slotFont)
|
||||||
delete _slotFont;
|
delete _slotFont;
|
||||||
|
|
||||||
@@ -69,17 +54,16 @@ Gui::~Gui()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||||
|
if (!minecraft.level || !minecraft.getPlayer())
|
||||||
if (!minecraft->level || !minecraft->player)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//minecraft->gameRenderer->setupGuiScreen();
|
//minecraft->gameRenderer->setupGuiScreen();
|
||||||
Font* font = minecraft->font;
|
Font* font = minecraft.getFont();
|
||||||
|
|
||||||
const bool isTouchInterface = minecraft->useTouchscreen();
|
const bool isTouchInterface = minecraft.useTouchscreen();
|
||||||
|
|
||||||
const int screenWidth = (int)(minecraft->width * InvGuiScale);
|
const int screenWidth = (int)(minecraft.getScreenWidth() * InvGuiScale);
|
||||||
const int screenHeight = (int)(minecraft->height * InvGuiScale);
|
const int screenHeight = (int)(minecraft.getScreenHeigth() * InvGuiScale);
|
||||||
blitOffset = -90;
|
blitOffset = -90;
|
||||||
renderProgressIndicator(isTouchInterface, screenWidth, screenHeight, a);
|
renderProgressIndicator(isTouchInterface, screenWidth, screenHeight, a);
|
||||||
|
|
||||||
@@ -91,9 +75,9 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||||||
// F: 3
|
// F: 3
|
||||||
int ySlot = screenHeight - 16 - 3;
|
int ySlot = screenHeight - 16 - 3;
|
||||||
|
|
||||||
if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
if (!minecraft.options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
||||||
if (minecraft->gameMode->canHurtPlayer()) {
|
if (minecraft.gameMode->canHurtPlayer()) {
|
||||||
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
minecraft.getTextures()->loadAndBindTexture("gui/icons.png");
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
t.beginOverride();
|
t.beginOverride();
|
||||||
t.colorABGR(0xffffffff);
|
t.colorABGR(0xffffffff);
|
||||||
@@ -103,7 +87,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(minecraft->player->getSleepTimer() > 0) {
|
if(minecraft.getPlayer()->getSleepTimer() > 0) {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
@@ -112,7 +96,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
if (!minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
if (!minecraft.options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
||||||
renderToolBar(a, ySlot, screenWidth);
|
renderToolBar(a, ySlot, screenWidth);
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "../../util/Random.h"
|
#include "../../util/Random.h"
|
||||||
#include "../IConfigListener.h"
|
#include "../IConfigListener.h"
|
||||||
|
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
class ItemInstance;
|
class ItemInstance;
|
||||||
class Textures;
|
class Textures;
|
||||||
class Tesselator;
|
class Tesselator;
|
||||||
@@ -27,7 +27,7 @@ typedef std::vector<GuiMessage> GuiMessageList;
|
|||||||
class Gui: public GuiComponent, IConfigListener
|
class Gui: public GuiComponent, IConfigListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Gui(Minecraft* minecraft);
|
Gui(MinecraftClient& minecraft);
|
||||||
~Gui();
|
~Gui();
|
||||||
|
|
||||||
int getSlotIdAt(int x, int y);
|
int getSlotIdAt(int x, int y);
|
||||||
@@ -90,43 +90,42 @@ private:
|
|||||||
void tickItemDrop();
|
void tickItemDrop();
|
||||||
float cubeSmoothStep(float percentage, float min, float max);
|
float cubeSmoothStep(float percentage, float min, float max);
|
||||||
public:
|
public:
|
||||||
float progress;
|
float progress = 0.f;
|
||||||
std::string selectedName;
|
std::string selectedName;
|
||||||
static float InvGuiScale;
|
static float InvGuiScale;
|
||||||
static float GuiScale;
|
static float GuiScale;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int MAX_MESSAGE_WIDTH;
|
|
||||||
//ItemRenderer itemRenderer;
|
//ItemRenderer itemRenderer;
|
||||||
GuiMessageList guiMessages;
|
GuiMessageList guiMessages;
|
||||||
int chatScrollOffset;
|
int chatScrollOffset = 0;
|
||||||
Random random;
|
Random random;
|
||||||
|
|
||||||
Minecraft* minecraft;
|
MinecraftClient& minecraft;
|
||||||
int tickCount;
|
int tickCount = 0;
|
||||||
float itemNameOverlayTime;
|
float itemNameOverlayTime = 2;
|
||||||
std::string overlayMessageString;
|
std::string overlayMessageString;
|
||||||
int overlayMessageTime;
|
int overlayMessageTime = 0;
|
||||||
bool animateOverlayMessageColor;
|
bool animateOverlayMessageColor = false;
|
||||||
|
|
||||||
float tbr;
|
float tbr = 1.f;
|
||||||
|
|
||||||
RenderChunk _inventoryRc;
|
RenderChunk _inventoryRc;
|
||||||
bool _inventoryNeedsUpdate;
|
bool _inventoryNeedsUpdate = true;
|
||||||
|
|
||||||
int _flashSlotId;
|
int _flashSlotId = -1;
|
||||||
float _flashSlotStartTime;
|
float _flashSlotStartTime = -1;
|
||||||
|
|
||||||
Font* _slotFont;
|
Font* _slotFont = nullptr;
|
||||||
int _numSlots;
|
int _numSlots = 4;
|
||||||
|
|
||||||
RenderChunk rcFeedbackOuter;
|
RenderChunk rcFeedbackOuter;
|
||||||
RenderChunk rcFeedbackInner;
|
RenderChunk rcFeedbackInner;
|
||||||
|
|
||||||
// For dropping
|
// For dropping
|
||||||
static const float DropTicks;
|
static const float DropTicks;
|
||||||
float _currentDropTicks;
|
float _currentDropTicks = -1;
|
||||||
int _currentDropSlot;
|
int _currentDropSlot = -1;
|
||||||
|
|
||||||
bool _openInventorySlot;
|
bool _openInventorySlot;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "components/Button.h"
|
#include "components/Button.h"
|
||||||
#include "components/TextBox.h"
|
#include "components/TextBox.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../renderer/Tesselator.h"
|
#include "../renderer/Tesselator.h"
|
||||||
#include "../sound/SoundEngine.h"
|
#include "../sound/SoundEngine.h"
|
||||||
#include "../../platform/input/Keyboard.h"
|
#include "../../platform/input/Keyboard.h"
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
#include "OptionsPane.h"
|
|
||||||
#include "OptionsGroup.h"
|
|
||||||
#include "OptionsItem.h"
|
|
||||||
#include "ImageButton.h"
|
|
||||||
#include "Slider.h"
|
|
||||||
#include "../../Minecraft.h"
|
|
||||||
#include "client/Options.h"
|
|
||||||
|
|
||||||
OptionsPane::OptionsPane() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsPane::setupPositions() {
|
|
||||||
int currentHeight = y + 1;
|
|
||||||
for(std::vector<GuiElement*>::iterator it = children.begin(); it != children.end(); ++it ) {
|
|
||||||
(*it)->width = width;
|
|
||||||
(*it)->y = currentHeight;
|
|
||||||
(*it)->x = x;
|
|
||||||
currentHeight += (*it)->height + 1;
|
|
||||||
}
|
|
||||||
height = currentHeight;
|
|
||||||
super::setupPositions();
|
|
||||||
}
|
|
||||||
|
|
||||||
OptionsGroup& OptionsPane::createOptionsGroup( std::string label ) {
|
|
||||||
OptionsGroup* newGroup = new OptionsGroup(label);
|
|
||||||
children.push_back(newGroup);
|
|
||||||
// create and return a new group index
|
|
||||||
return *newGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsPane::createToggle( unsigned int group, std::string label, OptionId option ) {
|
|
||||||
if(group > children.size()) return;
|
|
||||||
ImageDef def;
|
|
||||||
def.setSrc(IntRectangle(160, 206, 39, 20));
|
|
||||||
def.name = "gui/touchgui.png";
|
|
||||||
def.width = 39 * 0.7f;
|
|
||||||
def.height = 20 * 0.7f;
|
|
||||||
OptionButton* element = new OptionButton(option);
|
|
||||||
element->setImageDef(def, true);
|
|
||||||
OptionsItem* item = new OptionsItem(option, label, element);
|
|
||||||
((OptionsGroup*)children[group])->addChild(item);
|
|
||||||
setupPositions();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsPane::createProgressSlider( Minecraft* minecraft, unsigned int group, std::string label, OptionId option, float progressMin/*=1.0f*/, float progressMax/*=1.0f */ ) {
|
|
||||||
if(group > children.size()) return;
|
|
||||||
Slider* element = new SliderFloat(minecraft, option);
|
|
||||||
element->width = 100;
|
|
||||||
element->height = 20;
|
|
||||||
OptionsItem* item = new OptionsItem(option, label, element);
|
|
||||||
((OptionsGroup*)children[group])->addChild(item);
|
|
||||||
setupPositions();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OptionsPane::createStepSlider( Minecraft* minecraft, unsigned int group, std::string label, OptionId option, const std::vector<int>& stepVec ) {
|
|
||||||
if(group > children.size()) return;
|
|
||||||
Slider* element = new SliderInt(minecraft, option);
|
|
||||||
element->width = 100;
|
|
||||||
element->height = 20;
|
|
||||||
OptionsItem* item = new OptionsItem(option, label, element);
|
|
||||||
((OptionsGroup*)children[group])->addChild(item);
|
|
||||||
setupPositions();
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#ifndef ITEMPANE_H__
|
|
||||||
#define ITEMPANE_H__
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include "GuiElementContainer.h"
|
|
||||||
#include "../../../world/item/ItemInstance.h"
|
|
||||||
#include "../../../client/Options.h"
|
|
||||||
class Font;
|
|
||||||
class Textures;
|
|
||||||
class NinePatchLayer;
|
|
||||||
class ItemPane;
|
|
||||||
class OptionButton;
|
|
||||||
class Button;
|
|
||||||
class OptionsGroup;
|
|
||||||
class Slider;
|
|
||||||
class Minecraft;
|
|
||||||
class OptionsPane: public GuiElementContainer
|
|
||||||
{
|
|
||||||
typedef GuiElementContainer super;
|
|
||||||
public:
|
|
||||||
OptionsPane();
|
|
||||||
OptionsGroup& createOptionsGroup( std::string label );
|
|
||||||
void createToggle( unsigned int group, std::string label, OptionId option );
|
|
||||||
void createProgressSlider(Minecraft* minecraft, unsigned int group, std::string label, OptionId option, float progressMin=1.0f, float progressMax=1.0f );
|
|
||||||
void createStepSlider(Minecraft* minecraft, unsigned int group, std::string label, OptionId option, const std::vector<int>& stepVec );
|
|
||||||
void setupPositions();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*ITEMPANE_H__*/
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "RolledSelectionListH.h"
|
#include "RolledSelectionListH.h"
|
||||||
#include "../../Minecraft.h"
|
|
||||||
#include "../../renderer/Tesselator.h"
|
#include "../../renderer/Tesselator.h"
|
||||||
#include "../../renderer/gles.h"
|
#include "../../renderer/gles.h"
|
||||||
#include "../../../platform/input/Mouse.h"
|
#include "../../../platform/input/Mouse.h"
|
||||||
#include "../../../platform/input/Multitouch.h"
|
#include "../../../platform/input/Multitouch.h"
|
||||||
#include "../../../util/Mth.h"
|
#include "../../../util/Mth.h"
|
||||||
#include "../../renderer/Textures.h"
|
#include "../../renderer/Textures.h"
|
||||||
|
#include "MinecraftClient.h"
|
||||||
|
|
||||||
|
|
||||||
RolledSelectionListH::RolledSelectionListH( Minecraft* minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemWidth )
|
RolledSelectionListH::RolledSelectionListH( MinecraftClient& minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemWidth )
|
||||||
: minecraft(minecraft),
|
: minecraft(minecraft),
|
||||||
width(width),
|
width(width),
|
||||||
height(height),
|
height(height),
|
||||||
@@ -172,7 +172,7 @@ void RolledSelectionListH::render( int xm, int ym, float a )
|
|||||||
|
|
||||||
//LOGI("x: %f\n", xo);
|
//LOGI("x: %f\n", xo);
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/background.png");
|
minecraft.textures().loadAndBindTexture("gui/background.png");
|
||||||
glColor4f2(1.0f, 1, 1, 1);
|
glColor4f2(1.0f, 1, 1, 1);
|
||||||
float s = 32;
|
float s = 32;
|
||||||
t.begin();
|
t.begin();
|
||||||
@@ -280,7 +280,7 @@ void RolledSelectionListH::render( int xm, int ym, float a )
|
|||||||
void RolledSelectionListH::renderHoleBackground( /*float x0, float x1,*/ float y0, float y1, int a0, int a1 )
|
void RolledSelectionListH::renderHoleBackground( /*float x0, float x1,*/ float y0, float y1, int a0, int a1 )
|
||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
minecraft->textures->loadAndBindTexture("gui/background.png");
|
minecraft.textures().loadAndBindTexture("gui/background.png");
|
||||||
glColor4f2(1.0f, 1, 1, 1);
|
glColor4f2(1.0f, 1, 1, 1);
|
||||||
float s = 32;
|
float s = 32;
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListH_H__
|
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__RolledSelectionListH_H__
|
||||||
|
|
||||||
#include "../GuiComponent.h"
|
#include "../GuiComponent.h"
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
class Tesselator;
|
class Tesselator;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ class RolledSelectionListH : public GuiComponent
|
|||||||
static const int DRAG_OUTSIDE = -2;
|
static const int DRAG_OUTSIDE = -2;
|
||||||
static const int DRAG_NORMAL = 0;
|
static const int DRAG_NORMAL = 0;
|
||||||
public:
|
public:
|
||||||
RolledSelectionListH(Minecraft* minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemWidth);
|
RolledSelectionListH(MinecraftClient& minecraft, int width, int height, int x0, int x1, int y0, int y1, int itemWidth);
|
||||||
|
|
||||||
virtual int getItemAtPosition(int x, int y);
|
virtual int getItemAtPosition(int x, int y);
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ protected:
|
|||||||
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
virtual void clickedHeader(int headerMouseX, int headerMouseY) {}
|
||||||
int getItemAtXPositionRaw(int x);
|
int getItemAtXPositionRaw(int x);
|
||||||
protected:
|
protected:
|
||||||
Minecraft* minecraft;
|
MinecraftClient& minecraft;
|
||||||
|
|
||||||
float x0;
|
float x0;
|
||||||
float x1;
|
float x1;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "GuiElement.h"
|
#include "GuiElement.h"
|
||||||
#include "../../../client/Options.h"
|
#include "../../../client/Options.h"
|
||||||
|
#include <client/Option.h>
|
||||||
|
|
||||||
class Slider : public GuiElement {
|
class Slider : public GuiElement {
|
||||||
typedef GuiElement super;
|
typedef GuiElement super;
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#include "SmallButton.h"
|
|
||||||
|
|
||||||
SmallButton::SmallButton( int id, int x, int y, const std::string& msg )
|
|
||||||
: super(id, x, y, 150, 20, msg),
|
|
||||||
option(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SmallButton::SmallButton( int id, int x, int y, int width, int height, const std::string& msg )
|
|
||||||
: super(id, x, y, width, height, msg),
|
|
||||||
option(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SmallButton::SmallButton( int id, int x, int y, Option* item, const std::string& msg )
|
|
||||||
: super(id, x, y, 150, 20, msg),
|
|
||||||
option(item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Option* SmallButton::getOption()
|
|
||||||
{
|
|
||||||
return option;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__
|
|
||||||
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__
|
|
||||||
|
|
||||||
//package net.minecraft.client.gui;
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "Button.h"
|
|
||||||
#include "../../Options.h"
|
|
||||||
|
|
||||||
class SmallButton: public Button
|
|
||||||
{
|
|
||||||
typedef Button super;
|
|
||||||
public:
|
|
||||||
SmallButton(int id, int x, int y, const std::string& msg);
|
|
||||||
SmallButton(int id, int x, int y, int width, int height, const std::string& msg);
|
|
||||||
SmallButton(int id, int x, int y, Option* item, const std::string& msg);
|
|
||||||
|
|
||||||
Option* getOption();
|
|
||||||
private:
|
|
||||||
Option* option;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__*/
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__
|
|
||||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__
|
|
||||||
|
|
||||||
#include "../Screen.h"
|
|
||||||
#include "../components/Button.h"
|
|
||||||
|
|
||||||
class BuyGameScreen: public Screen
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BuyGameScreen() {}
|
|
||||||
virtual ~BuyGameScreen() {}
|
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
void render(int xm, int ym, float a);
|
|
||||||
|
|
||||||
void buttonClicked(Button* button) {
|
|
||||||
//if (button->id == bQuit.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
//Button bQuit;
|
|
||||||
//Button bBuyGame;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__*/
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
//static NinePatchLayer* guiPaneFrame = NULL;
|
//static NinePatchLayer* guiPaneFrame = NULL;
|
||||||
|
|
||||||
static __inline void setIfNotSet(bool& ref, bool condition) {
|
static inline void setIfNotSet(bool& ref, bool condition) {
|
||||||
ref = (ref || condition);
|
ref = (ref || condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "../Gui.h"
|
#include "../Gui.h"
|
||||||
#include "../../renderer/Textures.h"
|
#include "../../renderer/Textures.h"
|
||||||
#include "../../gamemode/GameMode.h"
|
#include <gamemode/GameMode.h>
|
||||||
#include "ArmorScreen.h"
|
#include "ArmorScreen.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__
|
|
||||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__
|
|
||||||
|
|
||||||
#include "../Screen.h"
|
|
||||||
#include "../components/Button.h"
|
|
||||||
#include "../../Minecraft.h"
|
|
||||||
#include "../../../LicenseCodes.h"
|
|
||||||
|
|
||||||
class InvalidLicenseScreen: public Screen
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
InvalidLicenseScreen(int id, bool hasBuyButton)
|
|
||||||
: _id(id),
|
|
||||||
_hasBuyButton(hasBuyButton),
|
|
||||||
_baseY(0),
|
|
||||||
bOk(0),
|
|
||||||
bBuy(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~InvalidLicenseScreen() {
|
|
||||||
delete bOk;
|
|
||||||
delete bBuy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init() {
|
|
||||||
if (minecraft->useTouchscreen()) {
|
|
||||||
bOk = new Touch::TButton(1, "Ok");
|
|
||||||
bBuy = new Touch::TButton(2, "Buy");
|
|
||||||
} else {
|
|
||||||
bOk = new Button(1, "Ok");
|
|
||||||
bBuy = new Button(2, "Buy");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_hasBuyButton)
|
|
||||||
bOk->msg = "Quit";
|
|
||||||
|
|
||||||
if (!LicenseCodes::isOk(_id)) {
|
|
||||||
char buf[20] = {0};
|
|
||||||
sprintf(buf, "%d", _id);
|
|
||||||
|
|
||||||
desc1 = "License verification failed (error ";
|
|
||||||
desc1 += buf;
|
|
||||||
desc1 += ")";
|
|
||||||
desc2 = "Try again later.";
|
|
||||||
hint = "You need to be connected to the internet\n";
|
|
||||||
hint += "once while you start the game.";
|
|
||||||
}
|
|
||||||
|
|
||||||
buttons.push_back(bOk);
|
|
||||||
tabButtons.push_back(bOk);
|
|
||||||
|
|
||||||
if (_hasBuyButton) {
|
|
||||||
buttons.push_back(bBuy);
|
|
||||||
tabButtons.push_back(bBuy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupPositions() {
|
|
||||||
_baseY = height/5 + 6;
|
|
||||||
//if (_hasBuyButton)
|
|
||||||
_baseY -= 24;
|
|
||||||
|
|
||||||
bOk->width = bBuy->width = 200;
|
|
||||||
bOk->x = bBuy->x = (width - bOk->width) / 2;
|
|
||||||
bBuy->y = _baseY + 84;
|
|
||||||
bOk->y = bBuy->y + bBuy->height + 4;
|
|
||||||
|
|
||||||
if (!_hasBuyButton)
|
|
||||||
bOk->y -= 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tick() {}
|
|
||||||
|
|
||||||
//void keyPressed(int eventKey) {}
|
|
||||||
|
|
||||||
void render(int xm, int ym, float a) {
|
|
||||||
renderDirtBackground(0);
|
|
||||||
drawCenteredString(minecraft->font, desc1, width/2, _baseY, 0xffffff);
|
|
||||||
drawCenteredString(minecraft->font, desc2, width/2, _baseY + 24, 0xffffff);
|
|
||||||
|
|
||||||
drawCenteredString(minecraft->font, hint, width/2, _baseY + 60, 0xffffff);
|
|
||||||
|
|
||||||
Screen::render(xm, ym, a);
|
|
||||||
}
|
|
||||||
|
|
||||||
void buttonClicked(Button* button) {
|
|
||||||
if (button->id == bOk->id) {
|
|
||||||
minecraft->quit();
|
|
||||||
}
|
|
||||||
if (button->id == bBuy->id) {
|
|
||||||
minecraft->platform()->buyGame();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private:
|
|
||||||
int _id;
|
|
||||||
std::string desc1;
|
|
||||||
std::string desc2;
|
|
||||||
std::string hint;
|
|
||||||
|
|
||||||
Button* bOk;
|
|
||||||
Button* bBuy;
|
|
||||||
bool _hasBuyButton;
|
|
||||||
int _baseY;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__*/
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
#include "../Screen.h"
|
#include "../Screen.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
#include "../components/ImageButton.h"
|
#include "client/gui/components/ImageButton.h"
|
||||||
#include "../components/TextBox.h"
|
#include "client/gui/components/TextBox.h"
|
||||||
|
|
||||||
class JoinByIPScreen: public Screen
|
class JoinByIPScreen: public Screen
|
||||||
{
|
{
|
||||||
@@ -25,4 +25,4 @@ private:
|
|||||||
Touch::THeader bHeader;
|
Touch::THeader bHeader;
|
||||||
Touch::TButton bJoin;
|
Touch::TButton bJoin;
|
||||||
ImageButton bBack;
|
ImageButton bBack;
|
||||||
};
|
};
|
||||||
@@ -216,9 +216,6 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
|
|
||||||
// // Graphics Pane
|
// // Graphics Pane
|
||||||
optionPanes[3]->addOptionItem(OPTIONS_FANCY_GRAPHICS, minecraft)
|
optionPanes[3]->addOptionItem(OPTIONS_FANCY_GRAPHICS, minecraft)
|
||||||
// .addOptionItem(&Option::VIEW_BOBBING, minecraft)
|
|
||||||
// .addOptionItem(&Option::AMBIENT_OCCLUSION, minecraft)
|
|
||||||
// .addOptionItem(&Option::ANAGLYPH, minecraft)
|
|
||||||
.addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft)
|
.addOptionItem(OPTIONS_LIMIT_FRAMERATE, minecraft)
|
||||||
.addOptionItem(OPTIONS_VSYNC, minecraft)
|
.addOptionItem(OPTIONS_VSYNC, minecraft)
|
||||||
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
||||||
@@ -228,8 +225,7 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
|
|
||||||
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
||||||
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft);
|
||||||
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionsScreen::mouseClicked(int x, int y, int buttonNum) {
|
void OptionsScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#include "RenameMPLevelScreen.h"
|
|
||||||
#include "StartMenuScreen.h"
|
|
||||||
#include "DialogDefinitions.h"
|
|
||||||
#include "../Gui.h"
|
|
||||||
#include "../../Minecraft.h"
|
|
||||||
#include "../../../AppPlatform.h"
|
|
||||||
#include "../../../platform/log.h"
|
|
||||||
#include "../../../world/level/storage/LevelStorageSource.h"
|
|
||||||
|
|
||||||
|
|
||||||
static char ILLEGAL_FILE_CHARACTERS[] = {
|
|
||||||
'/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'
|
|
||||||
};
|
|
||||||
|
|
||||||
RenameMPLevelScreen::RenameMPLevelScreen( const std::string& levelId )
|
|
||||||
: _levelId(levelId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenameMPLevelScreen::init() {
|
|
||||||
minecraft->platform()->createUserInput(DialogDefinitions::DIALOG_RENAME_MP_WORLD);
|
|
||||||
}
|
|
||||||
|
|
||||||
void RenameMPLevelScreen::render(int xm, int ym, float a)
|
|
||||||
{
|
|
||||||
renderBackground();
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
minecraft->getLevelSource()->renameLevel(_levelId, "Save?Level");
|
|
||||||
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
|
|
||||||
#else
|
|
||||||
int status = minecraft->platform()->getUserInputStatus();
|
|
||||||
if (status > -1) {
|
|
||||||
if (status == 1) {
|
|
||||||
std::vector<std::string> v = minecraft->platform()->getUserInput();
|
|
||||||
|
|
||||||
if (!v.empty()) {
|
|
||||||
// Read the level name.
|
|
||||||
// 1) Trim name 2) Remove all bad chars -) We don't have to getUniqueLevelName, since renameLevel will do that
|
|
||||||
std::string levelId = v[0];
|
|
||||||
|
|
||||||
for (int i = 0; i < sizeof(ILLEGAL_FILE_CHARACTERS) / sizeof(char); ++i)
|
|
||||||
levelId = Util::stringReplace(levelId, std::string(1, ILLEGAL_FILE_CHARACTERS[i]), "");
|
|
||||||
if ((int)levelId.length() == 0) {
|
|
||||||
levelId = "saved_world";
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft->getLevelSource()->renameLevel(_levelId, levelId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__RenameMPLevelScreen_H__
|
|
||||||
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__RenameMPLevelScreen_H__
|
|
||||||
|
|
||||||
#include "../Screen.h"
|
|
||||||
|
|
||||||
class RenameMPLevelScreen: public Screen
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RenameMPLevelScreen(const std::string& levelId);
|
|
||||||
|
|
||||||
virtual void init();
|
|
||||||
virtual void render(int xm, int ym, float a);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string _levelId;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__RenameMPLevelScreen_H__*/
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "ScreenChooser.h"
|
#include "ScreenChooser.h"
|
||||||
#include "StartMenuScreen.h"
|
#include "StartMenuScreen.h"
|
||||||
|
#include "MinecraftClient.h"
|
||||||
#include "SelectWorldScreen.h"
|
#include "SelectWorldScreen.h"
|
||||||
#include "JoinGameScreen.h"
|
#include "JoinGameScreen.h"
|
||||||
#include "PauseScreen.h"
|
#include "PauseScreen.h"
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
|
|
||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
|
|
||||||
#include "UsernameScreen.h"
|
#include <client/gui/screens/UsernameScreen.h>
|
||||||
|
|
||||||
Screen* ScreenChooser::createScreen( ScreenId id )
|
Screen* ScreenChooser::createScreen( ScreenId id )
|
||||||
{
|
{
|
||||||
@@ -58,6 +59,6 @@ Screen* ScreenChooser::createScreen( ScreenId id )
|
|||||||
Screen* ScreenChooser::setScreen(ScreenId id)
|
Screen* ScreenChooser::setScreen(ScreenId id)
|
||||||
{
|
{
|
||||||
Screen* screen = createScreen(id);
|
Screen* screen = createScreen(id);
|
||||||
_mc->setScreen(screen);
|
_mc.setScreen(screen);
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,19 +14,17 @@ enum ScreenId {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Screen;
|
class Screen;
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
|
|
||||||
class ScreenChooser
|
class ScreenChooser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScreenChooser(Minecraft* mc)
|
ScreenChooser(MinecraftClient& mc) : _mc(mc) {}
|
||||||
: _mc(mc)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Screen* createScreen(ScreenId id);
|
Screen* createScreen(ScreenId id);
|
||||||
Screen* setScreen(ScreenId id);
|
Screen* setScreen(ScreenId id);
|
||||||
private:
|
private:
|
||||||
Minecraft* _mc;
|
MinecraftClient& _mc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ScreenChooser_H__*/
|
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__ScreenChooser_H__*/
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "SelectWorldScreen.h"
|
#include "SelectWorldScreen.h"
|
||||||
|
#include "MinecraftClient.h"
|
||||||
#include "StartMenuScreen.h"
|
#include "StartMenuScreen.h"
|
||||||
#include "ProgressScreen.h"
|
#include "ProgressScreen.h"
|
||||||
#include "DialogDefinitions.h"
|
#include "DialogDefinitions.h"
|
||||||
@@ -22,7 +23,7 @@ static float Max(float a, float b) {
|
|||||||
//
|
//
|
||||||
// World Selection List
|
// World Selection List
|
||||||
//
|
//
|
||||||
WorldSelectionList::WorldSelectionList( Minecraft* minecraft, int width, int height )
|
WorldSelectionList::WorldSelectionList( MinecraftClient& minecraft, int width, int height )
|
||||||
: _height(height),
|
: _height(height),
|
||||||
hasPickedLevel(false),
|
hasPickedLevel(false),
|
||||||
currentTick(0),
|
currentTick(0),
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
#include "../TweenData.h"
|
#include "../TweenData.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
#include "../components/RolledSelectionListH.h"
|
#include "../components/RolledSelectionListH.h"
|
||||||
#include "../../Minecraft.h"
|
|
||||||
#include "../../../world/level/storage/LevelStorageSource.h"
|
#include "../../../world/level/storage/LevelStorageSource.h"
|
||||||
|
|
||||||
|
|
||||||
class SelectWorldScreen;
|
class SelectWorldScreen;
|
||||||
|
class MinecraftClient;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Scrolling World selection list
|
// Scrolling World selection list
|
||||||
@@ -17,7 +17,7 @@ class SelectWorldScreen;
|
|||||||
class WorldSelectionList : public RolledSelectionListH
|
class WorldSelectionList : public RolledSelectionListH
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WorldSelectionList(Minecraft* _minecraft, int _width, int _height);
|
WorldSelectionList(MinecraftClient& _minecraft, int _width, int _height);
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
void stepLeft();
|
void stepLeft();
|
||||||
void stepRight();
|
void stepRight();
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ void UsernameScreen::setupPositions()
|
|||||||
// Make the done button match the touch-style option tabs
|
// Make the done button match the touch-style option tabs
|
||||||
_btnDone.width = 66;
|
_btnDone.width = 66;
|
||||||
_btnDone.height = 26;
|
_btnDone.height = 26;
|
||||||
_btnDone.x = cx - (_btnDone.width / 2);
|
_btnDone.x = (width - _btnDone.width) / 2;
|
||||||
_btnDone.y = cy + 52;
|
_btnDone.y = height / 2 + 52;
|
||||||
|
|
||||||
tUsername.width = 120;
|
tUsername.width = 120;
|
||||||
tUsername.height = 20;
|
tUsername.height = 20;
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
#include "../Screen.h"
|
#include "../Screen.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
// this is cursed lol
|
#include "client/gui/components/TextBox.h"
|
||||||
#include "../../../client/gui/components/TextBox.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class UsernameScreen : public Screen
|
class UsernameScreen : public Screen
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "../../Screen.h"
|
#include "../../Screen.h"
|
||||||
#include "../../components/ImageButton.h"
|
#include "../../components/ImageButton.h"
|
||||||
#include "../../components/InventoryPane.h"
|
#include "../../components/InventoryPane.h"
|
||||||
#include "../../../gamemode/GameMode.h"
|
#include <gamemode/GameMode.h>
|
||||||
#include "../../../renderer/TileRenderer.h"
|
#include "../../../renderer/TileRenderer.h"
|
||||||
#include "../../../player/LocalPlayer.h"
|
#include "../../../player/LocalPlayer.h"
|
||||||
#include "../../../renderer/gles.h"
|
#include "../../../renderer/gles.h"
|
||||||
@@ -91,8 +91,7 @@ void IngameBlockSelectionScreen::init()
|
|||||||
//for (int i = 0; i < inventory->getContainerSize(); ++i)
|
//for (int i = 0; i < inventory->getContainerSize(); ++i)
|
||||||
//LOGI("> %d - %s\n", i, inventory->getItem(i)? inventory->getItem(i)->getDescriptionId().c_str() : "<-->\n");
|
//LOGI("> %d - %s\n", i, inventory->getItem(i)? inventory->getItem(i)->getDescriptionId().c_str() : "<-->\n");
|
||||||
|
|
||||||
// Grid indices are 0..N-1 for main inventory only; slots 0..MAX_SELECTION_SIZE-1 are hotbar links.
|
InventorySize = inventory->getContainerSize();
|
||||||
InventorySize = inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE;
|
|
||||||
InventoryRows = 1 + (InventorySize-1) / InventoryColumns;
|
InventoryRows = 1 + (InventorySize-1) / InventoryColumns;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -266,8 +265,7 @@ void IngameBlockSelectionScreen::buttonClicked(Button* button) {
|
|||||||
|
|
||||||
bool IngameBlockSelectionScreen::isAllowed( int slot )
|
bool IngameBlockSelectionScreen::isAllowed( int slot )
|
||||||
{
|
{
|
||||||
const int gridCount = minecraft->player->inventory->getContainerSize() - Inventory::MAX_SELECTION_SIZE;
|
if (slot < 0 || slot >= minecraft->player->inventory->getContainerSize())
|
||||||
if (slot < 0 || slot >= gridCount)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifdef DEMO_MODE
|
#ifdef DEMO_MODE
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "HumanoidModel.h"
|
#include "HumanoidModel.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../../util/Mth.h"
|
#include "../../util/Mth.h"
|
||||||
#include "../../world/entity/player/Player.h"
|
#include "../../world/entity/player/Player.h"
|
||||||
#include "../../world/entity/player/Inventory.h"
|
#include "../../world/entity/player/Inventory.h"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "LocalPlayer.h"
|
#include "LocalPlayer.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../../ErrorCodes.h"
|
|
||||||
#include "../../world/entity/EntityEvent.h"
|
#include "../../world/entity/EntityEvent.h"
|
||||||
#include "../../world/entity/player/Player.h"
|
#include "../../world/entity/player/Player.h"
|
||||||
#include "../../world/inventory/BaseContainerMenu.h"
|
#include "../../world/inventory/BaseContainerMenu.h"
|
||||||
@@ -35,7 +34,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../gui/Screen.h"
|
#include "../gui/Screen.h"
|
||||||
#include "../gui/screens/FurnaceScreen.h"
|
#include "../gui/screens/FurnaceScreen.h"
|
||||||
#include "../gui/screens/ChestScreen.h"
|
#include "../gui/screens/ChestScreen.h"
|
||||||
@@ -44,13 +43,13 @@
|
|||||||
#include "../gui/screens/InBedScreen.h"
|
#include "../gui/screens/InBedScreen.h"
|
||||||
#include "../gui/screens/TextEditScreen.h"
|
#include "../gui/screens/TextEditScreen.h"
|
||||||
#include "../particle/TakeAnimationParticle.h"
|
#include "../particle/TakeAnimationParticle.h"
|
||||||
#endif
|
|
||||||
#include "../../network/packet/AnimatePacket.h"
|
#include "../../network/packet/AnimatePacket.h"
|
||||||
#include "../../world/item/ArmorItem.h"
|
#include "../../world/item/ArmorItem.h"
|
||||||
#include "../../network/packet/PlayerArmorEquipmentPacket.h"
|
#include "../../network/packet/PlayerArmorEquipmentPacket.h"
|
||||||
|
#include <MinecraftClient.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
|
|
||||||
static bool isBase64(unsigned char c) {
|
static bool isBase64(unsigned char c) {
|
||||||
return (std::isalnum(c) || (c == '+') || (c == '/'));
|
return (std::isalnum(c) || (c == '+') || (c == '/'));
|
||||||
@@ -233,7 +232,7 @@ static bool fileExists(const std::string& path) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
|
|
||||||
static void* fetchSkinForPlayer(void* param) {
|
static void* fetchSkinForPlayer(void* param) {
|
||||||
LocalPlayer* player = (LocalPlayer*)param;
|
LocalPlayer* player = (LocalPlayer*)param;
|
||||||
@@ -345,33 +344,21 @@ static bool isJumpable(int tileId) {
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
LocalPlayer::LocalPlayer(Minecraft* minecraft, Level* level, const std::string& username, int dimension, bool isCreative)
|
LocalPlayer::LocalPlayer(MinecraftClient& minecraft, Level* level, const std::string& username, int dimension, bool isCreative)
|
||||||
: Player(level, isCreative),
|
: Player(level, isCreative), minecraft(minecraft) {
|
||||||
minecraft(minecraft),
|
|
||||||
input(NULL),
|
|
||||||
sentInventoryItemId(-1),
|
|
||||||
sentInventoryItemData(-1),
|
|
||||||
autoJumpEnabled(true),
|
|
||||||
armorTypeHash(0),
|
|
||||||
sprinting(false),
|
|
||||||
sprintDoubleTapTimer(0),
|
|
||||||
prevForwardHeld(false)
|
|
||||||
{
|
|
||||||
this->dimension = dimension;
|
this->dimension = dimension;
|
||||||
_init();
|
_init();
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
|
|
||||||
if (minecraft->options.getStringValue(OPTIONS_USERNAME).size() != 0) {
|
if (minecraft.options().getStringValue(OPTIONS_USERNAME).size() != 0) {
|
||||||
textureName = "mob/char.png";
|
textureName = "mob/char.png";
|
||||||
|
|
||||||
this->name = minecraft->options.getStringValue(OPTIONS_USERNAME);
|
this->name = minecraft.options().getStringValue(OPTIONS_USERNAME);
|
||||||
printf("test \n");
|
printf("test \n");
|
||||||
// Fetch user skin and cape from Mojang servers in the background (avoids blocking the main thread)
|
// Fetch user skin and cape from Mojang servers in the background (avoids blocking the main thread)
|
||||||
// TODO: Fix this memory leak
|
// TODO: Fix this memory leak
|
||||||
new CThread(fetchSkinForPlayer, this);
|
new CThread(fetchSkinForPlayer, this);
|
||||||
new CThread(fetchCapeForPlayer, this);
|
new CThread(fetchCapeForPlayer, this);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalPlayer::~LocalPlayer() {
|
LocalPlayer::~LocalPlayer() {
|
||||||
@@ -381,8 +368,8 @@ LocalPlayer::~LocalPlayer() {
|
|||||||
|
|
||||||
/*private*/
|
/*private*/
|
||||||
void LocalPlayer::calculateFlight(float xa, float ya, float za) {
|
void LocalPlayer::calculateFlight(float xa, float ya, float za) {
|
||||||
float flySpeed = minecraft->options.getProgressValue(OPTIONS_FLY_SPEED);
|
float flySpeed = minecraft.options().getProgressValue(OPTIONS_FLY_SPEED);
|
||||||
float sensivity = minecraft->options.getProgressValue(OPTIONS_SENSITIVITY);
|
float sensivity = minecraft.options().getProgressValue(OPTIONS_SENSITIVITY);
|
||||||
|
|
||||||
xa = xa * flySpeed;
|
xa = xa * flySpeed;
|
||||||
ya = 0;
|
ya = 0;
|
||||||
@@ -434,12 +421,12 @@ void LocalPlayer::tick() {
|
|||||||
stopUsingItem();
|
stopUsingItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (minecraft->isOnline())
|
if (minecraft.isOnline())
|
||||||
{
|
{
|
||||||
if (std::abs(x - sentX) > .1f || std::abs(y - sentY) > .01f || std::abs(z - sentZ) > .1f || std::abs(sentRotX - xRot) > 1 || std::abs(sentRotY - yRot) > 1)
|
if (std::abs(x - sentX) > .1f || std::abs(y - sentY) > .01f || std::abs(z - sentZ) > .1f || std::abs(sentRotX - xRot) > 1 || std::abs(sentRotY - yRot) > 1)
|
||||||
{
|
{
|
||||||
MovePlayerPacket packet(entityId, x, y - heightOffset, z, xRot, yRot);
|
MovePlayerPacket packet(entityId, x, y - heightOffset, z, xRot, yRot);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
sentX = x;
|
sentX = x;
|
||||||
sentY = y;
|
sentY = y;
|
||||||
sentZ = z;
|
sentZ = z;
|
||||||
@@ -457,7 +444,7 @@ void LocalPlayer::tick() {
|
|||||||
sentInventoryItemId = newItemId;
|
sentInventoryItemId = newItemId;
|
||||||
sentInventoryItemData = newItemData;
|
sentInventoryItemData = newItemData;
|
||||||
PlayerEquipmentPacket packet(entityId, newItemId, newItemData);
|
PlayerEquipmentPacket packet(entityId, newItemId, newItemData);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -472,15 +459,14 @@ void LocalPlayer::tick() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
updateArmorTypeHash();
|
updateArmorTypeHash();
|
||||||
#ifndef STANDALONE_SERVER
|
if (!minecraft.getScreen() && containerMenu) {
|
||||||
if (!minecraft->screen && containerMenu) {
|
|
||||||
static bool hasPostedError = false;
|
static bool hasPostedError = false;
|
||||||
if (!hasPostedError) {
|
if (!hasPostedError) {
|
||||||
minecraft->gui.postError( ErrorCodes::ContainerRefStillExistsAfterDestruction );
|
// @todo
|
||||||
|
// minecraft.gui().postError( ErrorCodes::ContainerRefStillExistsAfterDestruction );
|
||||||
hasPostedError = true;
|
hasPostedError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//LOGI("biome: %s\n", level->getBiomeSource()->getBiome((int)x >> 4, (int)z >> 4)->name.c_str());
|
//LOGI("biome: %s\n", level->getBiomeSource()->getBiome((int)x >> 4, (int)z >> 4)->name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,15 +477,14 @@ void LocalPlayer::aiStep() {
|
|||||||
descendTriggerTime--;
|
descendTriggerTime--;
|
||||||
|
|
||||||
bool wasJumping = input->jumping;
|
bool wasJumping = input->jumping;
|
||||||
#ifndef STANDALONE_SERVER
|
bool screenCovering = minecraft.getScreen() && !minecraft.getScreen()->passEvents;
|
||||||
bool screenCovering = minecraft->screen && !minecraft->screen->passEvents;
|
|
||||||
if (!screenCovering)
|
if (!screenCovering)
|
||||||
input->tick(this);
|
input->tick(this);
|
||||||
|
|
||||||
// Sprint: detect W double-tap
|
// Sprint: detect W double-tap
|
||||||
{
|
{
|
||||||
bool forwardHeld = (input->ya > 0);
|
bool forwardHeld = (input->ya > 0);
|
||||||
if (forwardHeld && !prevForwardHeld && minecraft->options.getBooleanValue(OPTIONS_ALLOW_SPRINT)) {
|
if (forwardHeld && !prevForwardHeld && minecraft.options().getBooleanValue(OPTIONS_ALLOW_SPRINT)) {
|
||||||
// leading edge of W press
|
// leading edge of W press
|
||||||
if (sprintDoubleTapTimer > 0)
|
if (sprintDoubleTapTimer > 0)
|
||||||
sprinting = true;
|
sprinting = true;
|
||||||
@@ -518,7 +503,7 @@ void LocalPlayer::aiStep() {
|
|||||||
if (input->sneaking) {
|
if (input->sneaking) {
|
||||||
if (ySlideOffset < 0.2f) ySlideOffset = 0.2f;
|
if (ySlideOffset < 0.2f) ySlideOffset = 0.2f;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (abilities.mayfly) {
|
if (abilities.mayfly) {
|
||||||
// Check for flight toggle
|
// Check for flight toggle
|
||||||
if (!wasJumping && input->jumping) {
|
if (!wasJumping && input->jumping) {
|
||||||
@@ -559,16 +544,16 @@ void LocalPlayer::aiStep() {
|
|||||||
void LocalPlayer::closeContainer() {
|
void LocalPlayer::closeContainer() {
|
||||||
if (level->isClientSide) {
|
if (level->isClientSide) {
|
||||||
ContainerClosePacket packet(containerMenu->containerId);
|
ContainerClosePacket packet(containerMenu->containerId);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
super::closeContainer();
|
super::closeContainer();
|
||||||
minecraft->setScreen(NULL);
|
minecraft.setScreen(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
//@Override
|
||||||
void LocalPlayer::move(float xa, float ya, float za) {
|
void LocalPlayer::move(float xa, float ya, float za) {
|
||||||
//@note: why is this == minecraft->player needed?
|
//@note: why is this == minecraft.player needed?
|
||||||
if (this == minecraft->player && minecraft->options.getBooleanValue(OPTIONS_IS_FLYING)) {
|
if (this == minecraft.getPlayer() && minecraft.options().getBooleanValue(OPTIONS_IS_FLYING)) {
|
||||||
noPhysics = true;
|
noPhysics = true;
|
||||||
float tmp = walkDist; // update
|
float tmp = walkDist; // update
|
||||||
calculateFlight((float) xa, (float) ya, (float) za);
|
calculateFlight((float) xa, (float) ya, (float) za);
|
||||||
@@ -588,7 +573,7 @@ void LocalPlayer::move(float xa, float ya, float za) {
|
|||||||
|
|
||||||
float newX = x, newZ = z;
|
float newX = x, newZ = z;
|
||||||
|
|
||||||
if (autoJumpTime <= 0 && minecraft->options.getBooleanValue(OPTIONS_AUTOJUMP))
|
if (autoJumpTime <= 0 && minecraft.options().getBooleanValue(OPTIONS_AUTOJUMP))
|
||||||
{
|
{
|
||||||
// auto-jump when crossing the middle of a tile, and the tile in the front is blocked
|
// auto-jump when crossing the middle of a tile, and the tile in the front is blocked
|
||||||
bool jump = false;
|
bool jump = false;
|
||||||
@@ -617,12 +602,9 @@ void LocalPlayer::updateAi() {
|
|||||||
this->jumping = input->jumping || autoJumpTime > 0;
|
this->jumping = input->jumping || autoJumpTime > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::take( Entity* e, int orgCount )
|
void LocalPlayer::take( Entity* e, int orgCount ) {
|
||||||
{
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
if (e->isItemEntity())
|
if (e->isItemEntity())
|
||||||
minecraft->particleEngine->add(new TakeAnimationParticle(minecraft->level, (ItemEntity*)e, this, -0.5f));
|
minecraft.getParticleEngine()->add(new TakeAnimationParticle(minecraft.level, (ItemEntity*)e, this, -0.5f));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::setKey( int eventKey, bool eventKeyState )
|
void LocalPlayer::setKey( int eventKey, bool eventKeyState )
|
||||||
@@ -684,28 +666,25 @@ void LocalPlayer::hurtTo( int newHealth )
|
|||||||
lastHealth = health;
|
lastHealth = health;
|
||||||
invulnerableTime = invulnerableDuration;
|
invulnerableTime = invulnerableDuration;
|
||||||
|
|
||||||
minecraft->player->bypassArmor = true;
|
minecraft.getPlayer()->bypassArmor = true;
|
||||||
actuallyHurt(dmg);
|
actuallyHurt(dmg);
|
||||||
minecraft->player->bypassArmor = false;
|
minecraft.getPlayer()->bypassArmor = false;
|
||||||
|
|
||||||
hurtTime = hurtDuration = 10;
|
hurtTime = hurtDuration = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::actuallyHurt( int dmg )
|
void LocalPlayer::actuallyHurt( int dmg ) {
|
||||||
{
|
if (minecraft.getScreen() && minecraft.getScreen()->closeOnPlayerHurt()) {
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
if (minecraft->screen && minecraft->screen->closeOnPlayerHurt()) {
|
|
||||||
if (containerMenu) closeContainer();
|
if (containerMenu) closeContainer();
|
||||||
else minecraft->setScreen(NULL);
|
else minecraft.setScreen(NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
super::actuallyHurt(dmg);
|
super::actuallyHurt(dmg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::respawn()
|
void LocalPlayer::respawn() {
|
||||||
{
|
minecraft.respawnPlayer();
|
||||||
minecraft->respawnPlayer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::die(Entity* source)
|
void LocalPlayer::die(Entity* source)
|
||||||
@@ -714,7 +693,7 @@ void LocalPlayer::die(Entity* source)
|
|||||||
// If we're the server, drop the inventory immediately
|
// If we're the server, drop the inventory immediately
|
||||||
if (level->isClientSide) {
|
if (level->isClientSide) {
|
||||||
SendInventoryPacket packet(this, true);
|
SendInventoryPacket packet(this, true);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
inventory->dropAll(level->isClientSide);
|
inventory->dropAll(level->isClientSide);
|
||||||
for (int i = 0; i < NUM_ARMOR; ++i) {
|
for (int i = 0; i < NUM_ARMOR; ++i) {
|
||||||
@@ -735,7 +714,7 @@ void LocalPlayer::swing() {
|
|||||||
AnimatePacket packet(AnimatePacket::Swing, this);
|
AnimatePacket packet(AnimatePacket::Swing, this);
|
||||||
packet.reliability = UNRELIABLE;
|
packet.reliability = UNRELIABLE;
|
||||||
packet.priority = MEDIUM_PRIORITY;
|
packet.priority = MEDIUM_PRIORITY;
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,31 +737,23 @@ void LocalPlayer::_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::startCrafting(int x, int y, int z, int tableSize) {
|
void LocalPlayer::startCrafting(int x, int y, int z, int tableSize) {
|
||||||
#ifndef STANDALONE_SERVER
|
if (!minecraft.isCreativeMode())
|
||||||
if (!minecraft->isCreativeMode())
|
minecraft.setScreen( new WorkbenchScreen(tableSize) );
|
||||||
minecraft->setScreen( new WorkbenchScreen(tableSize) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::startStonecutting(int x, int y, int z) {
|
void LocalPlayer::startStonecutting(int x, int y, int z) {
|
||||||
#ifndef STANDALONE_SERVER
|
if (!minecraft.isCreativeMode())
|
||||||
if (!minecraft->isCreativeMode())
|
minecraft.setScreen( new StonecutterScreen() );
|
||||||
minecraft->setScreen( new StonecutterScreen() );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::openFurnace( FurnaceTileEntity* e ) {
|
void LocalPlayer::openFurnace( FurnaceTileEntity* e ) {
|
||||||
#ifndef STANDALONE_SERVER
|
if (!minecraft.isCreativeMode())
|
||||||
if (!minecraft->isCreativeMode())
|
minecraft.setScreen( new FurnaceScreen(this, e) );
|
||||||
minecraft->setScreen( new FurnaceScreen(this, e) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::openContainer( ChestTileEntity* container ) {
|
void LocalPlayer::openContainer( ChestTileEntity* container ) {
|
||||||
#ifndef STANDALONE_SERVER
|
if (!minecraft.isCreativeMode())
|
||||||
if (!minecraft->isCreativeMode())
|
minecraft.setScreen( new ChestScreen(this, container) );
|
||||||
minecraft->setScreen( new ChestScreen(this, container) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::drop( ItemInstance* item, bool randomly )
|
void LocalPlayer::drop( ItemInstance* item, bool randomly )
|
||||||
@@ -792,7 +763,7 @@ void LocalPlayer::drop( ItemInstance* item, bool randomly )
|
|||||||
|
|
||||||
if (level->isClientSide) {
|
if (level->isClientSide) {
|
||||||
DropItemPacket packet(entityId, *item);
|
DropItemPacket packet(entityId, *item);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
// delete the ItemEntity here, since we don't add it to level
|
// delete the ItemEntity here, since we don't add it to level
|
||||||
delete item;
|
delete item;
|
||||||
} else {
|
} else {
|
||||||
@@ -806,7 +777,7 @@ void LocalPlayer::causeFallDamage( float distance )
|
|||||||
if (dmg > 0) {
|
if (dmg > 0) {
|
||||||
if (level->isClientSide) {
|
if (level->isClientSide) {
|
||||||
SetHealthPacket packet(SetHealthPacket::HEALTH_MODIFY_OFFSET + dmg);
|
SetHealthPacket packet(SetHealthPacket::HEALTH_MODIFY_OFFSET + dmg);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super::causeFallDamage(distance);
|
super::causeFallDamage(distance);
|
||||||
@@ -814,35 +785,33 @@ void LocalPlayer::causeFallDamage( float distance )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::displayClientMessage( const std::string& messageId ) {
|
void LocalPlayer::displayClientMessage( const std::string& messageId ) {
|
||||||
#ifndef STANDALONE_SERVER
|
minecraft.gui().displayClientMessage(messageId);
|
||||||
minecraft->gui.displayClientMessage(messageId);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int LocalPlayer::startSleepInBed( int x, int y, int z ) {
|
int LocalPlayer::startSleepInBed( int x, int y, int z ) {
|
||||||
int startSleepInBedReturnValue = super::startSleepInBed(x, y, z);
|
int startSleepInBedReturnValue = super::startSleepInBed(x, y, z);
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
if(startSleepInBedReturnValue == BedSleepingResult::OK)
|
if(startSleepInBedReturnValue == BedSleepingResult::OK)
|
||||||
minecraft->setScreen(new InBedScreen());
|
minecraft.setScreen(new InBedScreen());
|
||||||
#endif
|
|
||||||
return startSleepInBedReturnValue;
|
return startSleepInBedReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::stopSleepInBed( bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint ) {
|
void LocalPlayer::stopSleepInBed( bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint ) {
|
||||||
if(level->isClientSide) {
|
if(level->isClientSide) {
|
||||||
PlayerActionPacket packet(PlayerActionPacket::STOP_SLEEPING, 0, 0, 0, 0, entityId);
|
PlayerActionPacket packet(PlayerActionPacket::STOP_SLEEPING, 0, 0, 0, 0, entityId);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
minecraft->setScreen(NULL);
|
minecraft.setScreen(NULL);
|
||||||
#endif
|
|
||||||
super::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
|
super::stopSleepInBed(forcefulWakeUp, updateLevelList, saveRespawnPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalPlayer::openTextEdit( TileEntity* tileEntity ) {
|
void LocalPlayer::openTextEdit( TileEntity* tileEntity ) {
|
||||||
#if !defined(STANDALONE_SERVER) && !defined(RPI)
|
#if !defined(RPI)
|
||||||
if(tileEntity->type == TileEntityType::Sign)
|
if(tileEntity->type == TileEntityType::Sign)
|
||||||
minecraft->setScreen(new TextEditScreen((SignTileEntity*) tileEntity));
|
minecraft.setScreen(new TextEditScreen((SignTileEntity*) tileEntity));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,7 +819,7 @@ void LocalPlayer::updateArmorTypeHash() {
|
|||||||
int hash = getArmorTypeHash();
|
int hash = getArmorTypeHash();
|
||||||
if (hash != armorTypeHash) {
|
if (hash != armorTypeHash) {
|
||||||
PlayerArmorEquipmentPacket p(this);
|
PlayerArmorEquipmentPacket p(this);
|
||||||
minecraft->raknetInstance->send(p);
|
minecraft.raknetInstance->send(p);
|
||||||
armorTypeHash = hash;
|
armorTypeHash = hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "../../util/SmoothFloat.h"
|
#include "../../util/SmoothFloat.h"
|
||||||
#include "../../world/entity/player/Player.h"
|
#include "../../world/entity/player/Player.h"
|
||||||
|
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
class Stat;
|
class Stat;
|
||||||
class CompoundTag;
|
class CompoundTag;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ class LocalPlayer: public Player
|
|||||||
{
|
{
|
||||||
typedef Player super;
|
typedef Player super;
|
||||||
public:
|
public:
|
||||||
LocalPlayer(Minecraft* minecraft, Level* level, const std::string& username, int dimension, bool isCreative);
|
LocalPlayer(MinecraftClient& minecraft, Level* level, const std::string& username, int dimension, bool isCreative);
|
||||||
~LocalPlayer();
|
~LocalPlayer();
|
||||||
|
|
||||||
void _init();
|
void _init();
|
||||||
@@ -74,10 +74,10 @@ private:
|
|||||||
bool isSolidTile(int x, int y, int z);
|
bool isSolidTile(int x, int y, int z);
|
||||||
void updateArmorTypeHash();
|
void updateArmorTypeHash();
|
||||||
public:
|
public:
|
||||||
IMoveInput* input;
|
IMoveInput* input = nullptr;
|
||||||
bool autoJumpEnabled;
|
bool autoJumpEnabled = true;
|
||||||
protected:
|
protected:
|
||||||
Minecraft* minecraft;
|
MinecraftClient& minecraft;
|
||||||
int jumpTriggerTime;
|
int jumpTriggerTime;
|
||||||
int ascendTriggerTime;
|
int ascendTriggerTime;
|
||||||
int descendTriggerTime;
|
int descendTriggerTime;
|
||||||
@@ -94,15 +94,15 @@ private:
|
|||||||
|
|
||||||
int autoJumpTime;
|
int autoJumpTime;
|
||||||
|
|
||||||
int sentInventoryItemId;
|
int sentInventoryItemId = -1;
|
||||||
int sentInventoryItemData;
|
int sentInventoryItemData = -1;
|
||||||
|
|
||||||
int armorTypeHash;
|
int armorTypeHash = 0;
|
||||||
|
|
||||||
// sprinting
|
// sprinting
|
||||||
bool sprinting;
|
bool sprinting = false;
|
||||||
int sprintDoubleTapTimer;
|
int sprintDoubleTapTimer = 0;
|
||||||
bool prevForwardHeld;
|
bool prevForwardHeld = false;
|
||||||
public:
|
public:
|
||||||
void setSprinting(bool sprint) { sprinting = sprint; }
|
void setSprinting(bool sprint) { sprinting = sprint; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,10 +7,6 @@
|
|||||||
#include "../../world/level/Region.h"
|
#include "../../world/level/Region.h"
|
||||||
#include "../../world/level/chunk/LevelChunk.h"
|
#include "../../world/level/chunk/LevelChunk.h"
|
||||||
#include "../../util/Mth.h"
|
#include "../../util/Mth.h"
|
||||||
|
|
||||||
#include "../../world/level/biome/BiomeSource.h"
|
|
||||||
|
|
||||||
#include "../../world/level/Level.h"
|
|
||||||
//#include "../../platform/time.h"
|
//#include "../../platform/time.h"
|
||||||
|
|
||||||
/*static*/ int Chunk::updates = 0;
|
/*static*/ int Chunk::updates = 0;
|
||||||
@@ -263,4 +259,4 @@ void Chunk::resetUpdates()
|
|||||||
{
|
{
|
||||||
updates = 0;
|
updates = 0;
|
||||||
//swRebuild.reset();
|
//swRebuild.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ private:
|
|||||||
range(b);
|
range(b);
|
||||||
range(a);
|
range(a);
|
||||||
}
|
}
|
||||||
__inline void range(GLfloat& v) {
|
inline void range(GLfloat& v) {
|
||||||
if (v < 0) v = 0;
|
if (v < 0) v = 0;
|
||||||
if (v > 1) v = 1;
|
if (v > 1) v = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "culling/AllowAllCuller.h"
|
#include "culling/AllowAllCuller.h"
|
||||||
#include "culling/FrustumCuller.h"
|
#include "culling/FrustumCuller.h"
|
||||||
#include "entity/EntityRenderDispatcher.h"
|
#include "entity/EntityRenderDispatcher.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../gamemode/GameMode.h"
|
#include "../gamemode/GameMode.h"
|
||||||
#include "../particle/ParticleEngine.h"
|
#include "../particle/ParticleEngine.h"
|
||||||
#include "../player/LocalPlayer.h"
|
#include "../player/LocalPlayer.h"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "entity/EntityRenderDispatcher.h"
|
#include "entity/EntityRenderDispatcher.h"
|
||||||
#include "entity/EntityRenderer.h"
|
#include "entity/EntityRenderer.h"
|
||||||
#include "entity/MobRenderer.h"
|
#include "entity/MobRenderer.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../player/LocalPlayer.h"
|
#include "../player/LocalPlayer.h"
|
||||||
#include "../../world/entity/player/Player.h"
|
#include "../../world/entity/player/Player.h"
|
||||||
#include "../../world/item/Item.h"
|
#include "../../world/item/Item.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "DistanceChunkSorter.h"
|
#include "DistanceChunkSorter.h"
|
||||||
#include "Chunk.h"
|
#include "Chunk.h"
|
||||||
#include "TileRenderer.h"
|
#include "TileRenderer.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../../util/Mth.h"
|
#include "../../util/Mth.h"
|
||||||
#include "../../world/entity/player/Player.h"
|
#include "../../world/entity/player/Player.h"
|
||||||
#include "../../world/level/tile/LevelEvent.h"
|
#include "../../world/level/tile/LevelEvent.h"
|
||||||
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#include "../../client/player/LocalPlayer.h"
|
#include "../../client/player/LocalPlayer.h"
|
||||||
|
|
||||||
#include "../../world/level/GrassColor.h"
|
|
||||||
|
|
||||||
#ifdef GFX_SMALLER_CHUNKS
|
#ifdef GFX_SMALLER_CHUNKS
|
||||||
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
/* static */ const int LevelRenderer::CHUNK_SIZE = 8;
|
||||||
#else
|
#else
|
||||||
@@ -145,10 +143,6 @@ void LevelRenderer::setLevel( Level* level )
|
|||||||
level->addListener(this);
|
level->addListener(this);
|
||||||
allChanged();
|
allChanged();
|
||||||
}
|
}
|
||||||
if (mc->options.getBooleanValue(OPTIONS_AMBIENT_OCCLUSION)) {
|
|
||||||
mc->useAmbientOcclusion = !mc->useAmbientOcclusion;
|
|
||||||
allChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LevelRenderer::allChanged()
|
void LevelRenderer::allChanged()
|
||||||
@@ -161,11 +155,6 @@ void LevelRenderer::allChanged()
|
|||||||
Tile::leaves_carried->setFancy(fancy);
|
Tile::leaves_carried->setFancy(fancy);
|
||||||
lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
lastViewDistance = mc->options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||||
|
|
||||||
bool tint = mc->options.getBooleanValue(OPTIONS_FOLIAGE_TINT);
|
|
||||||
FoliageColor::setUseTint(tint);
|
|
||||||
GrassColor::setUseTint(tint);
|
|
||||||
|
|
||||||
|
|
||||||
int dist = (512 >> 3) << (3 - lastViewDistance);
|
int dist = (512 >> 3) << (3 - lastViewDistance);
|
||||||
if (lastViewDistance <= 2 && mc->isPowerVR())
|
if (lastViewDistance <= 2 && mc->isPowerVR())
|
||||||
dist = (int)((float)dist * 0.8f);
|
dist = (int)((float)dist * 0.8f);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "gles.h"
|
#include "gles.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
class Textures;
|
class Textures;
|
||||||
class Culler;
|
class Culler;
|
||||||
class Chunk;
|
class Chunk;
|
||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
float zOld;
|
float zOld;
|
||||||
float destroyProgress;
|
float destroyProgress;
|
||||||
|
|
||||||
LevelRenderer(Minecraft* mc);
|
LevelRenderer(MinecraftClient& mc);
|
||||||
~LevelRenderer();
|
~LevelRenderer();
|
||||||
|
|
||||||
void setLevel(Level* level);
|
void setLevel(Level* level);
|
||||||
@@ -77,7 +77,7 @@ private:
|
|||||||
void resortChunks(int xc, int yc, int zc);
|
void resortChunks(int xc, int yc, int zc);
|
||||||
void deleteChunks();
|
void deleteChunks();
|
||||||
//void checkQueryResults(int from, int to);
|
//void checkQueryResults(int from, int to);
|
||||||
__inline int getLinearCoord(int x, int y, int z) {
|
inline int getLinearCoord(int x, int y, int z) {
|
||||||
return (z * yChunks + y) * xChunks + x;
|
return (z * yChunks + y) * xChunks + x;
|
||||||
}
|
}
|
||||||
int noEntityRenderFrames;
|
int noEntityRenderFrames;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
void add(int list);
|
void add(int list);
|
||||||
void addR(const RenderChunk& chunk);
|
void addR(const RenderChunk& chunk);
|
||||||
|
|
||||||
__inline void next() { ++listIndex; }
|
inline void next() { ++listIndex; }
|
||||||
|
|
||||||
void render();
|
void render();
|
||||||
void renderChunks();
|
void renderChunks();
|
||||||
|
|||||||
@@ -72,18 +72,18 @@ public:
|
|||||||
|
|
||||||
int getColor();
|
int getColor();
|
||||||
|
|
||||||
__inline void beginOverride() {
|
inline void beginOverride() {
|
||||||
begin();
|
begin();
|
||||||
voidBeginAndEndCalls(true);
|
voidBeginAndEndCalls(true);
|
||||||
}
|
}
|
||||||
__inline void endOverrideAndDraw() {
|
inline void endOverrideAndDraw() {
|
||||||
voidBeginAndEndCalls(false);
|
voidBeginAndEndCalls(false);
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
__inline bool isOverridden() {
|
inline bool isOverridden() {
|
||||||
return _voidBeginEnd;
|
return _voidBeginEnd;
|
||||||
}
|
}
|
||||||
__inline RenderChunk endOverride(int bufferId) {
|
inline RenderChunk endOverride(int bufferId) {
|
||||||
voidBeginAndEndCalls(false);
|
voidBeginAndEndCalls(false);
|
||||||
return end(true, bufferId);
|
return end(true, bufferId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,34 +4,20 @@
|
|||||||
#include "ptexture/DynamicTexture.h"
|
#include "ptexture/DynamicTexture.h"
|
||||||
#include "../Options.h"
|
#include "../Options.h"
|
||||||
#include "../../platform/time.h"
|
#include "../../platform/time.h"
|
||||||
#include "../../AppPlatform.h"
|
|
||||||
#include "../../util/StringUtils.h"
|
#include "../../util/StringUtils.h"
|
||||||
|
|
||||||
/*static*/ int Textures::textureChanges = 0;
|
/*static*/ int Textures::textureChanges = 0;
|
||||||
/*static*/ bool Textures::MIPMAP = false;
|
|
||||||
/*static*/ const TextureId Textures::InvalidId = -1;
|
|
||||||
|
|
||||||
Textures::Textures( Options* options_, AppPlatform* platform_ )
|
Textures::~Textures() {
|
||||||
: clamp(false),
|
|
||||||
blur(false),
|
|
||||||
options(options_),
|
|
||||||
platform(platform_),
|
|
||||||
lastBoundTexture(Textures::InvalidId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Textures::~Textures()
|
|
||||||
{
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < dynamicTextures.size(); ++i)
|
for (unsigned int i = 0; i < dynamicTextures.size(); ++i)
|
||||||
delete dynamicTextures[i];
|
delete dynamicTextures[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Textures::clear()
|
void Textures::clear() {
|
||||||
{
|
|
||||||
for (TextureMap::iterator it = idMap.begin(); it != idMap.end(); ++it) {
|
for (TextureMap::iterator it = idMap.begin(); it != idMap.end(); ++it) {
|
||||||
if (it->second != Textures::InvalidId)
|
if (it->second != TEXTURES_INVALID_ID)
|
||||||
glDeleteTextures(1, &it->second);
|
glDeleteTextures(1, &it->second);
|
||||||
}
|
}
|
||||||
for (TextureImageMap::iterator it = loadedImages.begin(); it != loadedImages.end(); ++it) {
|
for (TextureImageMap::iterator it = loadedImages.begin(); it != loadedImages.end(); ++it) {
|
||||||
@@ -41,7 +27,7 @@ void Textures::clear()
|
|||||||
idMap.clear();
|
idMap.clear();
|
||||||
loadedImages.clear();
|
loadedImages.clear();
|
||||||
|
|
||||||
lastBoundTexture = Textures::InvalidId;
|
lastBoundTexture = TEXTURES_INVALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureId Textures::loadAndBindTexture( const std::string& resourceName )
|
TextureId Textures::loadAndBindTexture( const std::string& resourceName )
|
||||||
@@ -51,7 +37,7 @@ TextureId Textures::loadAndBindTexture( const std::string& resourceName )
|
|||||||
//t.start();
|
//t.start();
|
||||||
TextureId id = loadTexture(resourceName);
|
TextureId id = loadTexture(resourceName);
|
||||||
//t.stop();
|
//t.stop();
|
||||||
if (id != Textures::InvalidId)
|
if (id != TEXTURES_INVALID_ID)
|
||||||
bind(id);
|
bind(id);
|
||||||
|
|
||||||
//t.printEvery(1000);
|
//t.printEvery(1000);
|
||||||
@@ -59,25 +45,24 @@ TextureId Textures::loadAndBindTexture( const std::string& resourceName )
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureId Textures::loadTexture( const std::string& resourceName, bool inTextureFolder /* = true */ )
|
TextureId Textures::loadTexture(const std::string& resourceName, bool inTextureFolder) {
|
||||||
{
|
|
||||||
TextureMap::iterator it = idMap.find(resourceName);
|
TextureMap::iterator it = idMap.find(resourceName);
|
||||||
if (it != idMap.end())
|
if (it != idMap.end())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
bool isUrl = Util::startsWith(resourceName, "http://") || Util::startsWith(resourceName, "https://");
|
bool isUrl = Util::startsWith(resourceName, "http://") || Util::startsWith(resourceName, "https://");
|
||||||
TextureData texdata = platform->loadTexture(resourceName, isUrl ? false : inTextureFolder);
|
TextureData texdata = m_platform.loadTexture(resourceName, isUrl ? false : inTextureFolder);
|
||||||
if (texdata.data)
|
if (texdata.data)
|
||||||
return assignTexture(resourceName, texdata);
|
return assignTexture(resourceName, texdata);
|
||||||
else if (texdata.identifier != InvalidId) {
|
else if (texdata.identifier != TEXTURES_INVALID_ID) {
|
||||||
//LOGI("Adding id: %d for %s\n", texdata.identifier, resourceName.c_str());
|
//LOGI("Adding id: %d for %s\n", texdata.identifier, resourceName.c_str());
|
||||||
idMap.insert(std::make_pair(resourceName, texdata.identifier));
|
idMap.insert(std::make_pair(resourceName, texdata.identifier));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
idMap.insert(std::make_pair(resourceName, Textures::InvalidId));
|
idMap.insert(std::make_pair(resourceName, TEXTURES_INVALID_ID));
|
||||||
//loadedImages.insert(std::make_pair(InvalidId, texdata));
|
//loadedImages.insert(std::make_pair(InvalidId, texdata));
|
||||||
}
|
}
|
||||||
return Textures::InvalidId;
|
return TEXTURES_INVALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureId Textures::assignTexture( const std::string& resourceName, const TextureData& img )
|
TextureId Textures::assignTexture( const std::string& resourceName, const TextureData& img )
|
||||||
@@ -87,13 +72,14 @@ TextureId Textures::assignTexture( const std::string& resourceName, const Textur
|
|||||||
|
|
||||||
bind(id);
|
bind(id);
|
||||||
|
|
||||||
if (MIPMAP) {
|
#ifdef TEXTURES_MIPMAP
|
||||||
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
} else {
|
#else
|
||||||
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
if (blur) {
|
if (blur) {
|
||||||
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri2(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
@@ -249,37 +235,6 @@ int Textures::crispBlend( int c0, int c1 )
|
|||||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||||
}
|
}
|
||||||
|
|
||||||
// shredder here, moved the code from minecraft.cpp bcus that isnt the right place
|
|
||||||
// had to implement this because i couldn't find a similar function in the code to do this
|
|
||||||
int* Textures::loadTexturePixels(TextureId texId, const std::string& resourceName){
|
|
||||||
|
|
||||||
const TextureData* texture = getTemporaryTextureData(texId); // storing raw pixels
|
|
||||||
|
|
||||||
int size = texture->w * texture->h; // gets the size of our funny lil guy
|
|
||||||
int* pixels = new int[size]; // memory leaks be galore
|
|
||||||
unsigned char* raw = texture->data; // storing raw data into our beloved variable
|
|
||||||
for (int i = 0; i < (texture->w * texture->h); i++){
|
|
||||||
// my head hurts i hate working with this
|
|
||||||
|
|
||||||
|
|
||||||
// uh since each pixel stores r g b a, aka the color channels which are each one byte, we multiply them by 4 to move from one pixel to another
|
|
||||||
|
|
||||||
int r = raw[i * 4 + 0]; // gets us the first channel aka red
|
|
||||||
int g = raw[i * 4 + 1]; // gets us the second channel green
|
|
||||||
int b = raw[i * 4 + 2]; // gets us the third channel blue
|
|
||||||
int a = raw[i * 4 + 3]; // gets us the alpha channel
|
|
||||||
|
|
||||||
// woohoo pixels uh should have been seperated into their colors now hopefully
|
|
||||||
|
|
||||||
// r g b a
|
|
||||||
// ugh we now got to turn it into the AA RR GGBB format aak 0xAARRGGBB
|
|
||||||
// b gets 0 - 7 (8 bits), g gets 7 - 15 (8 bits), r gets 16 - 23 (8 bits), alpha gets the last ones 24 - 31 (8 bits),
|
|
||||||
pixels[i] = (a << 24) | (r << 16) | (g << 8) | (b); // shuld combine them into one 32 bit int unless i did something dumb
|
|
||||||
}
|
|
||||||
return pixels; // your meal has been prepared john colors
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///*public*/ int loadHttpTexture(std::string url, std::string backup) {
|
///*public*/ int loadHttpTexture(std::string url, std::string backup) {
|
||||||
// HttpTexture texture = httpTextures.get(url);
|
// HttpTexture texture = httpTextures.get(url);
|
||||||
// if (texture != NULL) {
|
// if (texture != NULL) {
|
||||||
|
|||||||
@@ -6,9 +6,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <IPlatform.h>
|
||||||
#include "gles.h"
|
#include "gles.h"
|
||||||
#include "TextureData.h"
|
#include "TextureData.h"
|
||||||
|
|
||||||
|
#define TEXTURES_INVALID_ID -1
|
||||||
|
#define TEXTURES_MIPMAP 0
|
||||||
|
|
||||||
class DynamicTexture;
|
class DynamicTexture;
|
||||||
class Options;
|
class Options;
|
||||||
class AppPlatform;
|
class AppPlatform;
|
||||||
@@ -24,55 +28,52 @@ typedef std::map<TextureId, TextureData> TextureImageMap;
|
|||||||
class Textures
|
class Textures
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Textures(Options* options_, AppPlatform* platform_);
|
Textures(Options& options, IPlatform& platform) : m_options(options), m_platform(platform) {}
|
||||||
~Textures();
|
~Textures();
|
||||||
|
|
||||||
void addDynamicTexture(DynamicTexture* dynamicTexture);
|
void addDynamicTexture(DynamicTexture* dynamicTexture);
|
||||||
|
|
||||||
__inline void bind(TextureId id) {
|
inline void bind(TextureId id) {
|
||||||
if (id != Textures::InvalidId && lastBoundTexture != id) {
|
if (id != TEXTURES_INVALID_ID && lastBoundTexture != id) {
|
||||||
glBindTexture2(GL_TEXTURE_2D, id);
|
glBindTexture2(GL_TEXTURE_2D, id);
|
||||||
lastBoundTexture = id;
|
lastBoundTexture = id;
|
||||||
++textureChanges;
|
++textureChanges;
|
||||||
} else if (id == Textures::InvalidId){
|
} else if (id == TEXTURES_INVALID_ID){
|
||||||
LOGI("invalidId!\n");
|
LOGI("invalidId!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureId loadTexture(const std::string& resourceName, bool inTextureFolder = true);
|
TextureId loadTexture(const std::string& resourceName, bool inTextureFolder = true);
|
||||||
TextureId loadAndBindTexture(const std::string& resourceName);
|
TextureId loadAndBindTexture(const std::string& resourceName);
|
||||||
|
|
||||||
TextureId assignTexture(const std::string& resourceName, const TextureData& img);
|
TextureId assignTexture(const std::string& resourceName, const TextureData& img);
|
||||||
const TextureData* getTemporaryTextureData(TextureId id);
|
const TextureData* getTemporaryTextureData(TextureId id);
|
||||||
|
|
||||||
int* loadTexturePixels(TextureId texId, const std::string& resourceName);
|
|
||||||
|
|
||||||
void tick(bool uploadToGraphicsCard);
|
void tick(bool uploadToGraphicsCard);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
void reloadAll();
|
void reloadAll();
|
||||||
|
|
||||||
__inline static bool isTextureIdValid(TextureId t) { return t != Textures::InvalidId; }
|
inline static bool isTextureIdValid(TextureId t) { return t != TEXTURES_INVALID_ID; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int smoothBlend(int c0, int c1);
|
int smoothBlend(int c0, int c1);
|
||||||
int crispBlend(int c0, int c1);
|
int crispBlend(int c0, int c1);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool MIPMAP;
|
|
||||||
static int textureChanges;
|
static int textureChanges;
|
||||||
static const TextureId InvalidId;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextureMap idMap;
|
TextureMap idMap;
|
||||||
TextureImageMap loadedImages;
|
TextureImageMap loadedImages;
|
||||||
|
|
||||||
Options* options;
|
Options& m_options;
|
||||||
AppPlatform* platform;
|
IPlatform& m_platform;
|
||||||
|
|
||||||
bool clamp;
|
bool clamp = false;
|
||||||
bool blur;
|
bool blur = false;
|
||||||
|
|
||||||
int lastBoundTexture;
|
int lastBoundTexture = TEXTURES_INVALID_ID;
|
||||||
std::vector<DynamicTexture*> dynamicTextures;
|
std::vector<DynamicTexture*> dynamicTextures;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "TileRenderer.h"
|
#include "TileRenderer.h"
|
||||||
#include "Chunk.h"
|
#include "Chunk.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "Tesselator.h"
|
#include "Tesselator.h"
|
||||||
|
|
||||||
#include "../../world/level/LevelSource.h"
|
#include "../../world/level/LevelSource.h"
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "../../world/level/tile/BedTile.h"
|
#include "../../world/level/tile/BedTile.h"
|
||||||
#include "../../world/level/tile/StemTile.h"
|
#include "../../world/level/tile/StemTile.h"
|
||||||
#include "../../world/level/tile/StairTile.h"
|
#include "../../world/level/tile/StairTile.h"
|
||||||
#include "../../world/level/tile/FireTile.h"
|
|
||||||
#include "../../world/Direction.h"
|
#include "../../world/Direction.h"
|
||||||
#include "../../world/Facing.h"
|
#include "../../world/Facing.h"
|
||||||
#include "tileentity/TileEntityRenderer.h"
|
#include "tileentity/TileEntityRenderer.h"
|
||||||
@@ -158,8 +157,8 @@ bool TileRenderer::tesselateInWorld( Tile* tt, int x, int y, int z )
|
|||||||
return tesselateRowInWorld(tt, x, y, z);
|
return tesselateRowInWorld(tt, x, y, z);
|
||||||
} else if (shape == Tile::SHAPE_TORCH) {
|
} else if (shape == Tile::SHAPE_TORCH) {
|
||||||
return tesselateTorchInWorld(tt, x, y, z);
|
return tesselateTorchInWorld(tt, x, y, z);
|
||||||
} else if (shape == Tile::SHAPE_FIRE) {
|
//} else if (shape == Tile::SHAPE_FIRE) {
|
||||||
return tesselateFireInWorld(tt, x, y, z);
|
// return tesselateFireInWorld(tt, x, y, z);
|
||||||
//} else if (shape == Tile::SHAPE_RED_DUST) {
|
//} else if (shape == Tile::SHAPE_RED_DUST) {
|
||||||
// return tesselateDustInWorld(tt, x, y, z);
|
// return tesselateDustInWorld(tt, x, y, z);
|
||||||
} else if (shape == Tile::SHAPE_LADDER) {
|
} else if (shape == Tile::SHAPE_LADDER) {
|
||||||
@@ -223,278 +222,6 @@ bool TileRenderer::tesselateTorchInWorld( Tile* tt, int x, int y, int z )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
|
||||||
{
|
|
||||||
// @todo: fire alpha transparency seems to be scuffed, also it seems i might have messed up the second layer while porting from lce/java , need to look into it - shredder
|
|
||||||
|
|
||||||
Tesselator& t = Tesselator::instance;
|
|
||||||
|
|
||||||
int tex = tt->getTexture(0);
|
|
||||||
|
|
||||||
if (fixedTexture >= 0) tex = fixedTexture;
|
|
||||||
|
|
||||||
float br = tt->getBrightness( level, x, y, z );
|
|
||||||
t.color( br, br, br );
|
|
||||||
|
|
||||||
int xt = ((tex & 0xf) << 4);
|
|
||||||
int yt = tex & 0xf0;
|
|
||||||
|
|
||||||
float u0 = (xt) / 256.0f;
|
|
||||||
float u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
float v0 = (yt) / 256.0f;
|
|
||||||
float v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
float h = 1.4f;
|
|
||||||
|
|
||||||
if ( level->isSolidBlockingTile( x, y - 1, z ) || Tile::fire->canBurn( level, x, y - 1, z ) )
|
|
||||||
{
|
|
||||||
float x0 = x + 0.5f + 0.2f;
|
|
||||||
float x1 = x + 0.5f - 0.2f;
|
|
||||||
float z0 = z + 0.5f + 0.2f;
|
|
||||||
float z1 = z + 0.5f - 0.2f;
|
|
||||||
|
|
||||||
float x0_ = x + 0.5f - 0.3f;
|
|
||||||
float x1_ = x + 0.5f + 0.3f;
|
|
||||||
float z0_ = z + 0.5f - 0.3f;
|
|
||||||
float z1_ = z + 0.5f + 0.3f;
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
u0 = (xt) / 256.0f;
|
|
||||||
u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
v0 = (yt) / 256.0f;
|
|
||||||
v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
x0 = x + 0.5f - 0.5f;
|
|
||||||
x1 = x + 0.5f + 0.5f;
|
|
||||||
z0 = z + 0.5f - 0.5f;
|
|
||||||
z1 = z + 0.5f + 0.5f;
|
|
||||||
|
|
||||||
x0_ = x + 0.5f - 0.4f;
|
|
||||||
x1_ = x + 0.5f + 0.4f;
|
|
||||||
z0_ = z + 0.5f - 0.4f;
|
|
||||||
z1_ = z + 0.5f + 0.4f;
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 1 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0 ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z + 0 ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
|
|
||||||
u0 = (xt) / 256.0f;
|
|
||||||
u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
v0 = (yt) / 256.0f;
|
|
||||||
v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + 0 ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0 ), ( float )( y + h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float r = 0.2f;
|
|
||||||
float yo = 1 / 16.0f;
|
|
||||||
if ( ( ( x + y + z ) & 1 ) == 1 )
|
|
||||||
{
|
|
||||||
u0 = (xt) / 256.0f;
|
|
||||||
u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
v0 = (yt) / 256.0f;
|
|
||||||
v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
}
|
|
||||||
if ( ( ( x / 2 + y / 2 + z / 2 ) & 1 ) == 1 )
|
|
||||||
{
|
|
||||||
float tmp = u1;
|
|
||||||
u1 = u0;
|
|
||||||
u0 = tmp;
|
|
||||||
}
|
|
||||||
if ( Tile::fire->canBurn( level, x - 1, y, z ) )
|
|
||||||
{
|
|
||||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
if ( Tile::fire->canBurn( level, x + 1, y, z ) )
|
|
||||||
{
|
|
||||||
t.vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 - 0 ), ( float )( y + 0 + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1 - r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 1.0f - r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f - 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f - 0 ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f - r ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
if ( Tile::fire->canBurn( level, x, y, z - 1 ) )
|
|
||||||
{
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z +
|
|
||||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z +
|
|
||||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
if ( Tile::fire->canBurn( level, x, y, z + 1 ) )
|
|
||||||
{
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
|
||||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
|
||||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
|
||||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
|
||||||
r ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
|
||||||
0.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + 0.0f + yo ), ( float )( z + 1.0f -
|
|
||||||
0.0f ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y + h + yo ), ( float )( z + 1.0f -
|
|
||||||
r ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
if ( Tile::fire->canBurn( level, x, y + 1.0f, z ) )
|
|
||||||
{
|
|
||||||
double x0 = x + 0.5f + 0.5f;
|
|
||||||
double x1 = x + 0.5f - 0.5f;
|
|
||||||
double z0 = z + 0.5f + 0.5f;
|
|
||||||
double z1 = z + 0.5f - 0.5f;
|
|
||||||
|
|
||||||
double x0_ = x + 0.5f - 0.5f;
|
|
||||||
double x1_ = x + 0.5f + 0.5f;
|
|
||||||
double z0_ = z + 0.5f - 0.5f;
|
|
||||||
double z1_ = z + 0.5f + 0.5f;
|
|
||||||
|
|
||||||
u0 = (xt) / 256.0f;
|
|
||||||
u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
v0 = (yt) / 256.0f;
|
|
||||||
v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
y += 1;
|
|
||||||
h = -0.2f;
|
|
||||||
|
|
||||||
if ( ( ( x + y + z ) & 1 ) == 0 )
|
|
||||||
{
|
|
||||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z +
|
|
||||||
0 ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z +
|
|
||||||
0 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x0 ), ( float )( y + 0 ), ( float )( z +
|
|
||||||
1 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x0_ ), ( float )( y + h ), ( float )( z +
|
|
||||||
1 ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
u0 = (xt) / 256.0f;
|
|
||||||
u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
v0 = (yt) / 256.0f;
|
|
||||||
v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z +
|
|
||||||
1.0f ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x1 ), ( float )( y + 0.0f ), ( float )( z +
|
|
||||||
0 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x1_ ), ( float )( y + h ), ( float )( z +
|
|
||||||
0 ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
|
||||||
h ), ( float )( z1_ ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
|
||||||
0.0f ), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
|
||||||
0.0f ), ( float )( z1 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
|
||||||
h ), ( float )( z1_ ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
|
|
||||||
u0 = (xt) / 256.0f;
|
|
||||||
u1 = (xt + 15.99f) / 256.0f;
|
|
||||||
v0 = (yt) / 256.0f;
|
|
||||||
v1 = (yt + 15.99f) / 256.0f;
|
|
||||||
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
|
||||||
h ), ( float )( z0_ ), ( float )( u1 ), ( float )( v0 ) );
|
|
||||||
t.vertexUV( ( float )( x + 1.0f ), ( float )( y +
|
|
||||||
0.0f ), ( float )( z0 ), ( float )( u1 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
|
||||||
0.0f ), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) );
|
|
||||||
t.vertexUV( ( float )( x + 0.0f ), ( float )( y +
|
|
||||||
h ), ( float )( z0_ ), ( float )( u0 ), ( float )( v0 ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TileRenderer::tesselateLadderInWorld( Tile* tt, int x, int y, int z )
|
bool TileRenderer::tesselateLadderInWorld( Tile* tt, int x, int y, int z )
|
||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ public:
|
|||||||
bool tesselateFenceGateInWorld(FenceGateTile* tt, int x, int y, int z);
|
bool tesselateFenceGateInWorld(FenceGateTile* tt, int x, int y, int z);
|
||||||
bool tesselateBedInWorld(Tile *tt, int x, int y, int z);
|
bool tesselateBedInWorld(Tile *tt, int x, int y, int z);
|
||||||
bool tesselateRowInWorld(Tile* tt, int x, int y, int z);
|
bool tesselateRowInWorld(Tile* tt, int x, int y, int z);
|
||||||
bool tesselateFireInWorld(Tile* tt, int x, int y, int z);
|
|
||||||
|
|
||||||
|
|
||||||
void tesselateTorch(Tile* tt, float x, float y, float z, float xxa, float zza);
|
void tesselateTorch(Tile* tt, float x, float y, float z, float xxa, float zza);
|
||||||
void tesselateCrossTexture(Tile* tt, int data, float x, float y, float z);
|
void tesselateCrossTexture(Tile* tt, int data, float x, float y, float z);
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
#define USE_VBO
|
#define USE_VBO
|
||||||
#define GL_QUADS 0x0007
|
#define GL_QUADS 0x0007
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#import <OpenGLES/ES1/gl.h>
|
#import <OpenGLES/ES1/gl.height>
|
||||||
#import <OpenGLES/ES1/glext.h>
|
#import <OpenGLES/ES1/glext.height>
|
||||||
#elif defined(ANDROID) || defined(__EMSCRIPTEN__)
|
#elif defined(ANDROID) || defined(__EMSCRIPTEN__)
|
||||||
#import <GLES/gl.h>
|
#include <GLES/gl.h>
|
||||||
#import <GLES/glext.h>
|
#include <GLES/glext.h>
|
||||||
#else
|
#else
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
|||||||
@@ -206,93 +206,3 @@ void WaterSideTexture::tick() {
|
|||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FireTexture::FireTexture()
|
|
||||||
: super(((Tile*)Tile::fire)->tex),
|
|
||||||
_tick(0),
|
|
||||||
_frame(0)
|
|
||||||
{
|
|
||||||
current = new float[16*20];
|
|
||||||
next = new float[16*20];
|
|
||||||
heat = new float[16*20];
|
|
||||||
heata = new float[16*20];
|
|
||||||
|
|
||||||
for (int i = 0; i < 256; ++i) {
|
|
||||||
current[i] = 0;
|
|
||||||
next[i] = 0;
|
|
||||||
heat[i] = 0;
|
|
||||||
heata[i] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FireTexture::~FireTexture() {
|
|
||||||
delete[] current;
|
|
||||||
delete[] next;
|
|
||||||
delete[] heat;
|
|
||||||
delete[] heata;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// oh boy time to implement fire textures, i am so fucked - shredder
|
|
||||||
|
|
||||||
void FireTexture::tick() {
|
|
||||||
// loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder
|
|
||||||
for (int x = 0; x < 16; x++) {
|
|
||||||
for (int y = 0; y < 20; y++) {
|
|
||||||
int count = 18;
|
|
||||||
float pow = this->current[x + (y + 1) % 20 * 16] * (float)(count);
|
|
||||||
for (int xx = x - 1; xx <= x + 1; xx++) {
|
|
||||||
for (int yy = y; yy <= y + 1; yy++) {
|
|
||||||
if (xx >= 0 && yy >= 0 && xx < 16 && yy < 20) {
|
|
||||||
pow += this->current[xx + yy * 16];
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->next[x + y * 16] = pow / (float(count) * 1.06f);
|
|
||||||
if (y >= 19) {
|
|
||||||
this->next[x + y * 16] = float(Mth::random() * Mth::random() * Mth::random() * 4.0 + Mth::random() * 0.1f + 0.2f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// hopefully this doesn't cause any mysterious issues - shredder
|
|
||||||
float* tmp = next;
|
|
||||||
next = current;
|
|
||||||
current = tmp;
|
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
|
||||||
float pow = this->current[i] * 1.8f;
|
|
||||||
if (pow > 1.0f) {
|
|
||||||
pow = 1.0f;
|
|
||||||
}
|
|
||||||
if (pow < 0.0f) {
|
|
||||||
pow = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int r = (int) (pow * 155.0f + 100.0f);
|
|
||||||
int g = (int)(pow * pow * 255.0f);
|
|
||||||
int b = (int)(pow * pow * pow * pow * pow * pow * pow * pow * pow * pow * 255.0f);
|
|
||||||
int a = 255;
|
|
||||||
if (pow < 0.5f) {
|
|
||||||
a = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: cant be arsed rn to implement the anaglyph3d check would be nice to check if it does - shredder
|
|
||||||
//if (this->anaglyph3d) {
|
|
||||||
// float rr = (r * 30 + g * 59 + b * 11) / 100;
|
|
||||||
// float gg = (r * 30 + g * 70) / 100;
|
|
||||||
// float bb = (r * 30 + b * 70) / 100;
|
|
||||||
// r = rr;
|
|
||||||
// g = gg;
|
|
||||||
// b = bb;
|
|
||||||
//}
|
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
|
||||||
pixels[i * 4 + 1] = g;
|
|
||||||
pixels[i * 4 + 2] = b;
|
|
||||||
pixels[i * 4 + 3] = a;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,21 +56,4 @@ public:
|
|||||||
void tick();
|
void tick();
|
||||||
};
|
};
|
||||||
|
|
||||||
class FireTexture: public DynamicTexture
|
|
||||||
{
|
|
||||||
typedef DynamicTexture super;
|
|
||||||
int _tick;
|
|
||||||
int _frame;
|
|
||||||
|
|
||||||
float* current;
|
|
||||||
float* next;
|
|
||||||
float* heat;
|
|
||||||
float* heata;
|
|
||||||
|
|
||||||
public:
|
|
||||||
FireTexture();
|
|
||||||
~FireTexture();
|
|
||||||
|
|
||||||
void tick();
|
|
||||||
};
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_RENDERER_PTEXTURE__DynamicTexture_H__*/
|
#endif /*NET_MINECRAFT_CLIENT_RENDERER_PTEXTURE__DynamicTexture_H__*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "SoundEngine.h"
|
#include "SoundEngine.h"
|
||||||
#include "../Options.h"
|
#include "../Options.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../../world/entity/Mob.h"
|
#include "../../world/entity/Mob.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "SoundEngine.h"
|
#include "SoundEngine.h"
|
||||||
#include "../Options.h"
|
#include "../Options.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../../world/entity/Mob.h"
|
#include "../../world/entity/Mob.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
59
src/gamemode/CreativeMode.cpp
Executable file
59
src/gamemode/CreativeMode.cpp
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#include "CreativeMode.h"
|
||||||
|
#include <Minecraft.h>
|
||||||
|
#include <world/level/Level.h>
|
||||||
|
#include <world/entity/player/Abilities.h>
|
||||||
|
|
||||||
|
static const int DestructionTickDelay = 5;
|
||||||
|
|
||||||
|
CreativeMode::CreativeMode(Minecraft& minecraft)
|
||||||
|
: super(minecraft)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreativeMode::startDestroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
|
if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == Item::bow->id)
|
||||||
|
return;
|
||||||
|
|
||||||
|
creativeDestroyBlock(player, x, y, z, face);
|
||||||
|
destroyDelay = DestructionTickDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreativeMode::creativeDestroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
|
minecraft.level->extinguishFire(x, y, z, face);
|
||||||
|
destroyBlock(player, x, y, z, face);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreativeMode::continueDestroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
|
destroyDelay--;
|
||||||
|
if (destroyDelay <= 0) {
|
||||||
|
destroyDelay = DestructionTickDelay;
|
||||||
|
creativeDestroyBlock(player, x, y, z, face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreativeMode::stopDestroyBlock(Player* player) {
|
||||||
|
destroyDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreativeMode::initAbilities( Abilities& abilities ) {
|
||||||
|
abilities.mayfly = true;
|
||||||
|
abilities.instabuild = true;
|
||||||
|
abilities.invulnerable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CreativeMode::isCreativeType() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreativeMode::releaseUsingItem( Player* player ) {
|
||||||
|
if(player->getCarriedItem() != NULL) {
|
||||||
|
int oldItemId = player->getCarriedItem()->id;
|
||||||
|
int oldAux = player->getAuxData();
|
||||||
|
super::releaseUsingItem(player);
|
||||||
|
if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == oldItemId) {
|
||||||
|
player->getCarriedItem()->setAuxValue(oldAux);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super::releaseUsingItem(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,18 +9,19 @@ class CreativeMode: public GameMode
|
|||||||
{
|
{
|
||||||
typedef GameMode super;
|
typedef GameMode super;
|
||||||
public:
|
public:
|
||||||
CreativeMode(Minecraft* minecraft);
|
CreativeMode(Minecraft& minecraft);
|
||||||
|
|
||||||
void startDestroyBlock(int x, int y, int z, int face);
|
void startDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void continueDestroyBlock(int x, int y, int z, int face);
|
void continueDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void stopDestroyBlock();
|
void stopDestroyBlock(Player* player);
|
||||||
|
|
||||||
bool isCreativeType();
|
bool isCreativeType();
|
||||||
|
|
||||||
void initAbilities(Abilities& abilities);
|
void initAbilities(Abilities& abilities);
|
||||||
|
|
||||||
|
void releaseUsingItem(Player* player);
|
||||||
private:
|
private:
|
||||||
void creativeDestroyBlock(int x, int y, int z, int face);
|
void creativeDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__*/
|
#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__CreativeMode_H__*/
|
||||||
111
src/gamemode/CreatorMode.cpp
Executable file
111
src/gamemode/CreatorMode.cpp
Executable file
@@ -0,0 +1,111 @@
|
|||||||
|
#include "CreatorMode.h"
|
||||||
|
#include "world/entity/player/Player.h"
|
||||||
|
#include "world/level/Level.h"
|
||||||
|
#include <Minecraft.h>
|
||||||
|
#include <world/entity/player/Abilities.h>
|
||||||
|
|
||||||
|
static const int DestructionTickDelay = 5;
|
||||||
|
|
||||||
|
class Creator: public ICreator {
|
||||||
|
//virtual void getEvents();
|
||||||
|
|
||||||
|
public:
|
||||||
|
Creator(/*int eventLifeTime*/)
|
||||||
|
: _tileEvents(32),
|
||||||
|
_tickId(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTick(int tick) {
|
||||||
|
_tickId = tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventList<TileEvent>& getTileEvents() { return _tileEvents; }
|
||||||
|
|
||||||
|
void addevent_blockUse(int entityId, int x, int y, int z, int face) {
|
||||||
|
TileEvent t = {
|
||||||
|
entityId,
|
||||||
|
x,y,z,
|
||||||
|
face
|
||||||
|
};
|
||||||
|
_tileEvents.add(t, _tickId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
EventList<TileEvent> _tileEvents;
|
||||||
|
int _tickId;
|
||||||
|
};
|
||||||
|
|
||||||
|
CreatorMode::CreatorMode(Minecraft& minecraft)
|
||||||
|
: super(minecraft)
|
||||||
|
{
|
||||||
|
_creator = new Creator();
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatorMode::~CreatorMode() {
|
||||||
|
delete _creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::startDestroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
|
if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == Item::bow->id)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CreatorDestroyBlock(player, x, y, z, face);
|
||||||
|
destroyDelay = DestructionTickDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::CreatorDestroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
|
minecraft.level->extinguishFire(x, y, z, face);
|
||||||
|
destroyBlock(player, x, y, z, face);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::continueDestroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
|
destroyDelay--;
|
||||||
|
if (destroyDelay <= 0) {
|
||||||
|
destroyDelay = DestructionTickDelay;
|
||||||
|
CreatorDestroyBlock(player, x, y, z, face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CreatorMode::useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit ) {
|
||||||
|
if (item && item->id == ((Item*)Item::sword_iron)->id)
|
||||||
|
_creator->addevent_blockUse(player->entityId, x, y, z, face);
|
||||||
|
return super::useItemOn(player, level, item, x, y, z, face, hit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::stopDestroyBlock(Player* player) {
|
||||||
|
destroyDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::initAbilities( Abilities& abilities ) {
|
||||||
|
abilities.mayfly = true;
|
||||||
|
abilities.instabuild = true;
|
||||||
|
abilities.invulnerable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CreatorMode::isCreativeType() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::releaseUsingItem( Player* player ) {
|
||||||
|
if(player->getCarriedItem() != NULL) {
|
||||||
|
int oldItemId = player->getCarriedItem()->id;
|
||||||
|
int oldAux = player->getAuxData();
|
||||||
|
super::releaseUsingItem(player);
|
||||||
|
if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == oldItemId) {
|
||||||
|
player->getCarriedItem()->setAuxValue(oldAux);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super::releaseUsingItem(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ICreator* CreatorMode::getCreator() {
|
||||||
|
return _creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatorMode::tick() {
|
||||||
|
_creator->setTick(minecraft.level->getTime());
|
||||||
|
super::tick();
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
//package net.minecraft.client.gamemode;
|
//package net.minecraft.client.gamemode;
|
||||||
|
|
||||||
#include "GameMode.h"
|
#include "GameMode.h"
|
||||||
#include "../../world/PosTranslator.h"
|
#include <world/PosTranslator.h>
|
||||||
|
|
||||||
class ICreator {
|
class ICreator {
|
||||||
public:
|
public:
|
||||||
@@ -102,12 +102,12 @@ class CreatorMode: public GameMode
|
|||||||
{
|
{
|
||||||
typedef GameMode super;
|
typedef GameMode super;
|
||||||
public:
|
public:
|
||||||
CreatorMode(Minecraft* minecraft);
|
CreatorMode(Minecraft& minecraft);
|
||||||
~CreatorMode();
|
~CreatorMode();
|
||||||
|
|
||||||
void startDestroyBlock(int x, int y, int z, int face);
|
void startDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void continueDestroyBlock(int x, int y, int z, int face);
|
void continueDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void stopDestroyBlock();
|
void stopDestroyBlock(Player* player);
|
||||||
|
|
||||||
bool useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit);
|
bool useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit);
|
||||||
|
|
||||||
@@ -118,8 +118,9 @@ public:
|
|||||||
|
|
||||||
void initAbilities(Abilities& abilities);
|
void initAbilities(Abilities& abilities);
|
||||||
|
|
||||||
|
void releaseUsingItem(Player* player);
|
||||||
private:
|
private:
|
||||||
void CreatorDestroyBlock(int x, int y, int z, int face);
|
void CreatorDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
|
|
||||||
Creator* _creator;
|
Creator* _creator;
|
||||||
};
|
};
|
||||||
@@ -1,35 +1,15 @@
|
|||||||
#include "GameMode.h"
|
#include "GameMode.h"
|
||||||
#include "../Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../../network/packet/UseItemPacket.h"
|
#include <network/packet/UseItemPacket.h>
|
||||||
#include "../../network/packet/PlayerActionPacket.h"
|
#include <network/packet/PlayerActionPacket.h>
|
||||||
#include "../../world/level/Level.h"
|
#include <world/level/Level.h>
|
||||||
#include "../../world/item/ItemInstance.h"
|
#include <world/item/ItemInstance.h>
|
||||||
#include "../player/LocalPlayer.h"
|
#include <client/player/LocalPlayer.h>
|
||||||
#include "client/Options.h"
|
#include <client/Options.h>
|
||||||
#ifndef STANDALONE_SERVER
|
#include <network/RakNetInstance.h>
|
||||||
#include "../sound/SoundEngine.h"
|
#include <network/packet/RemoveBlockPacket.h>
|
||||||
#include "../particle/ParticleEngine.h"
|
#include <world/level/material/Material.h>
|
||||||
#endif
|
|
||||||
#include "../../network/RakNetInstance.h"
|
|
||||||
#include "../../network/packet/RemoveBlockPacket.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../renderer/LevelRenderer.h"
|
|
||||||
#endif
|
|
||||||
#include "../../world/level/material/Material.h"
|
|
||||||
|
|
||||||
GameMode::GameMode( Minecraft* minecraft)
|
|
||||||
: minecraft(minecraft),
|
|
||||||
destroyProgress(0),
|
|
||||||
oDestroyProgress(0),
|
|
||||||
destroyTicks(0),
|
|
||||||
destroyDelay(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/
|
|
||||||
Player* GameMode::createPlayer(Level* level) {
|
|
||||||
return new LocalPlayer(minecraft, level, minecraft->options.getStringValue(OPTIONS_USERNAME), level->dimension->id, isCreativeType());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/
|
/*virtual*/
|
||||||
void GameMode::interact(Player* player, Entity* entity) {
|
void GameMode::interact(Player* player, Entity* entity) {
|
||||||
@@ -38,23 +18,24 @@ void GameMode::interact(Player* player, Entity* entity) {
|
|||||||
|
|
||||||
/*virtual*/
|
/*virtual*/
|
||||||
void GameMode::attack(Player* player, Entity* entity) {
|
void GameMode::attack(Player* player, Entity* entity) {
|
||||||
if (minecraft->level->adventureSettings.noPvP && entity->isPlayer())
|
if (minecraft.level->adventureSettings.noPvP && entity->isPlayer())
|
||||||
return;
|
return;
|
||||||
if (minecraft->level->adventureSettings.noPvM && entity->isMob())
|
if (minecraft.level->adventureSettings.noPvM && entity->isMob())
|
||||||
return;
|
return;
|
||||||
player->attack(entity);
|
player->attack(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
void GameMode::startDestroyBlock( int x, int y, int z, int face ) {
|
void GameMode::startDestroyBlock(Player* player, int x, int y, int z, int face ) {
|
||||||
if(minecraft->player->getCarriedItem() != NULL && minecraft->player->getCarriedItem()->id == Item::bow->id)
|
if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == Item::bow->id)
|
||||||
return;
|
return;
|
||||||
destroyBlock(x, y, z, face);
|
|
||||||
|
destroyBlock(player, x, y, z, face);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*virtual*/
|
/*virtual*/
|
||||||
bool GameMode::destroyBlock(int x, int y, int z, int face) {
|
bool GameMode::destroyBlock(Player* player, int x, int y, int z, int face) {
|
||||||
Level* level = minecraft->level;
|
Level* level = minecraft.level;
|
||||||
Tile* oldTile = Tile::tiles[level->getTile(x, y, z)];
|
Tile* oldTile = Tile::tiles[level->getTile(x, y, z)];
|
||||||
if (!oldTile)
|
if (!oldTile)
|
||||||
return false;
|
return false;
|
||||||
@@ -65,22 +46,12 @@ bool GameMode::destroyBlock(int x, int y, int z, int face) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
minecraft->particleEngine->destroy(x, y, z);
|
|
||||||
#endif
|
|
||||||
int data = level->getData(x, y, z);
|
int data = level->getData(x, y, z);
|
||||||
bool changed = level->setTile(x, y, z, 0);
|
bool changed = level->setTile(x, y, z, 0);
|
||||||
if (changed) {
|
if (changed) {
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
minecraft->soundEngine->play(oldTile->soundType->getBreakSound(), x + 0.5f, y + 0.5f, z + 0.5f, (oldTile->soundType->getVolume() + 1) / 2, oldTile->soundType->getPitch() * 0.8f);
|
|
||||||
#endif
|
|
||||||
oldTile->destroy(level, x, y, z, data);
|
oldTile->destroy(level, x, y, z, data);
|
||||||
if (minecraft->options.getBooleanValue(OPTIONS_DESTROY_VIBRATION)) minecraft->platform()->vibrate(24);
|
minecraft.onBlockDestroyed(player, x, y, z, face);
|
||||||
|
|
||||||
if (minecraft->isOnline()) {
|
|
||||||
RemoveBlockPacket packet(minecraft->player, x, y, z);
|
|
||||||
minecraft->raknetInstance->send(packet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
@@ -89,10 +60,10 @@ bool GameMode::useItemOn(Player* player, Level* level, ItemInstance* item, int x
|
|||||||
float clickX = hit.x - x;
|
float clickX = hit.x - x;
|
||||||
float clickY = hit.y - y;
|
float clickY = hit.y - y;
|
||||||
float clickZ = hit.z - z;
|
float clickZ = hit.z - z;
|
||||||
if (level->isClientSide) {
|
item = player->inventory->getSelected();
|
||||||
item = player->inventory->getSelected();
|
if(level->isClientSide) {
|
||||||
UseItemPacket packet(x, y, z, face, item, player->entityId, clickX, clickY, clickZ);
|
UseItemPacket packet(x, y, z, face, item, player->entityId, clickX, clickY, clickZ);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
int t = level->getTile(x, y, z);
|
int t = level->getTile(x, y, z);
|
||||||
if (t == Tile::invisible_bedrock->id) return false;
|
if (t == Tile::invisible_bedrock->id) return false;
|
||||||
@@ -118,7 +89,7 @@ bool GameMode::useItem( Player* player, Level* level, ItemInstance* item ) {
|
|||||||
ItemInstance* itemInstance = item->use(level, player);
|
ItemInstance* itemInstance = item->use(level, player);
|
||||||
if(level->isClientSide) {
|
if(level->isClientSide) {
|
||||||
UseItemPacket packet(item, player->entityId, player->aimDirection);
|
UseItemPacket packet(item, player->entityId, player->aimDirection);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
if (itemInstance != item || (itemInstance != NULL && itemInstance->count != oldCount)) {
|
if (itemInstance != item || (itemInstance != NULL && itemInstance->count != oldCount)) {
|
||||||
//player.inventory.items[player.inventory.selected] = itemInstance;
|
//player.inventory.items[player.inventory.selected] = itemInstance;
|
||||||
@@ -149,9 +120,9 @@ void GameMode::initPlayer( Player* player ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameMode::releaseUsingItem(Player* player){
|
void GameMode::releaseUsingItem(Player* player){
|
||||||
if (minecraft->level->isClientSide && player->isUsingItem()) {
|
if(minecraft.level->isClientSide) {
|
||||||
PlayerActionPacket packet(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 0, player->entityId);
|
PlayerActionPacket packet(PlayerActionPacket::RELEASE_USE_ITEM, 0, 0, 0, 0, player->entityId);
|
||||||
minecraft->raknetInstance->send(packet);
|
minecraft.raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
player->releaseUsingItem();
|
player->releaseUsingItem();
|
||||||
}
|
}
|
||||||
@@ -160,15 +131,3 @@ void GameMode::tick() {
|
|||||||
oDestroyProgress = destroyProgress;
|
oDestroyProgress = destroyProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMode::render( float a ) {
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
if (destroyProgress <= 0) {
|
|
||||||
minecraft->gui.progress = 0;
|
|
||||||
minecraft->levelRenderer->destroyProgress = 0;
|
|
||||||
} else {
|
|
||||||
float dp = oDestroyProgress + (destroyProgress - oDestroyProgress) * a;
|
|
||||||
minecraft->gui.progress = dp;
|
|
||||||
minecraft->levelRenderer->destroyProgress = dp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
//package net.minecraft.client.gamemode;
|
//package net.minecraft.client.gamemode;
|
||||||
|
|
||||||
#include "../../world/level/tile/Tile.h"
|
#include <world/level/tile/Tile.h>
|
||||||
|
|
||||||
class ItemInstance;
|
class ItemInstance;
|
||||||
class Minecraft;
|
class Minecraft;
|
||||||
@@ -11,23 +11,22 @@ class Level;
|
|||||||
class Player;
|
class Player;
|
||||||
class Abilities;
|
class Abilities;
|
||||||
|
|
||||||
class GameMode
|
class GameMode {
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
Minecraft* minecraft;
|
Minecraft& minecraft;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameMode(Minecraft* minecraft);
|
GameMode(Minecraft& minecraft) : minecraft(minecraft) {}
|
||||||
virtual ~GameMode() {}
|
virtual ~GameMode() {}
|
||||||
|
|
||||||
virtual void initLevel(Level* level) {}
|
virtual void initLevel(Level* level) {}
|
||||||
|
|
||||||
virtual void startDestroyBlock(int x, int y, int z, int face);
|
virtual void startDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
virtual bool destroyBlock(int x, int y, int z, int face);
|
virtual bool destroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
virtual void continueDestroyBlock(int x, int y, int z, int face) = 0;
|
virtual void continueDestroyBlock(Player* player, int x, int y, int z, int face) = 0;
|
||||||
virtual void stopDestroyBlock() {}
|
virtual void stopDestroyBlock(Player* player) {}
|
||||||
|
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
virtual void render(float a);
|
|
||||||
|
|
||||||
virtual float getPickRange();
|
virtual float getPickRange();
|
||||||
/* void postLevelGen(LevelGen levelGen, Level level) {} */
|
/* void postLevelGen(LevelGen levelGen, Level level) {} */
|
||||||
@@ -35,7 +34,6 @@ public:
|
|||||||
virtual bool useItem(Player* player, Level* level, ItemInstance* item);
|
virtual bool useItem(Player* player, Level* level, ItemInstance* item);
|
||||||
virtual bool useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit);
|
virtual bool useItemOn(Player* player, Level* level, ItemInstance* item, int x, int y, int z, int face, const Vec3& hit);
|
||||||
|
|
||||||
virtual Player* createPlayer(Level* level);
|
|
||||||
virtual void initPlayer(Player* player);
|
virtual void initPlayer(Player* player);
|
||||||
virtual void adjustPlayer(Player* player) {}
|
virtual void adjustPlayer(Player* player) {}
|
||||||
virtual bool canHurtPlayer() { return false; }
|
virtual bool canHurtPlayer() { return false; }
|
||||||
@@ -53,11 +51,11 @@ public:
|
|||||||
|
|
||||||
virtual void releaseUsingItem(Player* player);
|
virtual void releaseUsingItem(Player* player);
|
||||||
|
|
||||||
float oDestroyProgress;
|
float oDestroyProgress = 0;
|
||||||
float destroyProgress;
|
float destroyProgress = 0;
|
||||||
protected:
|
protected:
|
||||||
int destroyTicks;
|
int destroyTicks = 0;
|
||||||
int destroyDelay;
|
int destroyDelay = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__GameMode_H__*/
|
#endif /*NET_MINECRAFT_CLIENT_GAMEMODE__GameMode_H__*/
|
||||||
93
src/gamemode/SurvivalMode.cpp
Executable file
93
src/gamemode/SurvivalMode.cpp
Executable file
@@ -0,0 +1,93 @@
|
|||||||
|
#include "SurvivalMode.h"
|
||||||
|
#include <Minecraft.h>
|
||||||
|
#include <world/level/Level.h>
|
||||||
|
#include <world/entity/player/Abilities.h>
|
||||||
|
|
||||||
|
SurvivalMode::SurvivalMode( Minecraft& minecraft )
|
||||||
|
: super(minecraft),
|
||||||
|
xDestroyBlock(-1),
|
||||||
|
yDestroyBlock(-1),
|
||||||
|
zDestroyBlock(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurvivalMode::continueDestroyBlock(Player* player, int x, int y, int z, int face ) {
|
||||||
|
if (destroyDelay > 0) {
|
||||||
|
destroyDelay--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x == xDestroyBlock && y == yDestroyBlock && z == zDestroyBlock) {
|
||||||
|
int t = minecraft.level->getTile(x, y, z);
|
||||||
|
if (t == 0) return;
|
||||||
|
Tile* tile = Tile::tiles[t];
|
||||||
|
|
||||||
|
destroyProgress += tile->getDestroyProgress(player);
|
||||||
|
|
||||||
|
if ((++destroyTicks & 3) == 1) {
|
||||||
|
#ifndef STANDALONE_SERVER
|
||||||
|
if (tile != NULL) {
|
||||||
|
minecraft->soundEngine->play(tile->soundType->getStepSound(), x + 0.5f, y + 0.5f, z + 0.5f, (tile->soundType->getVolume() + 1) / 8, tile->soundType->getPitch() * 0.5f);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destroyProgress >= 1) {
|
||||||
|
destroyBlock(player, x, y, z, face);
|
||||||
|
destroyProgress = 0;
|
||||||
|
oDestroyProgress = 0;
|
||||||
|
destroyTicks = 0;
|
||||||
|
destroyDelay = 5;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
destroyProgress = 0;
|
||||||
|
oDestroyProgress = 0;
|
||||||
|
destroyTicks = 0;
|
||||||
|
xDestroyBlock = x;
|
||||||
|
yDestroyBlock = y;
|
||||||
|
zDestroyBlock = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SurvivalMode::destroyBlock(Player* player, int x, int y, int z, int face ) {
|
||||||
|
int t = minecraft.level->getTile(x, y, z);
|
||||||
|
int data = minecraft.level->getData(x, y, z);
|
||||||
|
bool changed = GameMode::destroyBlock(player, x, y, z, face);
|
||||||
|
bool couldDestroy = player->canDestroy(Tile::tiles[t]);
|
||||||
|
|
||||||
|
ItemInstance* item = player->inventory->getSelected();
|
||||||
|
if (item != NULL) {
|
||||||
|
item->mineBlock(t, x, y, z);
|
||||||
|
if (item->count == 0) {
|
||||||
|
//item->snap(minecraft->player);
|
||||||
|
player->inventory->clearSlot(player->inventory->selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changed && couldDestroy) {
|
||||||
|
ItemInstance instance(t, 1, data);
|
||||||
|
Tile::tiles[t]->playerDestroy(minecraft.level, player, x, y, z, data);
|
||||||
|
}
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurvivalMode::stopDestroyBlock(Player* player) {
|
||||||
|
destroyProgress = 0;
|
||||||
|
destroyDelay = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurvivalMode::initAbilities( Abilities& abilities ) {
|
||||||
|
abilities.flying = false;
|
||||||
|
abilities.mayfly = false;
|
||||||
|
abilities.instabuild = false;
|
||||||
|
abilities.invulnerable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SurvivalMode::startDestroyBlock(Player* player, int x, int y, int z, int face ) {
|
||||||
|
if(player->getCarriedItem() != NULL && player->getCarriedItem()->id == Item::bow->id)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int t = minecraft.level->getTile(x, y, z);
|
||||||
|
if (t > 0 && destroyProgress == 0) Tile::tiles[t]->attack(minecraft.level, x, y, z, player);
|
||||||
|
if (t > 0 && Tile::tiles[t]->getDestroyProgress(player) >= 1)
|
||||||
|
destroyBlock(player, x, y, z, face);
|
||||||
|
}
|
||||||
@@ -10,12 +10,12 @@ class SurvivalMode: public GameMode
|
|||||||
{
|
{
|
||||||
typedef GameMode super;
|
typedef GameMode super;
|
||||||
public:
|
public:
|
||||||
SurvivalMode(Minecraft* minecraft);
|
SurvivalMode(Minecraft& minecraft);
|
||||||
|
|
||||||
bool destroyBlock(int x, int y, int z, int face);
|
bool destroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void startDestroyBlock(int x, int y, int z, int face);
|
void startDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void continueDestroyBlock(int x, int y, int z, int face);
|
void continueDestroyBlock(Player* player, int x, int y, int z, int face);
|
||||||
void stopDestroyBlock();
|
void stopDestroyBlock(Player* player);
|
||||||
|
|
||||||
bool canHurtPlayer() { return true; }
|
bool canHurtPlayer() { return true; }
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "I18n.h"
|
#include "I18n.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "../AppPlatform.h"
|
#include <IPlatform.h>
|
||||||
#include "../util/StringUtils.h"
|
#include "../util/StringUtils.h"
|
||||||
#include "../world/level/tile/Tile.h"
|
#include "../world/level/tile/Tile.h"
|
||||||
#include "../world/item/ItemInstance.h"
|
#include "../world/item/ItemInstance.h"
|
||||||
@@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
I18n::Map I18n::_strings;
|
I18n::Map I18n::_strings;
|
||||||
|
|
||||||
void I18n::loadLanguage( AppPlatform* platform, const std::string& languageCode )
|
void I18n::loadLanguage(IPlatform& platform, const std::string& languageCode ) {
|
||||||
{
|
|
||||||
_strings.clear();
|
_strings.clear();
|
||||||
fillTranslations(platform, "lang/en_US.lang", true);
|
fillTranslations(platform, "lang/en_US.lang", true);
|
||||||
|
|
||||||
@@ -26,8 +25,7 @@ bool I18n::get( const std::string& id, std::string& out ) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string I18n::get( const std::string& id )
|
std::string I18n::get( const std::string& id ) {
|
||||||
{
|
|
||||||
Map::const_iterator cit = _strings.find(id);
|
Map::const_iterator cit = _strings.find(id);
|
||||||
if (cit != _strings.end())
|
if (cit != _strings.end())
|
||||||
return cit->second;
|
return cit->second;
|
||||||
@@ -35,13 +33,11 @@ std::string I18n::get( const std::string& id )
|
|||||||
return id + '<';//lang.getElement(id);
|
return id + '<';//lang.getElement(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I18n::fillTranslations( AppPlatform* platform, const std::string& filename, bool overwrite )
|
void I18n::fillTranslations(IPlatform& platform, const std::string& filename, bool overwrite ) {
|
||||||
{
|
auto blob = platform.readAssetFile(filename);
|
||||||
BinaryBlob blob = platform->readAssetFile(filename);
|
if (blob.empty()) return;
|
||||||
if (!blob.data || blob.size <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string data((const char*)blob.data, blob.size);
|
std::string data(blob.begin(), blob.end());
|
||||||
std::stringstream fin(data, std::ios_base::in);
|
std::stringstream fin(data, std::ios_base::in);
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
@@ -58,12 +54,9 @@ void I18n::fillTranslations( AppPlatform* platform, const std::string& filename,
|
|||||||
std::string value = Util::stringTrim(line.substr(spos + 1));
|
std::string value = Util::stringTrim(line.substr(spos + 1));
|
||||||
_strings.insert( std::make_pair(key, value ) );
|
_strings.insert( std::make_pair(key, value ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] blob.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string I18n::getDescriptionString( const ItemInstance& item )
|
std::string I18n::getDescriptionString( const ItemInstance& item ) {
|
||||||
{
|
|
||||||
// Convert to lower. Normally std::transform would be used, but tolower might be
|
// Convert to lower. Normally std::transform would be used, but tolower might be
|
||||||
// implemented with a macro in certain C-implementations -> messing stuff up
|
// implemented with a macro in certain C-implementations -> messing stuff up
|
||||||
const std::string desc = item.getDescriptionId();
|
const std::string desc = item.getDescriptionId();
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
|
|
||||||
//package net.minecraft.locale;
|
//package net.minecraft.locale;
|
||||||
|
|
||||||
|
#include "IPlatform.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class AppPlatform;
|
class AppPlatform;
|
||||||
class ItemInstance;
|
class ItemInstance;
|
||||||
|
|
||||||
class I18n
|
class I18n {
|
||||||
{
|
|
||||||
typedef std::map<std::string, std::string> Map;
|
typedef std::map<std::string, std::string> Map;
|
||||||
public:
|
public:
|
||||||
static void loadLanguage(AppPlatform* platform, const std::string& languageCode);
|
static void loadLanguage(IPlatform& platform, const std::string& languageCode);
|
||||||
|
|
||||||
static bool get(const std::string& id, std::string& out);
|
static bool get(const std::string& id, std::string& out);
|
||||||
static std::string get(const std::string& id);
|
static std::string get(const std::string& id);
|
||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
static std::string getDescriptionString( const ItemInstance& item );
|
static std::string getDescriptionString( const ItemInstance& item );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void fillTranslations(AppPlatform* platform, const std::string& filename, bool overwrite);
|
static void fillTranslations(IPlatform& platform, const std::string& filename, bool overwrite);
|
||||||
static Map _strings;
|
static Map _strings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
49
src/main.cpp
49
src/main.cpp
@@ -1,46 +1,9 @@
|
|||||||
/**
|
#include "MinecraftClient.h"
|
||||||
Entry point for cross compilation.
|
|
||||||
|
|
||||||
This is ugly, yes. But it will change in the "half near" future
|
int main() {
|
||||||
to a more correct system of solving the cross-platform entry
|
MinecraftClient minecraft(App::CreatePlatform());
|
||||||
point "problem" */
|
|
||||||
|
|
||||||
#define _SECURE_SCL 0
|
|
||||||
|
|
||||||
// #ifdef WIN32
|
|
||||||
// #include "vld.h"
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
#include "platform/log.h"
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#endif
|
|
||||||
#ifdef ANDROID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "NinecraftApp.h"
|
|
||||||
#define MAIN_CLASS NinecraftApp
|
|
||||||
|
|
||||||
// #ifdef PLATFORM_WINDOWS
|
|
||||||
// #include "main_win32.h"
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
|
||||||
#include "main_glfw.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_ANDROID
|
|
||||||
#ifdef PRE_ANDROID23
|
|
||||||
#include "main_android_java.h"
|
|
||||||
#else
|
|
||||||
#include "main_android.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PLATFORM_RPI
|
|
||||||
#include "main_rpi.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
minecraft.run();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -250,10 +250,10 @@ static void pointerMove(int pointerId, int x, int y) {
|
|||||||
Multitouch::feed(0, 0, x, y, pointerId);
|
Multitouch::feed(0, 0, x, y, pointerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline static const float padXtoSigned(int x) {
|
inline static const float padXtoSigned(int x) {
|
||||||
return (x - 483.0f) * 0.002070393374741201f;
|
return (x - 483.0f) * 0.002070393374741201f;
|
||||||
}
|
}
|
||||||
__inline static const float padYtoSigned(int y) {
|
inline static const float padYtoSigned(int y) {
|
||||||
return (y - 180.0f) * 0.005555555555555556f;
|
return (y - 180.0f) * 0.005555555555555556f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "NinecraftApp.h"
|
#include <IPlatform.h>
|
||||||
#include "AppPlatform.h"
|
#include <memory>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "MinecraftServer.h"
|
||||||
|
#include "platform/server/PlatformServer.h"
|
||||||
#include "world/level/LevelSettings.h"
|
#include "world/level/LevelSettings.h"
|
||||||
#include "world/level/Level.h"
|
#include "world/level/Level.h"
|
||||||
#include "server/ArgumentsSettings.h"
|
#include "server/ArgumentsSettings.h"
|
||||||
#include "platform/time.h"
|
#include "platform/time.h"
|
||||||
#include "SharedConstants.h"
|
#include "SharedConstants.h"
|
||||||
|
|
||||||
#define MAIN_CLASS NinecraftApp
|
|
||||||
static App* g_app = 0;
|
static App* g_app = 0;
|
||||||
static int g_exitCode = 0;
|
static int g_exitCode = 0;
|
||||||
|
|
||||||
void signal_callback_handler(int signum) {
|
void signal_callback_handler(int signum) {
|
||||||
std::cout << "Signum caught: " << signum << std::endl;
|
std::cout << "Signum caught: " << signum << std::endl;
|
||||||
if(signum == 2 || signum == 3){ // SIGINT || SIGQUIT
|
if(signum == 2 || signum == 3){ // SIGINT || SIGQUIT
|
||||||
@@ -29,6 +31,7 @@ void signal_callback_handler(int signum) {
|
|||||||
|
|
||||||
int main(int numArguments, char* pszArgs[]) {
|
int main(int numArguments, char* pszArgs[]) {
|
||||||
ArgumentsSettings aSettings(numArguments, pszArgs);
|
ArgumentsSettings aSettings(numArguments, pszArgs);
|
||||||
|
|
||||||
if(aSettings.getShowHelp()) {
|
if(aSettings.getShowHelp()) {
|
||||||
ArgumentsSettings defaultSettings(0, NULL);
|
ArgumentsSettings defaultSettings(0, NULL);
|
||||||
printf("Minecraft Pockect Edition Server %s\n", Common::getGameVersionString("").c_str());
|
printf("Minecraft Pockect Edition Server %s\n", Common::getGameVersionString("").c_str());
|
||||||
@@ -43,34 +46,34 @@ int main(int numArguments, char* pszArgs[]) {
|
|||||||
printf("-------------------------------------------------------\n");
|
printf("-------------------------------------------------------\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
printf("Level Name: %s\n", aSettings.getLevelName().c_str());
|
|
||||||
AppContext appContext;
|
|
||||||
appContext.platform = new AppPlatform();
|
|
||||||
App* app = new MAIN_CLASS();
|
|
||||||
signal(SIGINT, signal_callback_handler);
|
|
||||||
g_app = app;
|
|
||||||
((MAIN_CLASS*)g_app)->externalStoragePath = aSettings.getExternalPath();
|
|
||||||
((MAIN_CLASS*)g_app)->externalCacheStoragePath = aSettings.getCachePath();
|
|
||||||
|
|
||||||
g_app->init(appContext);
|
printf("Level Name: %s\n", aSettings.getLevelName().c_str());
|
||||||
|
|
||||||
|
MinecraftServer server(App::CreatePlatform());
|
||||||
|
|
||||||
|
signal(SIGINT, signal_callback_handler);
|
||||||
|
g_app = &server;
|
||||||
|
|
||||||
|
server.externalStoragePath = aSettings.getExternalPath();
|
||||||
|
server.externalCacheStoragePath = aSettings.getCachePath();
|
||||||
|
|
||||||
|
server.init();
|
||||||
LevelSettings settings(getEpochTimeS(), GameType::Creative);
|
LevelSettings settings(getEpochTimeS(), GameType::Creative);
|
||||||
float startTime = getTimeS();
|
float startTime = getTimeS();
|
||||||
((MAIN_CLASS*)g_app)->selectLevel(aSettings.getLevelDir(), aSettings.getLevelName(), settings);
|
server.selectLevel(aSettings.getLevelDir(), aSettings.getLevelName(), settings);
|
||||||
((MAIN_CLASS*)g_app)->hostMultiplayer(aSettings.getPort());
|
server.hostMultiplayer(aSettings.getPort());
|
||||||
|
|
||||||
std::cout << "Level has been generated in " << getTimeS() - startTime << std::endl;
|
std::cout << "Level has been generated in " << getTimeS() - startTime << std::endl;
|
||||||
((MAIN_CLASS*)g_app)->level->saveLevelData();
|
server.level->saveLevelData();
|
||||||
std::cout << "Level has been saved!" << std::endl;
|
std::cout << "Level has been saved!" << std::endl;
|
||||||
|
|
||||||
while(!app->wantToQuit()) {
|
while(!server.wantToQuit()) {
|
||||||
app->update();
|
server.update();
|
||||||
//pthread_yield();
|
//pthread_yield();
|
||||||
sleepMs(20);
|
sleepMs(20);
|
||||||
}
|
}
|
||||||
((MAIN_CLASS*)g_app)->level->saveLevelData();
|
|
||||||
delete app;
|
server.level->saveLevelData();
|
||||||
appContext.platform->finish();
|
|
||||||
delete appContext.platform;
|
|
||||||
|
|
||||||
std::cout << "Quit correctly" << std::endl;
|
std::cout << "Quit correctly" << std::endl;
|
||||||
return g_exitCode;
|
return g_exitCode;
|
||||||
|
|||||||
198
src/main_glfw.h
198
src/main_glfw.h
@@ -2,6 +2,7 @@
|
|||||||
#define MAIN_GLFW_H__
|
#define MAIN_GLFW_H__
|
||||||
|
|
||||||
#include "App.h"
|
#include "App.h"
|
||||||
|
#include "NinecraftApp.h"
|
||||||
#include "client/renderer/entity/PlayerRenderer.h"
|
#include "client/renderer/entity/PlayerRenderer.h"
|
||||||
#include "client/renderer/gles.h"
|
#include "client/renderer/gles.h"
|
||||||
#include "GLFW/glfw3.h"
|
#include "GLFW/glfw3.h"
|
||||||
@@ -16,203 +17,56 @@
|
|||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten/emscripten.h>
|
#include <emscripten/emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
static App* g_app = 0;
|
|
||||||
|
|
||||||
int transformKey(int glfwkey) {
|
// void loop() {
|
||||||
if (glfwkey >= GLFW_KEY_F1 && glfwkey <= GLFW_KEY_F12) {
|
// using clock = std::chrono::steady_clock;
|
||||||
return glfwkey - 178;
|
// auto frameStart = clock::now();
|
||||||
}
|
|
||||||
|
|
||||||
switch (glfwkey) {
|
// g_app->update();
|
||||||
case GLFW_KEY_ESCAPE: return Keyboard::KEY_ESCAPE;
|
|
||||||
case GLFW_KEY_TAB: return Keyboard::KEY_TAB;
|
|
||||||
case GLFW_KEY_BACKSPACE: return Keyboard::KEY_BACKSPACE;
|
|
||||||
case GLFW_KEY_LEFT_SHIFT: return Keyboard::KEY_LSHIFT;
|
|
||||||
case GLFW_KEY_ENTER: return Keyboard::KEY_RETURN;
|
|
||||||
case GLFW_KEY_LEFT_CONTROL: return Keyboard::KEY_LEFT_CTRL;
|
|
||||||
default: return glfwkey;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) {
|
// glfwSwapBuffers(((AppPlatform_glfw*)g_app->platform())->window);
|
||||||
if(action == GLFW_REPEAT) return;
|
// glfwPollEvents();
|
||||||
|
|
||||||
if (key == GLFW_KEY_F11 && action == GLFW_PRESS) {
|
// glfwSwapInterval(((MAIN_CLASS*)g_app)->options.getBooleanValue(OPTIONS_VSYNC) ? 1 : 0);
|
||||||
GLFWmonitor* monitor = glfwGetWindowMonitor(window);
|
// if(((MAIN_CLASS*)g_app)->options.getBooleanValue(OPTIONS_LIMIT_FRAMERATE)) {
|
||||||
if (monitor) {
|
// auto frameEnd = clock::now();
|
||||||
// Currently fullscreen → go windowed
|
// auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(frameEnd - frameStart);
|
||||||
glfwSetWindowMonitor(window, NULL, 80, 80, 854, 480, 0);
|
// auto target = std::chrono::microseconds(33333); // ~30 fps
|
||||||
} else {
|
// if(elapsed < target)
|
||||||
// Currently windowed → go fullscreen on primary monitor
|
// std::this_thread::sleep_for(target - elapsed);
|
||||||
GLFWmonitor* primary = glfwGetPrimaryMonitor();
|
// }
|
||||||
const GLFWvidmode* mode = glfwGetVideoMode(primary);
|
// }
|
||||||
glfwSetWindowMonitor(window, primary, 0, 0, mode->width, mode->height, mode->refreshRate);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Keyboard::feed(transformKey(key), action);
|
|
||||||
}
|
|
||||||
|
|
||||||
void character_callback(GLFWwindow* window, unsigned int codepoint) {
|
|
||||||
Keyboard::feedText(codepoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos) {
|
|
||||||
static double lastX = 0.0, lastY = 0.0;
|
|
||||||
static bool firstMouse = true;
|
|
||||||
|
|
||||||
if (firstMouse) {
|
|
||||||
lastX = xpos;
|
|
||||||
lastY = ypos;
|
|
||||||
firstMouse = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
double deltaX = xpos - lastX;
|
|
||||||
double deltaY = ypos - lastY;
|
|
||||||
|
|
||||||
lastX = xpos;
|
|
||||||
lastY = ypos;
|
|
||||||
|
|
||||||
if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED) {
|
|
||||||
Mouse::feed(0, 0, xpos, ypos, deltaX, deltaY);
|
|
||||||
} else {
|
|
||||||
Mouse::feed( MouseAction::ACTION_MOVE, 0, xpos, ypos);
|
|
||||||
}
|
|
||||||
Multitouch::feed(0, 0, xpos, ypos, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) {
|
|
||||||
if(action == GLFW_REPEAT) return;
|
|
||||||
|
|
||||||
double xpos, ypos;
|
|
||||||
glfwGetCursorPos(window, &xpos, &ypos);
|
|
||||||
|
|
||||||
if (button == GLFW_MOUSE_BUTTON_LEFT) {
|
|
||||||
Mouse::feed( MouseAction::ACTION_LEFT, action, xpos, ypos);
|
|
||||||
Multitouch::feed(1, action, xpos, ypos, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button == GLFW_MOUSE_BUTTON_RIGHT) {
|
|
||||||
Mouse::feed( MouseAction::ACTION_RIGHT, action, xpos, ypos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) {
|
|
||||||
double xpos, ypos;
|
|
||||||
glfwGetCursorPos(window, &xpos, &ypos);
|
|
||||||
|
|
||||||
Mouse::feed(3, 0, xpos, ypos, 0, yoffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void window_size_callback(GLFWwindow* window, int width, int height) {
|
|
||||||
if (g_app) g_app->setSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void error_callback(int error, const char* desc) {
|
|
||||||
printf("Error: %s\n", desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
using clock = std::chrono::steady_clock;
|
|
||||||
auto frameStart = clock::now();
|
|
||||||
|
|
||||||
g_app->update();
|
|
||||||
|
|
||||||
glfwSwapBuffers(((AppPlatform_glfw*)g_app->platform())->window);
|
|
||||||
glfwPollEvents();
|
|
||||||
|
|
||||||
glfwSwapInterval(((MAIN_CLASS*)g_app)->options.getBooleanValue(OPTIONS_VSYNC) ? 1 : 0);
|
|
||||||
if(((MAIN_CLASS*)g_app)->options.getBooleanValue(OPTIONS_LIMIT_FRAMERATE)) {
|
|
||||||
auto frameEnd = clock::now();
|
|
||||||
auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(frameEnd - frameStart);
|
|
||||||
auto target = std::chrono::microseconds(33333); // ~30 fps
|
|
||||||
if(elapsed < target)
|
|
||||||
std::this_thread::sleep_for(target - elapsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
AppContext appContext;
|
AppContext appContext;
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
appContext.platform = new AppPlatformGlfw();
|
||||||
// Platform init.
|
|
||||||
appContext.platform = new AppPlatform_glfw();
|
|
||||||
#if defined(__EMSCRIPTEN__)
|
|
||||||
EM_ASM(
|
|
||||||
FS.mkdir('/games');
|
|
||||||
FS.mkdir('/games/com.mojang');
|
|
||||||
FS.mkdir('/games/com.mojang/minecraftWorlds');
|
|
||||||
FS.mount(IDBFS, {}, '/games');
|
|
||||||
FS.syncfs(true, function (err) {});
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
AppPlatformGlfw* platform = (AppPlatformGlfw*)appContext.platform;
|
||||||
|
|
||||||
if (!glfwInit()) {
|
if (!platform->init()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
|
App* app = (App*)new NinecraftApp();
|
||||||
#ifndef __EMSCRIPTEN__
|
app->init(appContext);
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
|
app->setSize(platform->getScreenWidth(), platform->getScreenHeight());
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
|
||||||
#else
|
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AppPlatform_glfw* platform = (AppPlatform_glfw*)appContext.platform;
|
auto loop = [app]() {
|
||||||
|
app->update();
|
||||||
platform->window = glfwCreateWindow(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight(), "Minecraft PE 0.6.1", NULL, NULL);
|
};
|
||||||
|
|
||||||
if (platform->window == NULL) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
glfwSetKeyCallback(platform->window, key_callback);
|
|
||||||
glfwSetCharCallback(platform->window, character_callback);
|
|
||||||
glfwSetCursorPosCallback(platform->window, cursor_position_callback);
|
|
||||||
glfwSetMouseButtonCallback(platform->window, mouse_button_callback);
|
|
||||||
glfwSetScrollCallback(platform->window, scroll_callback);
|
|
||||||
glfwSetWindowSizeCallback(platform->window, window_size_callback);
|
|
||||||
|
|
||||||
glfwMakeContextCurrent(platform->window);
|
|
||||||
#ifndef __EMSCRIPTEN__
|
|
||||||
gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
|
||||||
glfwSwapInterval(0);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
App* app = new MAIN_CLASS();
|
|
||||||
|
|
||||||
g_app = app;
|
|
||||||
((MAIN_CLASS*)g_app)->externalStoragePath = ".";
|
|
||||||
((MAIN_CLASS*)g_app)->externalCacheStoragePath = ".";
|
|
||||||
g_app->init(appContext);
|
|
||||||
g_app->setSize(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight());
|
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
emscripten_set_main_loop(loop, 0, 1);
|
emscripten_set_main_loop(loop, 0, 1);
|
||||||
#else
|
#else
|
||||||
// Main event loop
|
// Main event loop
|
||||||
while(!glfwWindowShouldClose(platform->window) && !app->wantToQuit()) {
|
while(!app->wantToQuit()) {
|
||||||
loop();
|
loop();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete app;
|
delete app;
|
||||||
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
// Exit.
|
|
||||||
glfwDestroyWindow(platform->window);
|
|
||||||
glfwTerminate();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
appContext.platform->finish();
|
appContext.platform->finish();
|
||||||
|
|
||||||
delete appContext.platform;
|
delete appContext.platform;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline bool contains(const std::string& name) const {
|
inline bool contains(const std::string& name) const {
|
||||||
return tags.find(name) != tags.end();
|
return tags.find(name) != tags.end();
|
||||||
}
|
}
|
||||||
bool contains(const std::string& name, int type) const {
|
bool contains(const std::string& name, int type) const {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
#include "ClientSideNetworkHandler.h"
|
#include "ClientSideNetworkHandler.h"
|
||||||
|
#include <MinecraftClient.h>
|
||||||
#include "client/Options.h"
|
#include "client/Options.h"
|
||||||
|
#include "gamemode/GameMode.h"
|
||||||
#include "packet/PacketInclude.h"
|
#include "packet/PacketInclude.h"
|
||||||
#include "RakNetInstance.h"
|
#include "RakNetInstance.h"
|
||||||
#include "../world/level/chunk/ChunkSource.h"
|
#include "../world/level/chunk/ChunkSource.h"
|
||||||
@@ -8,11 +9,7 @@
|
|||||||
#include "../world/level/storage/LevelStorageSource.h"
|
#include "../world/level/storage/LevelStorageSource.h"
|
||||||
#include "../world/entity/player/Player.h"
|
#include "../world/entity/player/Player.h"
|
||||||
#include "../world/entity/player/Inventory.h"
|
#include "../world/entity/player/Inventory.h"
|
||||||
#include "../client/Minecraft.h"
|
#include <Minecraft.h>
|
||||||
#include "../client/gamemode/GameMode.h"
|
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../client/gui/screens/DisconnectionScreen.h"
|
|
||||||
#endif
|
|
||||||
#include "../client/player/LocalPlayer.h"
|
#include "../client/player/LocalPlayer.h"
|
||||||
#include "../client/multiplayer/MultiPlayerLevel.h"
|
#include "../client/multiplayer/MultiPlayerLevel.h"
|
||||||
#include "../client/player/input/KeyboardInput.h"
|
#include "../client/player/input/KeyboardInput.h"
|
||||||
@@ -22,9 +19,6 @@
|
|||||||
#include "../world/level/Explosion.h"
|
#include "../world/level/Explosion.h"
|
||||||
#include "../world/level/tile/entity/FurnaceTileEntity.h"
|
#include "../world/level/tile/entity/FurnaceTileEntity.h"
|
||||||
#include "../world/inventory/BaseContainerMenu.h"
|
#include "../world/inventory/BaseContainerMenu.h"
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../client/particle/TakeAnimationParticle.h"
|
|
||||||
#endif
|
|
||||||
#include "../world/entity/EntityFactory.h"
|
#include "../world/entity/EntityFactory.h"
|
||||||
#include "../world/entity/item/PrimedTnt.h"
|
#include "../world/entity/item/PrimedTnt.h"
|
||||||
#include "../world/entity/projectile/Arrow.h"
|
#include "../world/entity/projectile/Arrow.h"
|
||||||
@@ -35,12 +29,9 @@
|
|||||||
|
|
||||||
static MultiPlayerLevel* mpcast(Level* l) { return (MultiPlayerLevel*) l; }
|
static MultiPlayerLevel* mpcast(Level* l) { return (MultiPlayerLevel*) l; }
|
||||||
|
|
||||||
ClientSideNetworkHandler::ClientSideNetworkHandler(Minecraft* minecraft, IRakNetInstance* raknetInstance)
|
ClientSideNetworkHandler::ClientSideNetworkHandler(MinecraftClient& minecraft, IRakNetInstance* raknetInstance)
|
||||||
: minecraft(minecraft),
|
: minecraft(minecraft),
|
||||||
raknetInstance(raknetInstance),
|
raknetInstance(raknetInstance)
|
||||||
level(NULL),
|
|
||||||
requestNextChunkPosition(0),
|
|
||||||
requestNextChunkIndex(0)
|
|
||||||
{
|
{
|
||||||
rakPeer = raknetInstance->getPeer();
|
rakPeer = raknetInstance->getPeer();
|
||||||
}
|
}
|
||||||
@@ -86,7 +77,7 @@ void ClientSideNetworkHandler::onConnect(const RakNet::RakNetGUID& hostGuid)
|
|||||||
serverGuid = hostGuid;
|
serverGuid = hostGuid;
|
||||||
|
|
||||||
clearChunksLoaded();
|
clearChunksLoaded();
|
||||||
LoginPacket packet(minecraft->options.getStringValue(OPTIONS_USERNAME).c_str(), SharedConstants::NetworkProtocolVersion);
|
LoginPacket packet(minecraft.options().getStringValue(OPTIONS_USERNAME).c_str(), SharedConstants::NetworkProtocolVersion);
|
||||||
raknetInstance->send(packet);
|
raknetInstance->send(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,14 +94,14 @@ void ClientSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid)
|
|||||||
level->isClientSide = false;
|
level->isClientSide = false;
|
||||||
for (int i = (int)level->players.size()-1; i >= 0; --i ) {
|
for (int i = (int)level->players.size()-1; i >= 0; --i ) {
|
||||||
Player* p = level->players[i];
|
Player* p = level->players[i];
|
||||||
if (p != minecraft->player) {
|
if (p != minecraft.getPlayer()) {
|
||||||
p->reallyRemoveIfPlayer = true;
|
p->reallyRemoveIfPlayer = true;
|
||||||
level->removeEntity(p);
|
level->removeEntity(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
minecraft->gui.addMessage("Disconnected from server");
|
minecraft.gui.addMessage("Disconnected from server");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,13 +114,13 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LoginSta
|
|||||||
if (packet->status == LoginStatus::Failed_ClientOld) {
|
if (packet->status == LoginStatus::Failed_ClientOld) {
|
||||||
LOGI("Disconnect! Client is outdated!\n");
|
LOGI("Disconnect! Client is outdated!\n");
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
minecraft->setScreen(new DisconnectionScreen("Could not connect: Outdated client!"));
|
minecraft.setScreen(new DisconnectionScreen("Could not connect: Outdated client!"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (packet->status == LoginStatus::Failed_ServerOld) {
|
if (packet->status == LoginStatus::Failed_ServerOld) {
|
||||||
LOGI("Disconnect! Server is outdated!\n");
|
LOGI("Disconnect! Server is outdated!\n");
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
minecraft->setScreen(new DisconnectionScreen("Could not connect: Outdated server!"));
|
minecraft.setScreen(new DisconnectionScreen("Could not connect: Outdated server!"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,13 +132,13 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, StartGam
|
|||||||
|
|
||||||
#ifdef RPI
|
#ifdef RPI
|
||||||
if (packet->gameType != GameType::Creative) {
|
if (packet->gameType != GameType::Creative) {
|
||||||
minecraft->setScreen(new DisconnectionScreen("Could not connect: Incompatible server!"));
|
minecraft.setScreen(new DisconnectionScreen("Could not connect: Incompatible server!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string& levelId = LevelStorageSource::TempLevelId;
|
const std::string& levelId = LevelStorageSource::TempLevelId;
|
||||||
LevelStorageSource* storageSource = minecraft->getLevelSource();
|
LevelStorageSource* storageSource = minecraft.getLevelSource();
|
||||||
storageSource->deleteLevel(levelId);
|
storageSource->deleteLevel(levelId);
|
||||||
//level = new Level(storageSource->selectLevel(levelId, true), "temp", packet->levelSeed, SharedConstants::StorageVersion);
|
//level = new Level(storageSource->selectLevel(levelId, true), "temp", packet->levelSeed, SharedConstants::StorageVersion);
|
||||||
MultiPlayerLevel* level = new MultiPlayerLevel(
|
MultiPlayerLevel* level = new MultiPlayerLevel(
|
||||||
@@ -158,22 +149,22 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, StartGam
|
|||||||
level->isClientSide = true;
|
level->isClientSide = true;
|
||||||
|
|
||||||
bool isCreative = (packet->gameType == GameType::Creative);
|
bool isCreative = (packet->gameType == GameType::Creative);
|
||||||
LocalPlayer* player = new LocalPlayer(minecraft, level, minecraft->options.getStringValue(OPTIONS_USERNAME), level->dimension->id, isCreative);
|
LocalPlayer* player = new LocalPlayer(minecraft, level, minecraft.options().getStringValue(OPTIONS_USERNAME), level->dimension->id, isCreative);
|
||||||
player->owner = rakPeer->GetMyGUID();
|
player->owner = rakPeer->GetMyGUID();
|
||||||
player->entityId = packet->entityId;
|
player->entityId = packet->entityId;
|
||||||
player->moveTo(packet->x, packet->y, packet->z, player->yRot, player->xRot);
|
player->moveTo(packet->x, packet->y, packet->z, player->yRot, player->xRot);
|
||||||
|
|
||||||
LOGI("new pos: %f, %f [%f - %f]\n", player->x, player->z, player->bb.y0, player->bb.y1);
|
LOGI("new pos: %f, %f [%f - %f]\n", player->x, player->z, player->bb.y0, player->bb.y1);
|
||||||
|
|
||||||
minecraft->setLevel(level, "ClientSideNetworkHandler -> setLevel", player);
|
minecraft.setLevel(level, "ClientSideNetworkHandler -> setLevel", player);
|
||||||
minecraft->setIsCreativeMode(isCreative);
|
minecraft.setIsCreativeMode(isCreative);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MessagePacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MessagePacket* packet)
|
||||||
{
|
{
|
||||||
LOGI("MessagePacket\n");
|
LOGI("MessagePacket\n");
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
minecraft->gui.addMessage(packet->message.C_String());
|
minecraft.gui.addMessage(packet->message.C_String());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,8 +261,8 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AddPlaye
|
|||||||
}
|
}
|
||||||
LOGI("AddPlayerPacket\n");
|
LOGI("AddPlayerPacket\n");
|
||||||
|
|
||||||
Player* player = new RemotePlayer(level, minecraft->isCreativeMode());
|
Player* player = new RemotePlayer(level, minecraft.isCreativeMode());
|
||||||
minecraft->gameMode->initAbilities(player->abilities);
|
minecraft.gameMode->initAbilities(player->abilities);
|
||||||
player->entityId = packet->entityId;
|
player->entityId = packet->entityId;
|
||||||
level->addEntity(player);
|
level->addEntity(player);
|
||||||
|
|
||||||
@@ -292,12 +283,12 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AddPlaye
|
|||||||
std::string message = packet->name.C_String();
|
std::string message = packet->name.C_String();
|
||||||
message += " joined the game";
|
message += " joined the game";
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
minecraft->gui.addMessage(message);
|
minecraft.gui.addMessage(message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemovePlayerPacket* packet) {
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemovePlayerPacket* packet) {
|
||||||
if (!level || source == minecraft->player->owner) return;
|
if (!level || source == minecraft.getPlayer()->owner) return;
|
||||||
|
|
||||||
if (Player* player = findPlayer(level, packet->entityId, &packet->owner)) {
|
if (Player* player = findPlayer(level, packet->entityId, &packet->owner)) {
|
||||||
player->reallyRemoveIfPlayer = true;
|
player->reallyRemoveIfPlayer = true;
|
||||||
@@ -316,7 +307,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemovePl
|
|||||||
|
|
||||||
//std::string message = packet->name.C_String();
|
//std::string message = packet->name.C_String();
|
||||||
//message += " joined the game";
|
//message += " joined the game";
|
||||||
//minecraft->gui.addMessage(message);
|
//minecraft.gui.addMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveEntityPacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveEntityPacket* packet)
|
||||||
@@ -324,7 +315,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RemoveEn
|
|||||||
if (!level) return;
|
if (!level) return;
|
||||||
|
|
||||||
Entity* entity = level->getEntity(packet->entityId);
|
Entity* entity = level->getEntity(packet->entityId);
|
||||||
LOGI("RemoveEntityPacket %p %p, %d\n", entity, minecraft->player, entity?(int)(entity->isPlayer()): -1);
|
LOGI("RemoveEntityPacket %p %p, %d\n", entity, minecraft.getPlayer(), entity?(int)(entity->isPlayer()): -1);
|
||||||
if (!entity) return;
|
if (!entity) return;
|
||||||
|
|
||||||
level->removeEntity(entity);
|
level->removeEntity(entity);
|
||||||
@@ -355,7 +346,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TakeItem
|
|||||||
item = ((ItemEntity*) e)->item;
|
item = ((ItemEntity*) e)->item;
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
if (Entity* to = level->getEntity(packet->playerId))
|
if (Entity* to = level->getEntity(packet->playerId))
|
||||||
minecraft->particleEngine->add(new TakeAnimationParticle(level, (ItemEntity*)e, to, -0.5f));
|
minecraft.particleEngine->add(new TakeAnimationParticle(level, (ItemEntity*)e, to, -0.5f));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (e->getEntityTypeId() == EntityTypes::IdArrow)
|
else if (e->getEntityTypeId() == EntityTypes::IdArrow)
|
||||||
@@ -365,10 +356,10 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TakeItem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// try take it and if we don't have space; re-throw it
|
// try take it and if we don't have space; re-throw it
|
||||||
if (minecraft->player->entityId == packet->playerId
|
if (minecraft.getPlayer()->entityId == packet->playerId
|
||||||
&& !minecraft->player->inventory->add(&item)) {
|
&& !minecraft.getPlayer()->inventory->add(&item)) {
|
||||||
DropItemPacket dropPacket(packet->playerId, item);
|
DropItemPacket dropPacket(packet->playerId, item);
|
||||||
minecraft->raknetInstance->send(dropPacket);
|
minecraft.raknetInstance->send(dropPacket);
|
||||||
}
|
}
|
||||||
level->playSound(e, "random.pop", 0.2f, 1.0f * 2.f);
|
level->playSound(e, "random.pop", 0.2f, 1.0f * 2.f);
|
||||||
}
|
}
|
||||||
@@ -438,16 +429,16 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ExplodeP
|
|||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LevelEventPacket* packet) {
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, LevelEventPacket* packet) {
|
||||||
if (!level) return;
|
if (!level) return;
|
||||||
if(packet->eventId == LevelEvent::ALL_PLAYERS_SLEEPING) {
|
if(packet->eventId == LevelEvent::ALL_PLAYERS_SLEEPING) {
|
||||||
minecraft->player->setAllPlayersSleeping();
|
minecraft.getPlayer()->setAllPlayersSleeping();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
minecraft->level->levelEvent(NULL, packet->eventId, packet->x, packet->y, packet->z, packet->data);
|
minecraft.level->levelEvent(NULL, packet->eventId, packet->x, packet->y, packet->z, packet->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TileEventPacket* packet) {
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, TileEventPacket* packet) {
|
||||||
if (!level) return;
|
if (!level) return;
|
||||||
minecraft->level->tileEvent(packet->x, packet->y, packet->z, packet->b0, packet->b1);
|
minecraft.level->tileEvent(packet->x, packet->y, packet->z, packet->b0, packet->b1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, EntityEventPacket* packet) {
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, EntityEventPacket* packet) {
|
||||||
@@ -631,7 +622,7 @@ void ClientSideNetworkHandler::arrangeRequestChunkOrder() {
|
|||||||
int cz = CHUNK_CACHE_WIDTH / 2;
|
int cz = CHUNK_CACHE_WIDTH / 2;
|
||||||
|
|
||||||
// If player exists, let's sort around him
|
// If player exists, let's sort around him
|
||||||
Player* p = minecraft? minecraft->player : NULL;
|
Player* p = minecraft.getPlayer();
|
||||||
if (p) {
|
if (p) {
|
||||||
cx = Mth::floor(p->x / (float)CHUNK_WIDTH);
|
cx = Mth::floor(p->x / (float)CHUNK_WIDTH);
|
||||||
cz = Mth::floor(p->z / (float)CHUNK_DEPTH);
|
cz = Mth::floor(p->z / (float)CHUNK_DEPTH);
|
||||||
@@ -717,9 +708,9 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Interact
|
|||||||
{
|
{
|
||||||
Player* player = (Player*) src;
|
Player* player = (Player*) src;
|
||||||
if (InteractPacket::Attack == packet->action)
|
if (InteractPacket::Attack == packet->action)
|
||||||
minecraft->gameMode->attack(player, entity);
|
minecraft.gameMode->attack(player, entity);
|
||||||
if (InteractPacket::Interact == packet->action)
|
if (InteractPacket::Interact == packet->action)
|
||||||
minecraft->gameMode->interact(player, entity);
|
minecraft.gameMode->interact(player, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,7 +750,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AnimateP
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Own player - Then don't play... :
|
// Own player - Then don't play... :
|
||||||
if (minecraft->player->entityId == packet->entityId) {
|
if (minecraft.getPlayer()->entityId == packet->entityId) {
|
||||||
if (packet->action == AnimatePacket::Swing) return;
|
if (packet->action == AnimatePacket::Swing) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,26 +779,26 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemP
|
|||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetHealthPacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetHealthPacket* packet)
|
||||||
{
|
{
|
||||||
if (!level || !minecraft->player)
|
if (!level || !minecraft.getPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
minecraft->player->hurtTo(packet->health);
|
minecraft.getPlayer()->hurtTo(packet->health);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetSpawnPositionPacket* packet) {
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, SetSpawnPositionPacket* packet) {
|
||||||
if (!level || !minecraft || !minecraft->player) return;
|
if (!level || !minecraft.getPlayer()) return;
|
||||||
if (!level->inRange(packet->x, packet->y, packet->z)) return;
|
if (!level->inRange(packet->x, packet->y, packet->z)) return;
|
||||||
|
|
||||||
minecraft->player->setRespawnPosition(Pos(packet->x, packet->y, packet->z));
|
minecraft.getPlayer()->setRespawnPosition(Pos(packet->x, packet->y, packet->z));
|
||||||
level->getLevelData()->setSpawn(packet->x, packet->y, packet->z);
|
level->getLevelData()->setSpawn(packet->x, packet->y, packet->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, HurtArmorPacket* packet) {
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, HurtArmorPacket* packet) {
|
||||||
if (!level || !minecraft->player) {
|
if (!level || !minecraft.getPlayer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft->player->hurtArmor(packet->dmg);
|
minecraft.getPlayer()->hurtArmor(packet->dmg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RespawnPacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RespawnPacket* packet)
|
||||||
@@ -820,43 +811,43 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RespawnP
|
|||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerOpenPacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerOpenPacket* packet)
|
||||||
{
|
{
|
||||||
if (!level || !minecraft || !minecraft->player)
|
if (!level)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (packet->type == ContainerType::FURNACE) {
|
if (packet->type == ContainerType::FURNACE) {
|
||||||
FurnaceTileEntity* te = new FurnaceTileEntity();
|
FurnaceTileEntity* te = new FurnaceTileEntity();
|
||||||
te->clientSideOnly = true;
|
te->clientSideOnly = true;
|
||||||
minecraft->player->openFurnace(te);
|
minecraft.getPlayer()->openFurnace(te);
|
||||||
if (minecraft->player->containerMenu)
|
if (minecraft.getPlayer()->containerMenu)
|
||||||
minecraft->player->containerMenu->containerId = packet->containerId;
|
minecraft.getPlayer()->containerMenu->containerId = packet->containerId;
|
||||||
}
|
}
|
||||||
if (packet->type == ContainerType::CONTAINER) {
|
if (packet->type == ContainerType::CONTAINER) {
|
||||||
ChestTileEntity* te = new ChestTileEntity();
|
ChestTileEntity* te = new ChestTileEntity();
|
||||||
te->clientSideOnly = true;
|
te->clientSideOnly = true;
|
||||||
minecraft->player->openContainer(te);
|
minecraft.getPlayer()->openContainer(te);
|
||||||
if (minecraft->player->containerMenu)
|
if (minecraft.getPlayer()->containerMenu)
|
||||||
minecraft->player->containerMenu->containerId = packet->containerId;
|
minecraft.getPlayer()->containerMenu->containerId = packet->containerId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet)
|
||||||
{
|
{
|
||||||
if (minecraft && minecraft->player && minecraft->player->containerMenu)
|
if (minecraft.getPlayer() && minecraft.getPlayer()->containerMenu)
|
||||||
minecraft->player->closeContainer();
|
minecraft.getPlayer()->closeContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetContentPacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetContentPacket* packet)
|
||||||
{
|
{
|
||||||
if (!minecraft || !minecraft->player)
|
if (!minecraft.getPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (packet->containerId == 0) {
|
if (packet->containerId == 0) {
|
||||||
for (unsigned int i = 0; i < packet->items.size(); ++i) {
|
for (unsigned int i = 0; i < packet->items.size(); ++i) {
|
||||||
minecraft->player->inventory->setItem(Inventory::MAX_SELECTION_SIZE + i, &packet->items[i]);
|
minecraft.getPlayer()->inventory->setItem(Inventory::MAX_SELECTION_SIZE + i, &packet->items[i]);
|
||||||
}
|
}
|
||||||
} else if (minecraft->player->containerMenu && minecraft->player->containerMenu->containerId == packet->containerId) {
|
} else if (minecraft.getPlayer()->containerMenu && minecraft.getPlayer()->containerMenu->containerId == packet->containerId) {
|
||||||
for (unsigned int i = 0; i < packet->items.size(); ++i) {
|
for (unsigned int i = 0; i < packet->items.size(); ++i) {
|
||||||
minecraft->player->containerMenu->setSlot(i, &packet->items[i]);
|
minecraft.getPlayer()->containerMenu->setSlot(i, &packet->items[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -865,28 +856,28 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Containe
|
|||||||
{
|
{
|
||||||
//LOGI("ContainerSetSlot\n");
|
//LOGI("ContainerSetSlot\n");
|
||||||
|
|
||||||
if (!minecraft->player
|
if (!minecraft.getPlayer()
|
||||||
|| !minecraft->player->containerMenu
|
|| !minecraft.getPlayer()->containerMenu
|
||||||
|| minecraft->player->containerMenu->containerId != packet->containerId)
|
|| minecraft.getPlayer()->containerMenu->containerId != packet->containerId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//minecraft->player->containerMenu->setSlot(packet->slot, packet->item.isNull()? NULL : &packet->item);
|
//minecraft.getPlayer()->containerMenu->setSlot(packet->slot, packet->item.isNull()? NULL : &packet->item);
|
||||||
minecraft->player->containerMenu->setSlot(packet->slot, &packet->item);
|
minecraft.getPlayer()->containerMenu->setSlot(packet->slot, &packet->item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetDataPacket* packet)
|
void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetDataPacket* packet)
|
||||||
{
|
{
|
||||||
//LOGI("ContainerSetData\n");
|
//LOGI("ContainerSetData\n");
|
||||||
if (minecraft->player && minecraft->player->containerMenu && minecraft->player->containerMenu->containerId == packet->containerId) {
|
if (minecraft.getPlayer() && minecraft.getPlayer()->containerMenu && minecraft.getPlayer()->containerMenu->containerId == packet->containerId) {
|
||||||
//LOGI("client: SetData2 %d, %d\n", packet->id, packet->value);
|
//LOGI("client: SetData2 %d, %d\n", packet->id, packet->value);
|
||||||
minecraft->player->containerMenu->setData(packet->id, packet->value);
|
minecraft.getPlayer()->containerMenu->setData(packet->id, packet->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSideNetworkHandler::handle( const RakNet::RakNetGUID& source, ChatPacket* packet )
|
void ClientSideNetworkHandler::handle( const RakNet::RakNetGUID& source, ChatPacket* packet )
|
||||||
{
|
{
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
minecraft->gui.displayClientMessage(packet->message);
|
minecraft.gui.displayClientMessage(packet->message);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Minecraft;
|
class MinecraftClient;
|
||||||
class Level;
|
class Level;
|
||||||
class IRakNetInstance;
|
class IRakNetInstance;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ typedef struct IntPair {
|
|||||||
class ClientSideNetworkHandler : public NetEventCallback
|
class ClientSideNetworkHandler : public NetEventCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClientSideNetworkHandler(Minecraft* minecraft, IRakNetInstance* raknetInstance);
|
ClientSideNetworkHandler(MinecraftClient& minecraft, IRakNetInstance* raknetInstance);
|
||||||
virtual ~ClientSideNetworkHandler();
|
virtual ~ClientSideNetworkHandler();
|
||||||
|
|
||||||
virtual void levelGenerated(Level* level);
|
virtual void levelGenerated(Level* level);
|
||||||
@@ -87,19 +87,19 @@ private:
|
|||||||
void clearChunksLoaded();
|
void clearChunksLoaded();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Minecraft* minecraft;
|
MinecraftClient& minecraft;
|
||||||
Level* level;
|
Level* level = nullptr;
|
||||||
IRakNetInstance* raknetInstance;
|
IRakNetInstance* raknetInstance;
|
||||||
RakNet::RakPeerInterface* rakPeer;
|
RakNet::RakPeerInterface* rakPeer;
|
||||||
|
|
||||||
RakNet::RakNetGUID serverGuid;
|
RakNet::RakNetGUID serverGuid;
|
||||||
|
|
||||||
BlockUpdateList bufferedBlockUpdates;
|
BlockUpdateList bufferedBlockUpdates;
|
||||||
int requestNextChunkPosition;
|
int requestNextChunkPosition = 0;
|
||||||
|
|
||||||
static const int NumRequestChunks = CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH;
|
static const int NumRequestChunks = CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH;
|
||||||
|
|
||||||
int requestNextChunkIndex;
|
int requestNextChunkIndex = 0;
|
||||||
IntPair requestNextChunkIndexList[NumRequestChunks];
|
IntPair requestNextChunkIndexList[NumRequestChunks];
|
||||||
bool chunksLoaded[NumRequestChunks];
|
bool chunksLoaded[NumRequestChunks];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,11 +5,10 @@
|
|||||||
#include "../raknet/BitStream.h"
|
#include "../raknet/BitStream.h"
|
||||||
#include "../raknet/MessageIdentifiers.h"
|
#include "../raknet/MessageIdentifiers.h"
|
||||||
#include "../raknet/GetTime.h"
|
#include "../raknet/GetTime.h"
|
||||||
#include "../AppConstants.h"
|
|
||||||
|
|
||||||
#include "../platform/log.h"
|
#include "../platform/log.h"
|
||||||
|
|
||||||
#define APP_IDENTIFIER "MCCPP;" APP_VERSION_STRING ";"
|
#define APP_IDENTIFIER "MCCPP;Demo;"
|
||||||
#define APP_IDENTIFIER_MINECON "MCCPP;MINECON;"
|
#define APP_IDENTIFIER_MINECON "MCCPP;MINECON;"
|
||||||
|
|
||||||
RakNetInstance::RakNetInstance()
|
RakNetInstance::RakNetInstance()
|
||||||
|
|||||||
@@ -5,19 +5,53 @@
|
|||||||
#include "../world/entity/player/Inventory.h"
|
#include "../world/entity/player/Inventory.h"
|
||||||
#include "../world/Container.h"
|
#include "../world/Container.h"
|
||||||
#include "../world/inventory/BaseContainerMenu.h"
|
#include "../world/inventory/BaseContainerMenu.h"
|
||||||
#include "packet/PacketInclude.h"
|
#include "MinecraftClient.h"
|
||||||
|
#include "gamemode/GameMode.h"
|
||||||
|
|
||||||
#include "RakNetInstance.h"
|
#include "RakNetInstance.h"
|
||||||
#include "../client/Minecraft.h"
|
#include <MinecraftClient.h>
|
||||||
#include "../client/player/LocalPlayer.h"
|
#include "../client/player/LocalPlayer.h"
|
||||||
#include "../client/gamemode/GameMode.h"
|
|
||||||
#include "../raknet/RakPeerInterface.h"
|
#include "../raknet/RakPeerInterface.h"
|
||||||
#include "../raknet/PacketPriority.h"
|
#include "../raknet/PacketPriority.h"
|
||||||
#ifndef STANDALONE_SERVER
|
|
||||||
#include "../client/sound/SoundEngine.h"
|
|
||||||
#endif
|
|
||||||
#include "../server/ServerPlayer.h"
|
#include "../server/ServerPlayer.h"
|
||||||
#include "../world/entity/item/FallingTile.h"
|
#include "../world/entity/item/FallingTile.h"
|
||||||
|
#include "network/packet/AddEntityPacket.h"
|
||||||
|
#include "network/packet/AddItemEntityPacket.h"
|
||||||
|
#include "network/packet/AddMobPacket.h"
|
||||||
|
#include "network/packet/AddPaintingPacket.h"
|
||||||
|
#include "network/packet/AddPlayerPacket.h"
|
||||||
|
#include "network/packet/AdventureSettingsPacket.h"
|
||||||
|
#include "network/packet/AnimatePacket.h"
|
||||||
|
#include "network/packet/ChatPacket.h"
|
||||||
|
#include "network/packet/ChunkDataPacket.h"
|
||||||
|
#include "network/packet/ContainerSetSlotPacket.h"
|
||||||
|
#include "network/packet/DropItemPacket.h"
|
||||||
|
#include "network/packet/EntityEventPacket.h"
|
||||||
|
#include "network/packet/InteractPacket.h"
|
||||||
|
#include "network/packet/LevelEventPacket.h"
|
||||||
|
#include "network/packet/LoginPacket.h"
|
||||||
|
#include "network/packet/LoginStatusPacket.h"
|
||||||
|
#include "network/packet/MessagePacket.h"
|
||||||
|
#include "network/packet/MovePlayerPacket.h"
|
||||||
|
#include "network/packet/PlayerActionPacket.h"
|
||||||
|
#include "network/packet/PlayerArmorEquipmentPacket.h"
|
||||||
|
#include "network/packet/PlayerEquipmentPacket.h"
|
||||||
|
#include "network/packet/ReadyPacket.h"
|
||||||
|
#include "network/packet/RemoveBlockPacket.h"
|
||||||
|
#include "network/packet/RemoveEntityPacket.h"
|
||||||
|
#include "network/packet/RemovePlayerPacket.h"
|
||||||
|
#include "network/packet/RequestChunkPacket.h"
|
||||||
|
#include "network/packet/RespawnPacket.h"
|
||||||
|
#include "network/packet/SendInventoryPacket.h"
|
||||||
|
#include "network/packet/SetHealthPacket.h"
|
||||||
|
#include "network/packet/SetTimePacket.h"
|
||||||
|
#include "network/packet/SignUpdatePacket.h"
|
||||||
|
#include "network/packet/StartGamePacket.h"
|
||||||
|
#include "network/packet/TileEventPacket.h"
|
||||||
|
#include "network/packet/UpdateBlockPacket.h"
|
||||||
|
#include "network/packet/UseItemPacket.h"
|
||||||
|
#include "world/entity/Painting.h"
|
||||||
|
#include "world/level/tile/entity/TileEntity.h"
|
||||||
|
|
||||||
#define TIMES(x) for(int itc ## __LINE__ = 0; itc ## __LINE__ < x; ++ itc ## __LINE__)
|
#define TIMES(x) for(int itc ## __LINE__ = 0; itc ## __LINE__ < x; ++ itc ## __LINE__)
|
||||||
|
|
||||||
@@ -52,16 +86,19 @@ void ServerSideNetworkHandler::tileChanged(int x, int y, int z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Packet* ServerSideNetworkHandler::getAddPacketFromEntity( Entity* entity ) {
|
Packet* ServerSideNetworkHandler::getAddPacketFromEntity( Entity* entity ) {
|
||||||
if (entity->isMob() && !entity->isPlayer()) { //@fix: This code is duplicated. See if it can be unified.
|
// if (entity->isMob() && !entity->isPlayer()) { //@fix: This code is duplicated. See if it can be unified.
|
||||||
if (minecraft->player) {
|
// auto client = dynamic_cast<MinecraftClient*>(minecraft);
|
||||||
// I guess this should always be true, but it crashed somewhere in this
|
|
||||||
// function once and I only see this one as a potential problem
|
|
||||||
return new AddMobPacket((Mob*)entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (entity->isPlayer()) {
|
|
||||||
|
|
||||||
} else if (entity->isItemEntity()) {
|
// if (client && client->getPlayer()) {
|
||||||
|
// // I guess this should always be true, but it crashed somewhere in this
|
||||||
|
// // function once and I only see this one as a potential problem
|
||||||
|
// return new AddMobPacket((Mob*)entity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (entity->isPlayer()) {
|
||||||
|
|
||||||
|
// } else
|
||||||
|
if (entity->isItemEntity()) {
|
||||||
AddItemEntityPacket* packet = new AddItemEntityPacket((ItemEntity*)entity);
|
AddItemEntityPacket* packet = new AddItemEntityPacket((ItemEntity*)entity);
|
||||||
entity->xd = packet->xa();
|
entity->xd = packet->xa();
|
||||||
entity->yd = packet->ya();
|
entity->yd = packet->ya();
|
||||||
@@ -408,10 +445,12 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, RequestC
|
|||||||
void ServerSideNetworkHandler::levelGenerated( Level* level )
|
void ServerSideNetworkHandler::levelGenerated( Level* level )
|
||||||
{
|
{
|
||||||
this->level = level;
|
this->level = level;
|
||||||
|
|
||||||
|
// auto client = dynamic_cast<MinecraftClient*>(minecraft);
|
||||||
|
|
||||||
if (minecraft->player) {
|
// if (client && client->getPlayer()) {
|
||||||
minecraft->player->owner = rakPeer->GetMyGUID();
|
// client->getPlayer()->owner = rakPeer->GetMyGUID();
|
||||||
}
|
// }
|
||||||
|
|
||||||
level->addListener(this);
|
level->addListener(this);
|
||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
@@ -484,11 +523,13 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AnimateP
|
|||||||
{
|
{
|
||||||
if (!level)
|
if (!level)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// auto client = dynamic_cast<MinecraftClient*>(minecraft);
|
||||||
|
|
||||||
// Own player -> invalid
|
// // Own player -> invalid
|
||||||
if (minecraft->player && minecraft->player->entityId == packet->entityId) {
|
// if (client && client->getPlayer() && client->getPlayer()->entityId == packet->entityId) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
Entity* entity = level->getEntity(packet->entityId);
|
Entity* entity = level->getEntity(packet->entityId);
|
||||||
if (!entity || !entity->isPlayer())
|
if (!entity || !entity->isPlayer())
|
||||||
@@ -510,7 +551,7 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, AnimateP
|
|||||||
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemPacket* packet)
|
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, UseItemPacket* packet)
|
||||||
{
|
{
|
||||||
if (!level) return;
|
if (!level) return;
|
||||||
|
|
||||||
LOGI("UseItemPacket\n");
|
LOGI("UseItemPacket\n");
|
||||||
Entity* entity = level->getEntity(packet->entityId);
|
Entity* entity = level->getEntity(packet->entityId);
|
||||||
if (entity && entity->isPlayer()) {
|
if (entity && entity->isPlayer()) {
|
||||||
@@ -605,8 +646,11 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, Containe
|
|||||||
Player* p = findPlayer(level, &source);
|
Player* p = findPlayer(level, &source);
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
|
|
||||||
if (p != minecraft->player)
|
// // if (p != minecraft->player)
|
||||||
static_cast<ServerPlayer*>(p)->doCloseContainer();
|
// static_cast<ServerPlayer*>(p)->doCloseContainer();
|
||||||
|
|
||||||
|
if (auto sp = dynamic_cast<ServerPlayer*>(p))
|
||||||
|
sp->doCloseContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetSlotPacket* packet) {
|
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ContainerSetSlotPacket* packet) {
|
||||||
@@ -672,7 +716,7 @@ void ServerSideNetworkHandler::handle( const RakNet::RakNetGUID& source, SignUpd
|
|||||||
void ServerSideNetworkHandler::allowIncomingConnections( bool doAllow )
|
void ServerSideNetworkHandler::allowIncomingConnections( bool doAllow )
|
||||||
{
|
{
|
||||||
if (doAllow) {
|
if (doAllow) {
|
||||||
raknetInstance->announceServer(minecraft->options.getStringValue(OPTIONS_USERNAME));
|
raknetInstance->announceServer(minecraft->getServerName());
|
||||||
} else {
|
} else {
|
||||||
raknetInstance->announceServer("");
|
raknetInstance->announceServer("");
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user