Double Trouble

- Fixed an item duplication issue with belts
- Spectators can no longer interact with contraptions
This commit is contained in:
simibubi 2022-07-07 13:18:03 +02:00
parent c55cdd2bac
commit c36c4e756e
5 changed files with 10 additions and 0 deletions

View file

@ -75,6 +75,8 @@ public class ContraptionHandlerClient {
if (player == null)
return;
if (player.isSpectator())
return;
if (mc.level == null)
return;
if (!event.isUseItem())

View file

@ -428,6 +428,8 @@ public class BeltInventory {
Function<TransportedItemStack, TransportedResult> processFunction) {
boolean dirty = false;
for (TransportedItemStack transported : items) {
if (toRemove.contains(transported))
continue;
ItemStack stackBefore = transported.stack.copy();
if (Math.abs(position - transported.beltPosition) >= maxDistanceToPosition)
continue;

View file

@ -511,6 +511,8 @@ public class CarriageContraptionEntity extends OrientedContraptionEntity {
@Override
public boolean startControlling(BlockPos controlsLocalPos, Player player) {
if (player == null || player.isSpectator())
return false;
if (carriage == null)
return false;
if (carriage.train.derailed)

View file

@ -79,6 +79,8 @@ public class TrainRelocator {
LocalPlayer player = mc.player;
if (player == null)
return;
if (player.isSpectator())
return;
if (!player.position()
.closerThan(relocatingOrigin, 24) || player.isSteppingCarefully()) {

View file

@ -28,6 +28,8 @@ public class ScheduleItemRetrieval {
Player player = event.getPlayer();
if (player == null || entity == null)
return;
if (player.isSpectator())
return;
Entity rootVehicle = entity.getRootVehicle();
if (!(rootVehicle instanceof CarriageContraptionEntity))