55import com .jelly .farmhelper .player .Rotation ;
66import com .jelly .farmhelper .utils .*;
77import com .jelly .farmhelper .world .GameState ;
8- import jline .internal .Log ;
98import net .minecraft .client .Minecraft ;
109import net .minecraft .init .Blocks ;
1110import net .minecraft .util .BlockPos ;
@@ -112,18 +111,21 @@ public void onTick() {
112111 updateState ();
113112 lastState = currentState ;
114113
115- if (currentState != State .TPPAD )
114+ if (currentState != State .TPPAD ) {
116115 rotation .lockAngle (playerYaw , 0 );
116+ }
117117
118118 switch (currentState ) {
119119 case TPPAD :
120120
121121 if (BlockUtils .getRelativeBlock (0 , 0 , 0 ).equals (Blocks .end_portal_frame )) {
122122 if (mc .thePlayer .posY % 1 == 0.8125 ) {
123123 if (isWalkable (getRelativeBlock (1 , 0.1875f , 0 ))) {
124+ playerYaw = AngleUtils .get360RotationYaw (AngleUtils .getClosest ());
124125 LogUtils .debugFullLog ("On top of pad, go right" );
125126 updateKeys (false , false , true , false , true );
126127 } else if (isWalkable (getRelativeBlock (-1 , 0.1875f , 0 ))) {
128+ playerYaw = AngleUtils .get360RotationYaw (AngleUtils .getClosest ());
127129 LogUtils .debugFullLog ("On top of pad, go left" );
128130 updateKeys (false , false , false , true , true );
129131 } else {
@@ -166,7 +168,7 @@ public void onTick() {
166168 if (!rotation .completed ) {
167169 if (!rotation .rotating ) {
168170 if (mc .thePlayer .posY - mc .thePlayer .lastTickPosY == 0 ) {
169- LogUtils .debugFullLog ("Rotating 180" );
171+ LogUtils .debugFullLog ("Rotating " + getRotateAmount () );
170172 rotation .reset ();
171173 playerYaw = AngleUtils .get360RotationYaw (playerYaw + getRotateAmount ());
172174 rotation .easeTo (playerYaw , 0 , 2000 );
@@ -196,7 +198,12 @@ public void onTick() {
196198
197199 private void updateState () {
198200 BlockPos blockInPos = new BlockPos (mc .thePlayer .posX , mc .thePlayer .posY , mc .thePlayer .posZ );
199- if (BlockUtils .getRelativeBlock (0 , -1 , 0 ).equals (Blocks .end_portal_frame ) || BlockUtils .getRelativeBlock (0 , 0 , 0 ).equals (Blocks .end_portal_frame ) || (currentState == State .TPPAD )) {
201+
202+ if (lastState == State .TPPAD && BlockUtils .getRelativeBlock (0 , -1 , 0 ) != Blocks .end_portal_frame && BlockUtils .getRelativeBlock (0 , 0 , 0 ) != Blocks .end_portal_frame ){
203+ currentState = calculateDirection ();
204+ rotation .reset ();
205+ }
206+ if (BlockUtils .getRelativeBlock (0 , -1 , 0 ).equals (Blocks .end_portal_frame ) || BlockUtils .getRelativeBlock (0 , 0 , 0 ).equals (Blocks .end_portal_frame )) {
200207 currentState = State .TPPAD ;
201208 return ;
202209 }
@@ -216,8 +223,6 @@ private void updateState() {
216223 currentState = BlockUtils .isWalkable (BlockUtils .getLeftBlock ()) ? State .LEFT : State .RIGHT ;
217224 return ;
218225 }
219- /* LogUtils.debugFullLog(gameState.leftWalkable + " " + gameState.rightWalkable + " " + (blockInPos.getX() != targetBlockPos.getX()) + " " + (blockInPos.getZ()!=targetBlockPos.getZ()) + " " +
220- gameState.dx + " " + gameState.dz);*/
221226
222227 if ((!gameState .leftWalkable || !gameState .rightWalkable ) &&
223228 (blockInPos .getX () != targetBlockPos .getX () || blockInPos .getZ () != targetBlockPos .getZ ()) &&
0 commit comments