• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Adjustor mod plugin for VS


Commit MetaInfo

Revision7d71b09dbffc53984d7e2bf56ebadb61fc09f301 (tree)
Time2021-01-06 12:54:29
Authormelchior <melchior@user...>
Commitermelchior

Log Message

Corrected angle usage (for Radians)

Change Summary

Incremental Difference

--- a/AdjustorMod/Items/ItemAdjustor.cs
+++ b/AdjustorMod/Items/ItemAdjustor.cs
@@ -367,8 +367,15 @@ namespace AdjustorMod
367367 if (mabeyBE != null)
368368 {
369369 var someType = mabeyBE.GetType( );
370- if (someType.GetProperty(_meshAngleKey) != null) return true;
371- if (someType.GetField(_meshAngleKey) != null) return true;
370+ if (someType.GetProperty(_meshAngleKey) != null ||
371+ someType.GetField(_meshAngleKey) != null
372+ ) {
373+ #if DEBUG
374+ Logger.VerboseDebug("[{0}] apparently supports 'MeshAngle'", thatBlock.Code);
375+ #endif
376+ return true;
377+ }
378+
372379 }
373380
374381
@@ -668,15 +675,35 @@ namespace AdjustorMod
668675 /// <param name="position">Position.</param>
669676 private bool MeshRotation(RotationModes rotationModes, IPlayer thePlayer, Block thatBlock, BlockPos position)
670677 {//Context: SERVER!
671- bool rotateClockwise = rotationModes != RotationModes.West;
672678
673679 dynamic subjectBE = ServerApi.World.BlockAccessor.GetBlockEntity(position);
674-
675- if (rotateClockwise)
676- { subjectBE.MeshAngle += 45; }
677- else
678- { subjectBE.MeshAngle -= 45; }
679-
680+
681+ //Fix angle to
682+ switch (rotationModes) {
683+ case RotationModes.Free:
684+ subjectBE.MeshAngle += GameMath.DEG2RAD * 45;
685+ break;
686+ //UNIT IS RADIANS !
687+ case RotationModes.North:
688+ subjectBE.MeshAngle = GameMath.DEG2RAD * 0;
689+ break;
690+ case RotationModes.East:
691+ subjectBE.MeshAngle = GameMath.DEG2RAD * 90;
692+ break;
693+ case RotationModes.West:
694+ subjectBE.MeshAngle = GameMath.DEG2RAD * 270;
695+ break;
696+ case RotationModes.South:
697+ subjectBE.MeshAngle = GameMath.DEG2RAD * 180;
698+ break;
699+ default:
700+ subjectBE.MeshAngle -= GameMath.DEG2RAD * 45;
701+ break;
702+ }
703+ #if DEBUG
704+ Logger.VerboseDebug("[{0}] Mesh angle: {1}(RADs)", thatBlock.Code ,subjectBE.MeshAngle);
705+ #endif
706+
680707 subjectBE.MarkDirty(true);
681708
682709 return false;