backpack improvements

This commit is contained in:
Jörg Henke 2021-08-19 16:14:41 +02:00
parent 79f3ef13f5
commit 1b494e0668
2 changed files with 25 additions and 5 deletions

View File

@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.6
# Mod Properties
mod_version = 1.17.1.1
mod_version = 1.17.1.2
maven_group = de.jottyfan.minecraft
archives_base_name = quickiefabric

View File

@ -74,15 +74,35 @@ public class BackpackScreenHandler extends ScreenHandler {
ItemStack stack = slot == null ? ItemStack.EMPTY : slot.getStack();
if (actionType.equals(SlotActionType.PICKUP) || actionType.equals(SlotActionType.PICKUP_ALL)
|| actionType.equals(SlotActionType.SWAP)) {
super.onSlotClick(slotId, quickCraftData, actionType, playerEntity);
} else if (actionType.equals(SlotActionType.THROW)) { // pickup from the active items line
if (stack.getName().equals(thisStack.getName())) {
return; // omit to put the backpack into itself; as a side effect, omits adding same
// colored backpacks into this one
// colored backpacks into this one
} else {
// do not throw but pickup
super.onSlotClick(slotId, quickCraftData, SlotActionType.PICKUP, playerEntity);
}
} else if (actionType.equals(SlotActionType.QUICK_CRAFT)) { // drag - but does not drag the right slot content
if (slotId < 0) {
return; // do not execute anything if slotId is < 0 as sometimes -999
}
if (playerEntity.world.isClient) {
LOGGER.debug("ignoring action type {} on slotId {} for {} x {}", actionType.toString(), slotId,
stack.getCount(), stack.getItem().toString());
}
} else if (actionType.equals(SlotActionType.QUICK_MOVE)) { // shift click
if (stack.getName().equals(thisStack.getName())) {
return; // omit to put the backpack into itself; as a side effect, omits adding same
// colored backpacks into this one
} else {
// do not move but pickup all
super.onSlotClick(slotId, quickCraftData, SlotActionType.PICKUP_ALL, playerEntity);
}
super.onSlotClick(slotId, quickCraftData, actionType, playerEntity);
} else {
if (playerEntity.world.isClient) {
LOGGER.debug("ignoring action type {} on slotId {} for {} x {}", actionType.toString(), slotId, stack.getCount(),
stack.getItem().toString());
LOGGER.debug("ignoring action type {} on slotId {} for {} x {}", actionType.toString(), slotId,
stack.getCount(), stack.getItem().toString());
}
}
}