Merge pull request #6 from RedSparr0w/use-item-on-fix

Fix for "Use item on"
This commit is contained in:
Daniel Ginovker
2019-12-07 21:21:42 -05:00
committed by GitHub
12 changed files with 6 additions and 6 deletions
@@ -48,10 +48,9 @@ public class ActionHandler {
public void useItemOn(Action a)
{
Item toUse = Inventory.getItem(parsePint(a.getParamAsString(0)));
Menu.interact(toUse, VarsMethods.getItemOption(a.getParamAsString(1)));
interactWithEntity(new int[]{a.getParam(1)}, "1");
Inventory.getItem(a.getParam(0)).interact(Items.Option.USE);
SceneObject object = SceneObjects.getClosest(a.getParam(1));
Menu.sendAction(a.getParam(2), object.getHash(), object.getLocalRegionX(), object.getLocalRegionY(), object.getId(), 1);
}
public void type(Action a)
@@ -19,7 +19,7 @@ public class ActionGuiInfo extends NewStatementGUI {
new Descriptions("X-tile coordinate", "Y-tile coordinate", "Time (ms) to wait after walking"),
new Descriptions("Item to take (eg. 526 picks up bones)"),
new Descriptions("Item in your inventory to use (eg. 951 = \"Silk\")", "Option to select (eg. 1 might be \"eat\")"),
new Descriptions("Item in your inventory to use (eg. 999 = \"Bones\")", "Entity to use it on (eg. 999 = altar)<999 isn't actually altar>", "Item option to select (i.e. \"Use\") (cAsE sEnSiTiVe)"),
new Descriptions("Item in your inventory to use (eg. 2352 = \"Iron Bar\")", "Entity to use it on (eg. 2783 = Anvil)", "Interact index to use (eg. 62 = Use with)"),
new Descriptions("Text to type in (eg. 28)", "Hit enter? (0 for no, 1 for yes)"),
new Descriptions("X coordinate to click (eg. 0)", "Y coordinate to click (eg. 600)", "Click type? (0 for left, 1 for right)"),
new Descriptions("Amount of time to sleep (ms)"),
@@ -76,7 +76,7 @@ public class ActionExecutor {
}
else
{
switch (action.getMethod().replace("-", " "))
switch (action.getMethod().replace("-", " ").trim())
{
case "Interact with entity by ID":
actionHandler.handleInteractWith(action);
@@ -36,6 +36,7 @@ public class VarsMethods {
try (BufferedReader br = new BufferedReader(new FileReader(selectedFile))) {
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
switch (line.split(" ")[0])
{
case "If":
Binary file not shown.