Merge remote-tracking branch 'origin/mc1.18/0.5.1' into mc1.19/0.5.1

This commit is contained in:
simibubi 2023-05-21 23:54:10 +02:00
commit 0c6a6de0e8
2 changed files with 27 additions and 22 deletions

View file

@ -64,10 +64,12 @@ public class ContraptionColliderLockPacket extends SimplePacketBase {
@Override
public boolean handle(Context context) {
AllPackets.getChannel()
.send(PacketDistributor.TRACKING_ENTITY.with(context::getSender),
new ContraptionColliderLockPacket(contraption, offset, context.getSender()
.getId()));
context.enqueueWork(() -> {
AllPackets.getChannel()
.send(PacketDistributor.TRACKING_ENTITY.with(context::getSender),
new ContraptionColliderLockPacket(contraption, offset, context.getSender()
.getId()));
});
return true;
}

View file

@ -43,26 +43,29 @@ public class ClipboardEditPacket extends SimplePacketBase {
@Override
public boolean handle(Context context) {
ServerPlayer sender = context.getSender();
if (targetedBlock != null) {
Level world = sender.level;
if (world == null || !world.isLoaded(targetedBlock))
return true;
if (!targetedBlock.closerThan(sender.blockPosition(), 20))
return true;
if (world.getBlockEntity(targetedBlock) instanceof ClipboardBlockEntity cbe) {
cbe.dataContainer.setTag(data.isEmpty() ? null : data);
cbe.onEditedBy(sender);
context.enqueueWork(() -> {
ServerPlayer sender = context.getSender();
if (targetedBlock != null) {
Level world = sender.level;
if (world == null || !world.isLoaded(targetedBlock))
return;
if (!targetedBlock.closerThan(sender.blockPosition(), 20))
return;
if (world.getBlockEntity(targetedBlock) instanceof ClipboardBlockEntity cbe) {
cbe.dataContainer.setTag(data.isEmpty() ? null : data);
cbe.onEditedBy(sender);
}
return;
}
return true;
}
ItemStack itemStack = sender.getInventory()
.getItem(hotbarSlot);
if (!AllBlocks.CLIPBOARD.isIn(itemStack))
return;
itemStack.setTag(data.isEmpty() ? null : data);
});
ItemStack itemStack = sender.getInventory()
.getItem(hotbarSlot);
if (!AllBlocks.CLIPBOARD.isIn(itemStack))
return true;
itemStack.setTag(data.isEmpty() ? null : data);
return true;
}