Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14.4](Solved) Get position offset by axis
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
Brbcode

[1.14.4](Solved) Get position offset by axis

By Brbcode, September 21 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Brbcode    1

Brbcode

Brbcode    1

  • Tree Puncher
  • Brbcode
  • Members
  • 1
  • 37 posts
Posted September 21 (edited)

I want get the value of two BlockPos, the first one would correspond to the positive value of the axis while the second would correspond to the negative value of the axis.

Is any short way to archive this?

________ -> axis -> _____________ 

| second_block -> pos -> first_block |

-------------------------------------------------

I have the following vars:

Wold world;

BlockPos pos; //Position of block that i want apply the offset.

Direction.Axis axis; //The axis that specifies the orientation of block.

Edited September 21 by Brbcode
  • Quote

Share this post


Link to post
Share on other sites

DavidM    102

DavidM

DavidM    102

  • World Shaper
  • DavidM
  • Members
  • 102
  • 1135 posts
Posted September 21

You can check which one of the 3 axis of the 2 blockposes are not equal.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted September 21
14 minutes ago, Brbcode said:

Is any short way to archive this?

No there is no short way to achieve this, You'll either have to use an if statement or a switch statement.

  • Quote

Share this post


Link to post
Share on other sites

Brbcode    1

Brbcode

Brbcode    1

  • Tree Puncher
  • Brbcode
  • Members
  • 1
  • 37 posts
Posted September 21
Just now, Animefan8888 said:

No there is no short way to achieve this, You'll either have to use an if statement or a switch statement.

It's a shame, thank you I think i will do a for with all direction values and test each one with my axis and save block on vector or something similar.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted September 21
Just now, Brbcode said:

for with all direction values and test each one with my axis and save block on vector or something similar.

If you are gonna do that you might as well create a Map that maps the Axis values to it's Direction values.

  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Brbcode    1

Brbcode

Brbcode    1

  • Tree Puncher
  • Brbcode
  • Members
  • 1
  • 37 posts
Posted September 21
2 minutes ago, Animefan8888 said:

If you are gonna do that you might as well create a Map that maps the Axis values to it's Direction values.

Mmm.. I can do a map<axis,pair<direction>>. Good idea I like it.

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • SilviaX_92
      Forge having problem loading mods

      By SilviaX_92 · Posted 2 hours ago

      Hi DaemonUmbra, I think I was told to do that by the Pixelmon installation instruction but apparently I misunderstood the wording...   I tried and it worked! Thank you so so much you saved me from a Minecraft without Mods!   Have a wonderful day/night!
    • Draco18s
      MoonPhase help

      By Draco18s · Posted 3 hours ago

      Events don't return values. Second, I'm pretty sure getMoonPhase() is client side only.
    • GatoLeyo
      MoonPhase help

      By GatoLeyo · Posted 3 hours ago

      Im new at modding so probably this have an obvious error but plz somebody tell me how can i make this works, it is intended to return a value in relation to the moon phase       public float endWorldTick(TickEvent.WorldTickEvent event)      {         float x = 0;         if(event.side.isServer() && event.phase == TickEvent.Phase.END)          {             World world = event.world;             if(world.provider.getDimension() == 0) {                 if(world.getMoonPhase() == 1.0f)                  {                   x = 15.0f;                 }             }         }         return x;     }  
    • DaemonUmbra
      Can't see anything on minecraft menu screen except for the bottom left corner

      By DaemonUmbra · Posted 3 hours ago

      Please don't Necro old threads, if you have an issue make your own.
    • DaemonUmbra
      Forge having problem loading mods

      By DaemonUmbra · Posted 3 hours ago

      You changed "Game Directory" to your mods folder. The Game Directory is supposed to be the folder that contains the mods folder, .minecraft by default
  • Topics

    • SilviaX_92
      4
      Forge having problem loading mods

      By SilviaX_92
      Started 7 hours ago

    • GatoLeyo
      1
      MoonPhase help

      By GatoLeyo
      Started 3 hours ago

    • florgonn
      4
      Can't see anything on minecraft menu screen except for the bottom left corner

      By florgonn
      Started July 30, 2014

    • Casual
      1
      1.12.2 crash on game start

      By Casual
      Started 4 hours ago

    • PulseBeat_02
      14
      [1.12.2] Forge Crashes While Just Loading Into Loading Screen

      By PulseBeat_02
      Started December 13, 2018

  • Who's Online (See full list)

    • DaemonUmbra
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.14.4](Solved) Get position offset by axis
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community