1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-05 01:26:20 +00:00

Merge pull request #1262 from emmachase/mc-1.19.x

Fix duplicated swing animations on high-ping servers
This commit is contained in:
Jonathan Coates 2022-12-20 10:26:54 +00:00 committed by GitHub
commit 9010219b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 12 deletions

View File

@ -98,7 +98,7 @@ public abstract class AbstractComputerBlockEntity extends BlockEntity implements
setLabel(currentItem.getHoverName().getString());
currentItem.shrink(1);
}
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(getLevel().isClientSide);
} else if (!player.isCrouching()) {
// Regular right click to activate computer
if (!getLevel().isClientSide && isUsable(player)) {
@ -110,7 +110,7 @@ public abstract class AbstractComputerBlockEntity extends BlockEntity implements
: ItemStack.EMPTY;
new ComputerContainerData(computer, stack).open(player, this);
}
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(getLevel().isClientSide);
}
return InteractionResult.PASS;
}

View File

@ -56,7 +56,7 @@ public class PrintoutItem extends Item {
new HeldItemContainerData(hand)
.open(player, new HeldItemMenu.Factory(ModRegistry.Menus.PRINTOUT.get(), player.getItemInHand(hand), hand));
}
return new InteractionResultHolder<>(InteractionResult.SUCCESS, player.getItemInHand(hand));
return new InteractionResultHolder<>(InteractionResult.sidedSuccess(world.isClientSide), player.getItemInHand(hand));
}
private ItemStack createFromTitleAndText(@Nullable String title, @Nullable String[] text, @Nullable String[] colours) {

View File

@ -193,7 +193,7 @@ public class CableBlockEntity extends BlockEntity {
}
}
return InteractionResult.SUCCESS;
return InteractionResult.CONSUME;
}
@Override

View File

@ -78,7 +78,7 @@ public abstract class CableBlockItem extends BlockItem {
.setValue(CONNECTIONS.get(side), existingState.getValue(CABLE));
if (placeAt(world, pos, newState)) {
stack.shrink(1);
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(world.isClientSide);
}
}
@ -105,7 +105,7 @@ public abstract class CableBlockItem extends BlockItem {
if (insideState.getBlock() == ModRegistry.Blocks.CABLE.get() && !insideState.getValue(CableBlock.CABLE)
&& placeAtCorrected(world, insidePos, insideState.setValue(CableBlock.CABLE, true))) {
stack.shrink(1);
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(world.isClientSide);
}
// Try to add a cable to a modem adjacent to this block
@ -113,7 +113,7 @@ public abstract class CableBlockItem extends BlockItem {
if (existingState.getBlock() == ModRegistry.Blocks.CABLE.get() && !existingState.getValue(CableBlock.CABLE)
&& placeAtCorrected(world, pos, existingState.setValue(CableBlock.CABLE, true))) {
stack.shrink(1);
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(world.isClientSide);
}
return super.place(context);

View File

@ -139,7 +139,7 @@ public class WiredModemFullBlockEntity extends BlockEntity {
sendPeripheralChanges(player, "chat.computercraft.wired_modem.peripheral_connected", periphNames);
}
return InteractionResult.SUCCESS;
return InteractionResult.CONSUME;
}
private static void sendPeripheralChanges(Player player, String kind, Collection<String> peripherals) {

View File

@ -110,7 +110,7 @@ public class MonitorBlock extends HorizontalDirectionalBlock implements EntityBl
);
}
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(level.isClientSide);
}
@Override

View File

@ -141,7 +141,7 @@ public class PocketComputerItem extends Item implements IComputerItem, IMedia, I
new ComputerContainerData(computer, stack).open(player, new PocketComputerMenuProvider(computer, stack, this, hand, isTypingOnly));
}
}
return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack);
return new InteractionResultHolder<>(InteractionResult.sidedSuccess(world.isClientSide), stack);
}
@Override

View File

@ -104,7 +104,7 @@ public class TurtleBlockEntity extends AbstractComputerBlockEntity implements Ba
}
}
}
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(getLevel().isClientSide);
} else if (currentItem.getItem() == Items.WATER_BUCKET && brain.getColour() != -1) {
// Water to remove turtle colour
if (!getLevel().isClientSide) {
@ -116,7 +116,7 @@ public class TurtleBlockEntity extends AbstractComputerBlockEntity implements Ba
}
}
}
return InteractionResult.SUCCESS;
return InteractionResult.sidedSuccess(getLevel().isClientSide);
}
}