Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PHP + Minecraft
Search
Thomas Berends
December 03, 2020
1
450
PHP + Minecraft
PHP + Minecraft as given at SymfonyWorld 2020 on Dec 3, 2020
Thomas Berends
December 03, 2020
Tweet
Share
Featured
See All Featured
A designer walks into a library…
pauljervisheath
205
24k
A better future with KSS
kneath
239
17k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Practical Orchestrator
shlominoach
187
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
How to Ace a Technical Interview
jacobian
276
23k
Done Done
chrislema
184
16k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.6k
Bash Introduction
62gerente
614
210k
Building Adaptive Systems
keathley
41
2.6k
Transcript
PHP + Minecraft Doing unconventional stuff by combining PHP and
Minecraft
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
What is Minecraft?
Two versions Bedrock • Windows • iOS • Android •
Playstation • Xbox • Nintendo Switch Java • Windows • MacOS • Linux
PHP + Minecraft: Why? I like combining hobbies
PHP + Minecraft: Why? I like combining hobbies Programming
PHP + Minecraft: Why? I like combining hobbies Programming VR
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
PHP + Minecraft: Why? I like combining hobbies Programming Minecraft
VR 3D Printing
First step: First look at the game files
First step: First look at the game files • Saves
folder
First step: First look at the game files • Saves
folder Each save folder has: • 9 subfolders, including the well named ‘data’ folder • icon.png, session lockfile
Data directory
Data directory • Worst name ever
Data directory • Worst name ever • But contains… maps?
Data directory • Worst name ever • But contains… maps?
idcounts.dat map_0.dat map_1.dat map_2.dat etc.
What is a map?
What is a map?
What is a map?
map_0.dat • Notepad shows gibberish
map_0.dat • Notepad shows gibberish • Google to the rescue!
map_0.dat • Notepad shows gibberish • Google to the rescue!
It’s.. NBT?
map_0.dat • Notepad shows gibberish • Google to the rescue!
It’s.. NBT? Custom format, the map has: • colors • xCenter • zCenter • scale
What can we do with this? • Generate created maps
outside of the game • Know where these are positioned • Put all of them next to each other to create a bigger map!
SlimMap • Open source project • Made with Symfony &
Leaflet.js • Shows Maps made by players
SlimMap - Demo
We can get things out of the world... Minecraft Save
Maps
We can get things out of the world... Minecraft Save
Maps ???
Structure Blocks • Can Save parts of the world to
the file system
Structure Blocks • Can Save parts of the world to
the file system • Can Load them in from the file system
structure file • Ends with .nbt • Contains a set
of blocks
structure file • Ends with .nbt • Contains a set
of blocks • Also used by game itself to create structures like villages
structure file • Ends with .nbt • Contains a set
of blocks • Also used by game itself to create structures like villages • Can be saved manually
structure file • Ends with .nbt • Contains a set
of blocks • Also used by game itself to create structures like villages • Can be saved manually • Can be placed automatically
structure file blocks 0: pos: 0, 0, 0 Position of
block
structure file blocks 0: pos: 0, 0, 0 Position of
block state: 0 Index of block in palette
structure file blocks 0: pos: 0, 0, 0 Position of
block state: 0 Index of block in palette palette All different blocks 0: name: minecraft:dirt
Minecraft Commands Extensive system that can do almost anything
Minecraft Commands Extensive system that can do almost anything Some
examples: • Change weather • Kill mobs / players • Teleport mobs / players • Start / stop time • Give items, take items
Minecraft Commands Can be executed using • Chat, starting with
/
Minecraft Commands Can be executed using • Chat, starting with
/ • Redstone
Minecraft Commands Can be executed using • Chat, starting with
/ • Redstone • Command line (servers-only)
Minecraft Commands Can be executed using • Chat, starting with
/ • Redstone • Command line (servers-only) • RCON (Send commands to a server)
RCON Execute Minecraft commands remotely • Send commands from any
server
RCON Execute Minecraft commands remotely • Send commands from any
server • Only needs host, port, password
RCON Execute Minecraft commands remotely • Send commands from any
server • Only needs host, port, password • Composer package available
RCON - Security • Just a password is not that
safe
RCON - Security • Just a password is not that
safe • Do not use default port
RCON - Security • Just a password is not that
safe • Do not use default port • If possible, use IP whitelisting in firewall
RCON - Examples Used for • Automatic whitelisting of users
on paid servers
RCON - Examples Used for • Automatic whitelisting of users
on paid servers • Interactive livestreams
Demo
What we just did Read a 1 x 1 x
1 structure file to use as a base
What we just did Find the palette and change name
of the single block in it
What we just did Write the new block to an
existing nbt file
What we just did Write a success message!
Resources Repository with information https://github.com/ThomasBerends/php-minecraft Composer package reading Minecraft’s file
format https://github.com/rickselby/NBT Composer package for RCON connections https://github.com/thedudeguy/PHP-Minecraft-Rcon
A last note... • Most talks get hardly any feedback
on Joind.in • It’s one of the best things you can do to improve a conference Please take 10 minutes of your time Give feedback
Questions?
Thank you! Any feedback is welcome! Twitter: @ThomasBerends