mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:33:57 +01:00
Merge remote-tracking branch 'origin/mc1.18/0.5.1' into mc1.19/0.5.1
This commit is contained in:
commit
0c6a6de0e8
@ -64,10 +64,12 @@ public class ContraptionColliderLockPacket extends SimplePacketBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(Context context) {
|
public boolean handle(Context context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
AllPackets.getChannel()
|
AllPackets.getChannel()
|
||||||
.send(PacketDistributor.TRACKING_ENTITY.with(context::getSender),
|
.send(PacketDistributor.TRACKING_ENTITY.with(context::getSender),
|
||||||
new ContraptionColliderLockPacket(contraption, offset, context.getSender()
|
new ContraptionColliderLockPacket(contraption, offset, context.getSender()
|
||||||
.getId()));
|
.getId()));
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,26 +43,29 @@ public class ClipboardEditPacket extends SimplePacketBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(Context context) {
|
public boolean handle(Context context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
ServerPlayer sender = context.getSender();
|
ServerPlayer sender = context.getSender();
|
||||||
|
|
||||||
if (targetedBlock != null) {
|
if (targetedBlock != null) {
|
||||||
Level world = sender.level;
|
Level world = sender.level;
|
||||||
if (world == null || !world.isLoaded(targetedBlock))
|
if (world == null || !world.isLoaded(targetedBlock))
|
||||||
return true;
|
return;
|
||||||
if (!targetedBlock.closerThan(sender.blockPosition(), 20))
|
if (!targetedBlock.closerThan(sender.blockPosition(), 20))
|
||||||
return true;
|
return;
|
||||||
if (world.getBlockEntity(targetedBlock) instanceof ClipboardBlockEntity cbe) {
|
if (world.getBlockEntity(targetedBlock) instanceof ClipboardBlockEntity cbe) {
|
||||||
cbe.dataContainer.setTag(data.isEmpty() ? null : data);
|
cbe.dataContainer.setTag(data.isEmpty() ? null : data);
|
||||||
cbe.onEditedBy(sender);
|
cbe.onEditedBy(sender);
|
||||||
}
|
}
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack itemStack = sender.getInventory()
|
ItemStack itemStack = sender.getInventory()
|
||||||
.getItem(hotbarSlot);
|
.getItem(hotbarSlot);
|
||||||
if (!AllBlocks.CLIPBOARD.isIn(itemStack))
|
if (!AllBlocks.CLIPBOARD.isIn(itemStack))
|
||||||
return true;
|
return;
|
||||||
itemStack.setTag(data.isEmpty() ? null : data);
|
itemStack.setTag(data.isEmpty() ? null : data);
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user