use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_18_R1 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_17_1 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_17_R1 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project PublicCrafters by BananaPuncher714.
the class ContainerManager_v1_11_R1 method getLocation.
public Location getLocation(Inventory inventory) {
if (inventory == null) {
return null;
}
if (!(inventory instanceof CraftInventory)) {
return null;
}
try {
Field ic = CraftInventory.class.getDeclaredField("inventory");
ic.setAccessible(true);
Object crafting = ic.get(inventory);
if (crafting instanceof CustomInventoryCrafting) {
CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
return table.getLocation();
}
} catch (Exception exception) {
exception.printStackTrace();
}
return null;
}
use of org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventory in project Mohist by MohistMC.
the class CraftLootTable method fillInventory.
@Override
public void fillInventory(Inventory inventory, Random random, LootContext context) {
net.minecraft.world.level.storage.loot.LootContext nmsContext = convertContext(context, random);
CraftInventory craftInventory = (CraftInventory) inventory;
Container handle = craftInventory.getInventory();
// TODO: When events are added, call event here w/ custom reason?
getHandle().fill(handle, nmsContext);
}
Aggregations