• 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

Revision94eb9f434399b311e5f0a5b8e2ccdb9a0a6ed180 (tree)
Zeit2019-05-10 09:28:19
Autormelchior <melchior@user...>
Commitermelchior

Log Message

Fixes for V1.9.2, got wooden logs rotatable.

Ändern Zusammenfassung

Diff

--- a/AdjustorMod/ItemAdjustor.cs
+++ b/AdjustorMod/ItemAdjustor.cs
@@ -31,19 +31,24 @@ namespace Adjustor
3131 @"north",
3232 @"south",
3333 @"east",
34- @"west"
35- };//mabey add: ns, ew, ect...?
34+ @"west",
35+ //tree logs
36+ @"ud",
37+ @"ns",
38+ @"we"
39+ };
3640
3741 private static string[] blacklistedClasses =new string[]
3842 {
3943 @"BlockBed",
4044 @"BlockDoor",
4145 @"BlockTroughDoubleBlock",
46+ @"BlockFence" //Need to figure out a better way..
4247 };
4348
4449 private static string[] whitelistedClasses =new string[] //BROEKN!
4550 {
46- @"BlockFence",
51+ @"placeholder",
4752 };
4853
4954 private static string[] blacklistedEntityClasses =new string[]
@@ -53,7 +58,7 @@ namespace Adjustor
5358
5459 public ItemAdjustor( ) : base()
5560 {
56- //TODO: Fixed rotateion mode VS. Free-Rotation
61+ //TODO: Fixed rotation mode VS. Free-Rotation
5762 }
5863
5964 public override void OnLoaded(ICoreAPI api)
@@ -178,16 +183,13 @@ namespace Adjustor
178183 ServerApi.SendMessage( thePlayer, GlobalConstants.CurrentChatGroup, "Angle N/E/W/S.", EnumChatType.Notification );
179184 #endif
180185
181- //Special Case for Slabs in N/E/S/W mode when trying to rotate them back 'up'
182- if ( IsSlabUD(thatBlock) ) {
183- #if DEBUG
184- Logger.VerboseDebug( "{0} Invokes Slab Special U/D case", thatBlock.Code );
185- #endif
186+ //So many HORIZONTAL Special Cases...
187+ renamedAsset = thatBlock.GetRotatedBlockCode(90);//Except Fences
188+
189+ if (IsSlabUD(thatBlock)) renamedAsset = SpecialSlabHorizontalFlipCase( thatBlock );
190+
191+ if (IsWoodLog(thatBlock)) renamedAsset = WoodOmniFlip( thatBlock , blockSel.Face.Axis, rotateHorizontal); //Wood logs also special
186192
187- renamedAsset = SpecialSlabHorizontalFlipCase( thatBlock );
188- } else {
189- renamedAsset = thatBlock.GetRotatedBlockCode(90);//Except Fences
190- }
191193
192194 if (renamedAsset != thatBlock.Code) {
193195 #if DEBUG
@@ -206,16 +208,12 @@ namespace Adjustor
206208 ServerApi.SendMessage( thePlayer, GlobalConstants.CurrentChatGroup, "Angle U/D.", EnumChatType.Notification );
207209 #endif
208210
211+ renamedAsset = thatBlock.GetVerticallyFlippedBlockCode( );
212+
209213 //Special Case for Slabs in N/E/S/W mode when trying to rotate them back 'up'
210- if ( IsSlabNEWS(thatBlock) ) {
211- #if DEBUG
212- Logger.VerboseDebug( "{0} Invokes Slab Special N/E/W/S case", thatBlock.Code );
213- #endif
214+ if ( IsSlabNEWS(thatBlock) ) renamedAsset = SpecialSlabVerticalFlipCase( thatBlock );
214215
215- renamedAsset = SpecialSlabVerticalFlipCase( thatBlock );
216- } else {
217- renamedAsset = thatBlock.GetVerticallyFlippedBlockCode( );
218- }
216+ if (IsWoodLog(thatBlock)) renamedAsset = WoodOmniFlip( thatBlock , blockSel.Face.Axis,rotateHorizontal ); //Wood logs also special
219217
220218 if (renamedAsset != thatBlock.Code) {
221219
@@ -271,7 +269,7 @@ namespace Adjustor
271269 }
272270
273271 /// <summary>
274- /// Is it Rotatable, possibly?
272+ /// Is it Rotatable, possibly with Known direction?
275273 /// </summary>
276274 /// <returns><c>true</c>, if rotatable, <c>false</c> otherwise.</returns>
277275 /// <param name="thatBlock">A block.</param>
@@ -297,7 +295,7 @@ namespace Adjustor
297295 }
298296
299297 /// <summary>
300- /// Is it Rotatable, possibly?
298+ /// Is it Rotatable, possibly via Behavior?
301299 /// </summary>
302300 /// <returns><c>true</c>, if rotatable, <c>false</c> otherwise.</returns>
303301 /// <param name="thatBlock">A block.</param>
@@ -356,6 +354,43 @@ namespace Adjustor
356354 return new AssetLocation(thatBlock.Code.Domain,redirectionPath);//game or item tags?
357355 }
358356
357+ private static AssetLocation WoodOmniFlip(Block thatBlock, EnumAxis axis, bool axisNormal)
358+ {
359+ string oppositeDirection = string.Empty;
360+
361+ //wood Log by: ns / we - change to opposite
362+ string directionName = thatBlock.Code.Path.Split( "-".ToCharArray( ) ).Last( );
363+ if ( axisNormal ) {
364+ switch(directionName) {
365+ case @"ud":
366+ oppositeDirection = (axis == EnumAxis.X || axis == EnumAxis.Z) ? @"ns" : @"we";
367+ break;
368+ case @"ns":
369+ oppositeDirection = (axis == EnumAxis.Y) ? @"ud" : @"we";
370+ break;
371+ case @"we":
372+ oppositeDirection = (axis == EnumAxis.Y) ? @"ud" : @"ns";
373+ break;
374+ }
375+ } else {
376+ switch(directionName) {
377+ case @"ud":
378+ oppositeDirection = (axis == EnumAxis.X) ? @"ns" : @"we";
379+ break;
380+ case @"ns":
381+ oppositeDirection = @"ud";
382+ break;
383+ case @"we":
384+ oppositeDirection = @"ud";
385+ break;
386+ }
387+ }
388+
389+ var redirectionPath = thatBlock.Code.Path.Replace(directionName,oppositeDirection );
390+
391+ return new AssetLocation(thatBlock.Code.Domain,redirectionPath);
392+ }
393+
359394 /// <summary>
360395 /// Determines if is slab in N/E/W/S configuration
361396 /// </summary>
@@ -398,6 +433,11 @@ namespace Adjustor
398433 }
399434 return false;
400435 }
436+
437+ private static bool IsWoodLog(Block thatBlock)
438+ {
439+ return thatBlock.Code.FirstPathPart( 0).StartsWith(@"log" );
440+ }
401441 }
402442
403443
--- a/AdjustorMod/modinfo.json
+++ b/AdjustorMod/modinfo.json
@@ -1,11 +1,11 @@
11 {
22 "type": "code",
33 "name": "Adjustment Tool",
4- "description" : "Alter, Rotate blocks without breaking them.",
4+ "description" : "Alter, Rotate blocks without breaking them. (Even wood-logs)",
55 "authors": ["Melchior", ],
6- "version": "0.1.5",
6+ "version": "0.1.6",
77 "dependencies": {
8- "game": "1.9.0",
8+ "game": "1.9.2",
99 "survival": ""
1010 },
1111 "website": "http://nowebsite.nope"