Energyxxer

Vanilla Injection Script Redo #1

Jun 25th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. And then, instructions* for Minecraft to run (are added)* or "injected" into the world* (in the form of commands)*
  2. First, we need something* that allows the program to read input from the game
  3. Simply put, (this is)* the log file generated by the game
  4. (Each time a command executes or a chat message is sent)*
  5. It is written to a latest.log file within* the logs folder of the Minecraft directory
  6. (This is how the system reads chat messages)*
  7. That was simple. However, we still* need something else
  8. We need* something in-game that can access information from outside the game
  9. Luckily* enough, we have structure blocks
  10. Structure blocks can read nbt* files inside the world's structures folder
  11. This is the main idea behind this concept*
  12. powering a* structure block
  13. So, the structure block (is essentially)* doing nothing at the moment
  14. And* saves that structure* under the name "vi0"
  15. On the* next cycle*, (now that there)* IS a file called "vi0"
  16. The structure* block will realize that there is now* a file to load
  17. And so it will spawn the structure with (all the)* commands in it
  18. Since these* command blocks are set* to Always Active, they will trigger* immediately
  19. (This works for the first cycle)*
  20. But what* happens if the program wants to do something in-game a second* time?
  21. (After all, whenever the game loads a structure, it will "remember" it, until the world is reloaded)*
  22. (The game)* would not see it as a new structure
  23. (zero offset)*
  24. Meaning* that it would replace itself after loading
  25. Additionally, the generated structure also had a structure block with (zero offset)* at the origin
  26. (This means that when the structure "vi0" is loaded)*
  27. (And will continue generating structure files with the next name in the sequence)*
  28. (This effectively creates a way for a program to run commands in-game at any given time)*
  29. And, combined with the* log file, (can do some pretty interesting things)*
  30.  
  31. Of course, there is a lot more behind the scenes.
  32. The external tool needs to remember the last number it generated when relaunched
  33. the structures folder shouldn't have more than 15 injection structure files at any one time
  34. and it shouldn't generate structures if the game is paused or closed.
  35. All of these things have been considered to make the system as optimized as possible.
  36.  
  37. SOURCE CODE
  38. 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