mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
Stackable Breakable
- Fixed Belt connector items cancelling toolbox sync when their nbt changes - Fixed Unbreakable items breaking when used as tool in deploying recipes
This commit is contained in:
parent
7defbb18a3
commit
386a6f698b
5 changed files with 23 additions and 8 deletions
|
@ -1747,7 +1747,7 @@ d080b1b25e5bc8baf5aee68691b08c7f12ece3b0 assets/create/models/item/windmill_bear
|
|||
a80fb25a0b655e76be986b5b49fcb0f03461a1ab assets/create/models/item/zinc_nugget.json
|
||||
b1689617190c05ef34bd18456b0c7ae09bb3210f assets/create/models/item/zinc_ore.json
|
||||
58880e397902f8ca5b3b59ed4423e626109ddc4c assets/create/sounds.json
|
||||
5d0cc4c0255dc241e61c173b31ddca70c88d08e4 data/create/advancements/aesthetics.json
|
||||
0f1b4b980afba9bf2caf583b88e261bba8b10313 data/create/advancements/aesthetics.json
|
||||
187921fa131b06721bfaf63f2623a28c141aae9a data/create/advancements/andesite_alloy.json
|
||||
0ea2db7173b5be28b289ea7c9a6a0cf5805c60c7 data/create/advancements/andesite_casing.json
|
||||
83c046bd200623933545c9e4326f782fb02c87fa data/create/advancements/arm_blaze_burner.json
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
"trigger": "create:bracket_apply",
|
||||
"conditions": {
|
||||
"accepted_entries": [
|
||||
"create:large_cogwheel",
|
||||
"create:cogwheel"
|
||||
"create:cogwheel",
|
||||
"create:large_cogwheel"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -119,8 +119,12 @@ public class BeltDeployerCallbacks {
|
|||
handler.handleProcessingOnItem(transported, TransportedResult.convertToAndLeaveHeld(collect, left));
|
||||
|
||||
ItemStack heldItem = deployerTileEntity.player.getMainHandItem();
|
||||
if (!(recipe instanceof DeployerApplicationRecipe)
|
||||
|| !((DeployerApplicationRecipe) recipe).shouldKeepHeldItem()) {
|
||||
boolean unbreakable = heldItem.hasTag() && heldItem.getTag()
|
||||
.getBoolean("Unbreakable");
|
||||
boolean keepHeld =
|
||||
recipe instanceof DeployerApplicationRecipe && ((DeployerApplicationRecipe) recipe).shouldKeepHeldItem();
|
||||
|
||||
if (!unbreakable && !keepHeld) {
|
||||
if (heldItem.isDamageableItem())
|
||||
heldItem.hurtAndBreak(1, deployerTileEntity.player, s -> s.broadcastBreakEvent(Hand.MAIN_HAND));
|
||||
else
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.function.Consumer;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllTags.AllItemTags;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
|
||||
|
@ -191,9 +192,17 @@ public class ToolboxInventory extends ItemStackHandler {
|
|||
return ItemHandlerHelper.copyStackWithSize(lastValid, amount - remaining);
|
||||
}
|
||||
|
||||
public static ItemStack cleanItemNBT(ItemStack stack) {
|
||||
if (AllItems.BELT_CONNECTOR.isIn(stack))
|
||||
stack.removeTagKey("FirstPulley");
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static boolean canItemsShareCompartment(ItemStack stack1, ItemStack stack2) {
|
||||
if (!stack1.isStackable() && !stack2.isStackable() && stack1.isDamageableItem() && stack2.isDamageableItem())
|
||||
return stack1.getItem() == stack2.getItem();
|
||||
if (AllItems.BELT_CONNECTOR.isIn(stack1) && AllItems.BELT_CONNECTOR.isIn(stack2))
|
||||
return true;
|
||||
return ItemHandlerHelper.canItemStacksStack(stack1, stack2);
|
||||
}
|
||||
|
||||
|
|
|
@ -157,8 +157,9 @@ public class ToolboxTileEntity extends SmartTileEntity implements INamedContaine
|
|||
ItemStack extracted = inventory.takeFromCompartment(amountToReplenish, slot, false);
|
||||
if (!extracted.isEmpty()) {
|
||||
update = true;
|
||||
ItemStack template = playerStack.isEmpty() ? extracted : playerStack;
|
||||
player.inventory.setItem(hotbarSlot,
|
||||
ItemHandlerHelper.copyStackWithSize(extracted, count + extracted.getCount()));
|
||||
ItemHandlerHelper.copyStackWithSize(template, count + extracted.getCount()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,9 +241,10 @@ public class ToolboxTileEntity extends SmartTileEntity implements INamedContaine
|
|||
return;
|
||||
|
||||
ItemStack playerStack = player.inventory.getItem(hotbarSlot);
|
||||
ItemStack remainder = inventory.distributeToCompartment(playerStack, slot, false);
|
||||
ItemStack toInsert = ToolboxInventory.cleanItemNBT(playerStack.copy());
|
||||
ItemStack remainder = inventory.distributeToCompartment(toInsert, slot, false);
|
||||
|
||||
if (remainder.getCount() != playerStack.getCount())
|
||||
if (remainder.getCount() != toInsert.getCount())
|
||||
player.inventory.setItem(hotbarSlot, remainder);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue