Just keeps the item in bounds while dragging instead of it clipping outside the raster
Code:
if (child.inventoryItemId[item] > 0) {
int drag_offset_x = 0;
int drag_offset_y = 0;
int bind_x = 0;
int bind_y = 0;
int itemId = child.inventoryItemId[item] - 1;
if (tileX > Raster.topX - 32 && tileX < Raster.bottomX
&& tileY > Raster.topY - 32 && tileY < Raster.bottomY || activeInterfaceType != 0 && anInt1085 == item) {
int outlineColor = 0;
if (itemSelected == 1 && anInt1283 == item && anInt1284 == child.id)
outlineColor = 0xffffff;
Sprite item_icon = ItemDefinition.getSprite(itemId, child.inventoryAmounts[item], outlineColor);
if (item_icon != null) {
if (activeInterfaceType != 0 && anInt1085 == item && anInt1084 == child.id) {
//dragging
drag_offset_x = super.mouseX - anInt1087;
drag_offset_y = super.mouseY - anInt1088;
if (drag_offset_x < 5 && drag_offset_x > -5)
drag_offset_x = 0;
if (drag_offset_y < 5 && drag_offset_y > -5)
drag_offset_y = 0;
if (dragItemDelay < 10) {
drag_offset_x = 0;
drag_offset_y = 0;
}
bind_x = tileX + drag_offset_x;
if(bind_x < Raster.topX) {
bind_x = Raster.topX - (drag_offset_x);
if(drag_offset_x < Raster.topX)
bind_x = Raster.topX;
}
if(bind_x > Raster.bottomX - 32) {
bind_x = Raster.bottomX - 32;
}
bind_y = tileY + drag_offset_y;
if(bind_y < Raster.topY && main.scrollPosition == 0) {
bind_y = Raster.topY - (drag_offset_y);
if(drag_offset_y < Raster.topY)
bind_y = Raster.topY;
}
if(bind_y > Raster.bottomY - 32)
bind_y = Raster.bottomY - 32;
if (tileY + drag_offset_y < Raster.topY && main.scrollPosition > 0) {
int notch = (anInt945 * (Raster.topY - tileY - drag_offset_y)) / 3;
if (notch > anInt945 * 10)
notch = anInt945 * 10;
if (notch > main.scrollPosition)
notch = main.scrollPosition;
main.scrollPosition -= notch;
anInt1088 += notch;
bind_y = Raster.topY;//was left out, if you're item disappears while dragging up in a scrollbar this is the fix :-)
}
if (tileY + drag_offset_y + 32 > Raster.bottomY && main.scrollPosition < main.scrollMax - main.height) {
int notch = (anInt945 * ((tileY + drag_offset_y + 32) - Raster.bottomY)) / 3;
if (notch > anInt945 * 10)
notch = anInt945 * 10;
if (notch > main.scrollMax - main.height - main.scrollPosition)
notch = main.scrollMax - main.height - main.scrollPosition;
main.scrollPosition += notch;
anInt1088 -= notch;
}
item_icon.drawSprite1(bind_x, bind_y);
} else if (atInventoryInterfaceType != 0 && atInventoryIndex == item && atInventoryInterface == child.id) {
bind_x = tileX + drag_offset_x;
bind_y = tileY;
item_icon.drawSprite1(tileX, tileY);
} else {
if(!child.scrollModels) {
bind_x = tileX + drag_offset_x;
bind_y = tileY;
item_icon.drawSprite(tileX, tileY);
} else {
bind_x = tileX + drag_offset_x;
bind_y = tileY + drag_offset_y;
}
}
if (child.showItemAmount && (item_icon.maxWidth == 33 || child.inventoryAmounts[item] != 1)) {
int k10 = child.inventoryAmounts[item];
smallText.render(0, intToKOrMil(k10), bind_y + 10, bind_x + 1);//shadow
if (k10 >= 1)
smallText.render(0xFFFF00, intToKOrMil(k10), bind_y + 9, bind_x);
if (k10 >= 100000)
smallText.render(0xFFFFFF, intToKOrMil(k10), bind_y + 9, bind_x);
if (k10 >= 10000000)
smallText.render(0x00FF80, intToKOrMil(k10), bind_y + 9, bind_x);
}