Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

Tutorial Simple ChestStealer

Status
Not open for further replies.

Kriteax

MasterOf13FPS
MasterOf13FPS
Developer
Joined
Jul 9, 2020
Messages
107
Reaction score
30
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:
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
 
kannst du deinen Code erklären?
Just Saying xD
Sollte man von ausgehen? Wenn man nur Code schreibt mit dem Ziel, dass es funktioniert und ohne zu verstehen, was man da schreibt, kann mans auch sein lassen.
 
Es war nun ein Joke xD
Der an AntiSkid ging
 
Hey which onUpdateWalkingPlayer ? the void or the this. onUpdateWalkingPlayer(); ?
 
[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:
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
Hi hab da nen problem ich bekomm das mit dem timehelper nicht hin kannst du mal pls deinen senden :c
 
@DasDirt It is MUCH better to use at least 4 to 5 TimeUtils/Helpers as you saw in Klientus. You can use them in different modules to show that you know A LOT about java 🙃
 
@DasDirt It is MUCH better to use at least 4 to 5 TimeUtils/Helpers as you saw in Klientus. You can use them in different modules to show that you know A LOT about java 🙃
i make new timehelper for every module which uses one.
for some reason the timehelpers time is the same for all modules.
idk why
 
Status
Not open for further replies.
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top