-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[needs testing] Fix linear actuator offset logic and fix clamps to be of more logical value #8838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mc1.20.1/dev
Are you sure you want to change the base?
[needs testing] Fix linear actuator offset logic and fix clamps to be of more logical value #8838
Conversation
this change broke behavior at low rpm im looking into it |
If anyone does want to test this, please check the following entries
against
for pulleys and pistons, make sure to also check behavior when it does not fully extend nor retract |
I am pretty sure this pr also fixes the "up" bias that exists with rope pulleys but I only empirically verified this |
Hmm, would probably be also good to double-check technical hacks around them and see how those are affected. Would not be happy to say goodbye to the 2gt cobblegen :D |
@nopeless, this pull request has merge conflicts with the target branch. Please merge the latest changes and leave a message here so we can continue with the process of reviewing and merging this pull request. Thanks! |
this feature branch is actually complete, I just haven't gotten around to fully testing it in game because I don't have extensive knowledge on how this changes will interact with other mechanisms. I'll get around to rebasing to fit main tho |
Known issues
none atm
This is a three part fix
clamp(getSpeed(), -.49, .49)
around the code base forLinearActuatorBlockEntity
MechanicalPistonBlockEntity
GantryShaftBlockEntity
Collectively, these affect:
PulleyBlockEntity
extends LinearActuatorBEMechanicalPistonBlockEntity
extends LinearActuatorBE#getMovementSpeedGantryShaftBlockEntity
has its own clampHowever, this clamp affects rpms above 250 because
convertToLinear
divides rpm by 512, which means0.49 * 512 = 250.88
.Slightly related, but this 0.49 clamp is also responsible for the incorrect block speed in the fandom wiki as they used
(0.49 * 20) / 256 = 0.03828125
https://create.fandom.com/wiki/Gantry_Carriage
However, this clamp value did not make sense, so I changed it to 1 (as in maximum movement speed is 1 blocks per tick), and any value above 1 was unstable from my testing.
Create/src/main/java/com/simibubi/create/content/contraptions/piston/LinearActuatorBlockEntity.java
Lines 317 to 325 in e0c859a
where the code uses a newOffset, offset pair
Create/src/main/java/com/simibubi/create/content/contraptions/piston/LinearActuatorBlockEntity.java
Lines 124 to 130 in e0c859a
Create/src/main/java/com/simibubi/create/content/contraptions/ContraptionCollider.java
Lines 715 to 719 in e0c859a
Removing this check seems to produce correct behaviorThis is incorrect behavior. Imagine a contraption that is perfectly aligned with the world. It intersects only one block, not two. this is because positive direction requires
ceil
while negative direction requiresfloor
. This pr implements the ceil partI have tested RPMS up to 512 by changing the game config and rope pulleys, mechanical pistons, and gantry carriages all worked fine up to 512RPM.
However, this PR includes a rather big line change in
ContraptionCollider
and I have not tested how the other contraptions will behave to this change.TL;DR: fixed offset logic which allows linear actuator contraptions to stop at the correct block, especially at high rpms, adjust clamp so that it scales linearly up to 512RPM instead of 250RPM, removed possibly broken check for contraption colliding
TL;DR 2: there were more bugs related to integer alignments, specifically when contraptions were exactly aligned with the block, causing 256rpm to not behave correctly with linear actuators. That has also been addressed