Merge pull request #5192 from laxadeR/fix-elevator-contacts

Fixed wrong elevator contacts powering sometimes
This commit is contained in:
simibubi 2023-09-20 10:00:34 +02:00 committed by GitHub
commit 72882f89c0
Failed to generate hash of commit

View file

@ -82,14 +82,14 @@ public class ElevatorPulleyBlockEntity extends PulleyBlockEntity {
double y = movedContraption.getY(); double y = movedContraption.getY();
int targetLevel = Mth.floor(0.5f + y) + ec.contactYOffset; int targetLevel = Mth.floor(0.5f + y) + ec.contactYOffset;
Integer ecCurrentTargetY = ec.getCurrentTargetY(level); Integer ecCurrentTargetY = ec.getCurrentTargetY(level);
if (ecCurrentTargetY != null) if (ecCurrentTargetY != null)
targetLevel = ecCurrentTargetY; targetLevel = ecCurrentTargetY;
if (level.isClientSide()) if (level.isClientSide())
targetLevel = ec.clientYTarget; targetLevel = ec.clientYTarget;
if (!wasArrived && !level.isClientSide()) { if (!wasArrived && !level.isClientSide()) {
triggerContact(ec, targetLevel); triggerContact(ec, targetLevel - ec.contactYOffset);
AllSoundEvents.CONTRAPTION_DISASSEMBLE.play(level, null, worldPosition.below((int) offset), 0.75f, 0.8f); AllSoundEvents.CONTRAPTION_DISASSEMBLE.play(level, null, worldPosition.below((int) offset), 0.75f, 0.8f);
} }