2020-12-06 04:59:32 +00:00
|
|
|
package me.rigamortis.seppuku.api.task.hand;
|
|
|
|
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Daniel E
|
|
|
|
*/
|
|
|
|
public final class HandSwapContext {
|
2021-10-12 03:01:11 +00:00
|
|
|
private int oldSlot;
|
|
|
|
private int newSlot;
|
2020-12-06 04:59:32 +00:00
|
|
|
|
2021-10-12 03:01:11 +00:00
|
|
|
public HandSwapContext(int oldSlot, int newSlot) {
|
2020-12-06 04:59:32 +00:00
|
|
|
this.oldSlot = oldSlot;
|
|
|
|
this.newSlot = newSlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getOldSlot() {
|
|
|
|
return oldSlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getNewSlot() {
|
|
|
|
return newSlot;
|
|
|
|
}
|
|
|
|
|
2021-10-12 03:01:11 +00:00
|
|
|
public void setOldSlot(int oldSlot) {
|
|
|
|
this.oldSlot = oldSlot;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setNewSlot(int newSlot) {
|
|
|
|
this.newSlot = newSlot;
|
|
|
|
}
|
|
|
|
|
2020-12-06 04:59:32 +00:00
|
|
|
public void handleHandSwap(final boolean restore,
|
2020-12-10 04:39:14 +00:00
|
|
|
final Minecraft minecraft) {
|
2020-12-06 04:59:32 +00:00
|
|
|
minecraft.player.inventory.currentItem =
|
|
|
|
restore ? this.getOldSlot() : this.getNewSlot();
|
|
|
|
minecraft.playerController.updateController();
|
|
|
|
}
|
|
|
|
}
|