package org.squiddev.plethora.gameplay.modules.glasses.objects;

import net.minecraft.item.Item;
import org.squiddev.plethora.api.method.MethodResult;
import org.squiddev.plethora.api.method.wrapper.FromTarget;
import org.squiddev.plethora.api.method.wrapper.Optional;
import org.squiddev.plethora.api.method.wrapper.PlethoraMethod;
import org.squiddev.plethora.gameplay.modules.glasses.objects.object3d.Item3D;

import javax.annotation.Nonnull;

/**
 * An object which contains an item.
 */
public interface ItemObject {
	@Nonnull
	Item getItem();

	void setItem(@Nonnull Item item);

	int getDamage();

	void setDamage(int damage);

	@PlethoraMethod(doc = "function(): string, number -- Get the item and damage value for this object.", worldThread = false)
	static MethodResult getItem(@FromTarget Item3D object) {
		return MethodResult.result(object.getItem().getRegistryName().toString(), object.getDamage());
	}

	@PlethoraMethod(doc = "-- Set the item and damage value for this object.", worldThread = false)
	static void setItem(@FromTarget Item3D object, Item item, @Optional(defInt = 0) int damage) {
		object.setItem(item);
		object.setDamage(damage);
	}
}

@@ -329,87 +329,8 @@
 hod;
-%0Aimport org.squiddev.plethora.gameplay.modules.glasses.objects.object3d.Item3D;
 %0A%0Aim
@@ -714,26 +714,30 @@
 mTarget Item
-3D
+Object
  object) %7B%0A%09
@@ -974,10 +974,14 @@
 Item
-3D
+Object
  obj

Fix {get,set}Object not being available on 2D items