use of net.minecraft.server.v1_14_R1.Slot in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method b.
/**
* The shift clicking method
*/
@Override
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = ItemStack.a;
Slot slot = (Slot) this.c.get(i);
if ((slot != null) && (slot.hasItem())) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i == 0) {
itemstack1.getItem().b(itemstack1, world, entityhuman);
if (!a(itemstack1, 10, 46, true)) {
return ItemStack.a;
}
slot.a(itemstack1, itemstack);
} else if ((i >= 10) && (i < 37)) {
if (!a(itemstack1, 37, 46, false)) {
return ItemStack.a;
}
} else if ((i >= 37) && (i < 46)) {
if (!a(itemstack1, 10, 37, false)) {
return ItemStack.a;
}
} else if (!a(itemstack1, 10, 46, false)) {
return ItemStack.a;
}
if (itemstack1.isEmpty()) {
slot.set(ItemStack.a);
} else {
slot.f();
}
if (itemstack1.getCount() == itemstack.getCount()) {
return ItemStack.a;
}
ItemStack itemstack2 = slot.a(entityhuman, itemstack1);
if (i == 0) {
entityhuman.drop(itemstack2, false);
}
}
return itemstack;
}
use of net.minecraft.server.v1_14_R1.Slot in project PublicCrafters by BananaPuncher714.
the class CustomContainerWorkbench method b.
/**
* The shift clicking method
*/
@Override
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
if ((slot != null) && (slot.hasItem())) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i == 0) {
itemstack1.getItem().b(itemstack1, world, entityhuman);
if (!a(itemstack1, 10, 46, true)) {
return null;
}
slot.a(itemstack1, itemstack);
} else if ((i >= 10) && (i < 37)) {
if (!a(itemstack1, 37, 46, false)) {
return null;
}
} else if ((i >= 37) && (i < 46)) {
if (!a(itemstack1, 10, 37, false)) {
return null;
}
} else if (!a(itemstack1, 10, 46, false)) {
return null;
}
slot.f();
if (itemstack1.count == itemstack.count) {
return null;
}
slot.a(entityhuman, itemstack1);
if (i == 0) {
entityhuman.drop(itemstack1, false);
}
}
return itemstack;
}
use of net.minecraft.server.v1_14_R1.Slot in project PublicCrafters by BananaPuncher714.
the class CustomContainerAnvil method b.
// Shift click
public ItemStack b(EntityHuman entityhuman, int i) {
ItemStack itemstack = ItemStack.a;
Slot slot = (Slot) this.c.get(i);
if ((slot != null) && (slot.hasItem())) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if (i == 2) {
if (!a(itemstack1, 3, 39, true)) {
return ItemStack.a;
}
slot.a(itemstack1, itemstack);
} else if ((i != 0) && (i != 1)) {
if ((i >= 3) && (i < 39) && (!a(itemstack1, 0, 2, false))) {
return ItemStack.a;
}
} else if (!a(itemstack1, 3, 39, false)) {
return ItemStack.a;
}
if (itemstack1.isEmpty()) {
slot.set(ItemStack.a);
} else {
slot.f();
}
if (itemstack1.getCount() == itemstack.getCount()) {
return ItemStack.a;
}
slot.a(entityhuman, itemstack1);
}
return itemstack;
}
use of net.minecraft.server.v1_14_R1.Slot in project Panilla by ds58.
the class InventoryCleaner method clean.
@Override
public void clean(IPanillaPlayer player) {
CraftPlayer craftPlayer = (CraftPlayer) player.getHandle();
Container container = craftPlayer.getHandle().activeContainer;
for (int slot = 0; slot < container.slots.size(); slot++) {
ItemStack itemStack = container.getSlot(slot).getItem();
if (itemStack == null || !itemStack.hasTag()) {
continue;
}
NBTTagCompound nmsTag = itemStack.getTag();
INbtTagCompound tag = new NbtTagCompound(nmsTag);
String itemName = itemStack.getItem().getName();
if (nmsTag == null || itemName == null) {
continue;
}
FailedNbt failedNbt = NbtChecks.checkAll(tag, itemName, panilla);
if (FailedNbt.failsThreshold(failedNbt)) {
container.getSlot(slot).getItem().setTag(null);
} else if (FailedNbt.fails(failedNbt)) {
nmsTag.remove(failedNbt.key);
container.getSlot(slot).getItem().setTag(nmsTag);
}
}
}
use of net.minecraft.server.v1_14_R1.Slot in project PaperDev by Kamillaova.
the class CraftContainer method setupWorkbench.
private void setupWorkbench(IInventory top, IInventory bottom) {
// This code copied from ContainerWorkbench
this.a(new Slot(top, 0, 124, 35));
int row;
int col;
for (row = 0; row < 3; ++row) {
for (col = 0; col < 3; ++col) {
this.a(new Slot(top, 1 + col + row * 3, 30 + col * 18, 17 + row * 18));
}
}
for (row = 0; row < 3; ++row) {
for (col = 0; col < 9; ++col) {
this.a(new Slot(bottom, col + row * 9 + 9, 8 + col * 18, 84 + row * 18));
}
}
for (col = 0; col < 9; ++col) {
this.a(new Slot(bottom, col, 8 + col * 18, 142));
}
// End copy from ContainerWorkbench
}
Aggregations