- Joined
- Jul 9, 2020
- Messages
- 115
- Reaction score
- 39
- Points
- 28
- Location
- DEUTSCHLAND
- Website
- adolfstresser.kz
[GERMAN]
Für Anfänger ein kleines Tutorial wie man einen einfachen ChestStealer macht. Alles ist dukumentiert, dass man es, denke ich, gut nachvollziehen kann. Ich empfehle euch mit Events zu arbeiten, da es deutlich übersichtlicher und schöner ist. Ich benutze hierfür ein UpdateEvent, gehookt in EntityPlayerSP#onUpdateWalkingPlayer
Am Anfang wird das Event registriert mit:
Anschließend wird gecheckt ob der Spieler überhaupt einen Container geöffnet hat und dieser Container eine Kiste ist:
Dann wird eine Instanz einer Kiste erstellt mit dem aktuell geöffneten Fenster:
In der Kiste wird jetzt jeder Slot durchgegangen:
Wenn sich in dem Slot ein Item befindet, also nicht null ist:
Und ein gewisser Delay erreicht ist (hier hardcoded, könnt ihr auch mit ner Variable machen):
Wird das Item in das Inventar des Players gelegt und der Timer resettet
Hoffe euch gefällts, dann liked den Post und schreibt mir Vorschläge für weitere Tutorials in die Kommentarsektion
[ENGLISH]
For beginners a small tutorial how to make a simple ChestStealer. Everything is ducumented that you understand it easily. I recommend you to work with events, because it is much clearer and more beautiful. I use an UpdateEvent, hooked into EntityPlayerSP#onUpdateWalkingPlayer
At the beginning we register the event:
Then we check if the player has opened a container at all and this container is a chest:
Then we create an instance of a chest with the current opened window
Then we iterate through every slot
And if the slot cantains an item, i.e. it is not null
And we reach a specific delay (in this case hardcoded but you can also do it with a variable):
We pick the item and move it into the player's inventory and reset the delay
Hope you like it, then like the post and write me suggestions for further tutorials in the comments section
Für Anfänger ein kleines Tutorial wie man einen einfachen ChestStealer macht. Alles ist dukumentiert, dass man es, denke ich, gut nachvollziehen kann. Ich empfehle euch mit Events zu arbeiten, da es deutlich übersichtlicher und schöner ist. Ich benutze hierfür ein UpdateEvent, gehookt in EntityPlayerSP#onUpdateWalkingPlayer
Am Anfang wird das Event registriert mit:
Java:
@EventTarget
Anschließend wird gecheckt ob der Spieler überhaupt einen Container geöffnet hat und dieser Container eine Kiste ist:
Java:
if (mc.thePlayer.openContainer != null && mc.thePlayer.openContainer instanceof ContainerChest) {
Dann wird eine Instanz einer Kiste erstellt mit dem aktuell geöffneten Fenster:
Java:
ContainerChest container = (ContainerChest) mc.thePlayer.openContainer;
In der Kiste wird jetzt jeder Slot durchgegangen:
Java:
for (int i = 0; i < container.getLowerChestInventory().getSizeInventory(); i++) {
Wenn sich in dem Slot ein Item befindet, also nicht null ist:
Java:
if (container.getLowerChestInventory().getStackInSlot(i) != null) {
Und ein gewisser Delay erreicht ist (hier hardcoded, könnt ihr auch mit ner Variable machen):
Java:
if (this.time.isDelayComplete(60)) {
Wird das Item in das Inventar des Players gelegt und der Timer resettet
Java:
mc.playerController.windowClick(container.windowId, i, 0, 1, mc.thePlayer);
this.time.reset();
Hoffe euch gefällts, dann liked den Post und schreibt mir Vorschläge für weitere Tutorials in die Kommentarsektion
[ENGLISH]
For beginners a small tutorial how to make a simple ChestStealer. Everything is ducumented that you understand it easily. I recommend you to work with events, because it is much clearer and more beautiful. I use an UpdateEvent, hooked into EntityPlayerSP#onUpdateWalkingPlayer
At the beginning we register the event:
Java:
@EventTarget
Then we check if the player has opened a container at all and this container is a chest:
Java:
if (mc.thePlayer.openContainer != null && mc.thePlayer.openContainer instanceof ContainerChest) {
Then we create an instance of a chest with the current opened window
Java:
ContainerChest container = (ContainerChest) mc.thePlayer.openContainer;
Then we iterate through every slot
Java:
for (int i = 0; i < container.getLowerChestInventory().getSizeInventory(); i++) {
And if the slot cantains an item, i.e. it is not null
Java:
if (container.getLowerChestInventory().getStackInSlot(i) != null) {
And we reach a specific delay (in this case hardcoded but you can also do it with a variable):
Java:
if (this.time.isDelayComplete(60)) {
We pick the item and move it into the player's inventory and reset the delay
Java:
mc.playerController.windowClick(container.windowId, i, 0, 1, mc.thePlayer);
this.time.reset();
Hope you like it, then like the post and write me suggestions for further tutorials in the comments section