Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- And then, instructions* for Minecraft to run (are added)* or "injected" into the world* (in the form of commands)*
- First, we need something* that allows the program to read input from the game
- Simply put, (this is)* the log file generated by the game
- (Each time a command executes or a chat message is sent)*
- It is written to a latest.log file within* the logs folder of the Minecraft directory
- (This is how the system reads chat messages)*
- That was simple. However, we still* need something else
- We need* something in-game that can access information from outside the game
- Luckily* enough, we have structure blocks
- Structure blocks can read nbt* files inside the world's structures folder
- This is the main idea behind this concept*
- powering a* structure block
- So, the structure block (is essentially)* doing nothing at the moment
- And* saves that structure* under the name "vi0"
- On the* next cycle*, (now that there)* IS a file called "vi0"
- The structure* block will realize that there is now* a file to load
- And so it will spawn the structure with (all the)* commands in it
- Since these* command blocks are set* to Always Active, they will trigger* immediately
- (This works for the first cycle)*
- But what* happens if the program wants to do something in-game a second* time?
- (After all, whenever the game loads a structure, it will "remember" it, until the world is reloaded)*
- (The game)* would not see it as a new structure
- (zero offset)*
- Meaning* that it would replace itself after loading
- Additionally, the generated structure also had a structure block with (zero offset)* at the origin
- (This means that when the structure "vi0" is loaded)*
- (And will continue generating structure files with the next name in the sequence)*
- (This effectively creates a way for a program to run commands in-game at any given time)*
- And, combined with the* log file, (can do some pretty interesting things)*
- Of course, there is a lot more behind the scenes.
- The external tool needs to remember the last number it generated when relaunched
- the structures folder shouldn't have more than 15 injection structure files at any one time
- and it shouldn't generate structures if the game is paused or closed.
- All of these things have been considered to make the system as optimized as possible.
- SOURCE CODE
- I have left the source code for the injection library for Java in a GitHub repository, as well as the examples shown in this video, in the description
Advertisement
Add Comment
Please, Sign In to add comment