Generating Structure at Dimension Spawn

Started by trashoflevillage on Sun, 10/13/2019 - 00:27

Topic category: Bugs and solutions

Last seen on 05:19, 9. Nov 2019
Joined Dec 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Generating Structure at Dimension Spawn
Sun, 10/13/2019 - 00:27

Hello! I am trashoflevillage, but you know that (since it is my username.) I am creating a mod based around a unique dimension that has no portal, and when you enter it you spawn inside of a structure, but no matter how hard I try, I cannot get a structure to spawn at the dimension spawn, so I tried spawning the structure at 0 50 0 and teleporting the player there.. the structure generates but the player does not teleport. Let me know any solutions!

Last seen on 20:00, 13. Nov 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
First of all, you'll need to…
Sun, 10/13/2019 - 01:11

First of all, you'll need to get the player coordinates. You can use Entity number NBT tags for that. To get perfect entity coordinates, use this strategy: https://mcreator.net/forum/53539/solving-coordinates-changed-offset-1

Now spawn the structure at those coordinates upon the player entering the dimension. If this doesn't work and the structure spawns in the overworld at the coordinates you are now in inside of your dimension, then you can use a Logic NBT tag to disable the structure from spawning the moment you enter it, and ensure you first check whether the player is in the right dimension ID, before setting it to true. Setting it to true should then spawn your structure at the location of the player that you have stored inside of NBT tags.

Last seen on 05:19, 9. Nov 2019
Joined Dec 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I've tried using the…
Sun, 10/13/2019 - 04:19

I've tried using the strategy you gave me, but it unfortunately causes compiling errors. Is there any way to fix this?

Last seen on 05:19, 9. Nov 2019
Joined Dec 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I forgot to put the…
Sun, 10/13/2019 - 04:22

I forgot to put the compiling logs in my other reply, and I cannot find an edit button so I'll put them here:

Executing gradle command: build
Build info: MCreator 1.9.1, 64-bit, 8071 MB, Windows 10 - cmd, JVM 1.8.0_222, JAVA_HOME: C:\Program Files\Pylo\MCreator\jdk
C:\Users\fnafl\MCreatorWorkspaces\the_highlands>gradlew -Dorg.gradle.java.home="C:/Program Files/Pylo/MCreator/jdk" -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs="-Xms625m -Xmx2048m" build 
This mapping 'snapshot_20171003' was designed for MC 1.12! Use at your own peril.
:deobfCompileDummyTask
:deobfProvidedDummyTask
:sourceApiJava UP-TO-DATE
:compileApiJava NO-SOURCE
:processApiResources NO-SOURCE
:apiClasses UP-TO-DATE
:sourceMainJava
C:\Users\fnafl\MCreatorWorkspaces\the_highlands\build\sources\main\java\net\mcreator\the_highlands\MCreatorEnterHighlands.java:30: error: variable x is already defined in method executeProcedure(HashMap)
      double x = 0;
             ^
C:\Users\fnafl\MCreatorWorkspaces\the_highlands\build\sources\main\java\net\mcreator\the_highlands\MCreatorEnterHighlands.java:31: error: variable z is already defined in method executeProcedure(HashMap)
      double z = 0;
             ^
C:\Users\fnafl\MCreatorWorkspaces\the_highlands\build\sources\main\java\net\mcreator\the_highlands\MCreatorEnterHighlands.java:33: error: incompatible types: possible lossy conversion from double to int
         x = (double) (x - 1);
             ^
C:\Users\fnafl\MCreatorWorkspaces\the_highlands\build\sources\main\java\net\mcreator\the_highlands\MCreatorEnterHighlands.java:35: error: incompatible types: possible lossy conversion from double to int
         x = (double) x;
             ^
C:\Users\fnafl\MCreatorWorkspaces\the_highlands\build\sources\main\java\net\mcreator\the_highlands\MCreatorEnterHighlands.java:38: error: incompatible types: possible lossy conversion from double to int
         z = (double) (z - 1);
             ^
C:\Users\fnafl\MCreatorWorkspaces\the_highlands\build\sources\main\java\net\mcreator\the_highlands\MCreatorEnterHighlands.java:40: error: incompatible types: possible lossy conversion from double to int
         x = (double) z;
             ^
6 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
5 actionable tasks: 4 executed, 1 up-to-date
C:\Users\fnafl\MCreatorWorkspaces\the_highlands>

variable x is already…
Sun, 10/13/2019 - 10:34

variable x is already defined

Avoid using variable names the same as dependencies as this will not work. You have dependencies called x, y,  z, world, entity, so there names should not be used with local variables.

Last seen on 05:19, 9. Nov 2019
Joined Dec 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
If this doesn't work and the…
Fri, 10/18/2019 - 05:44

If this doesn't work and the structure spawns in the overworld at the coordinates you are now in inside of your dimension, then you can use a Logic NBT tag to disable the structure from spawning the moment you enter it, and ensure you first check whether the player is in the right dimension ID, before setting it to true. Setting it to true should then spawn your structure at the location of the player that you have stored inside of NBT tags.

This is what is happening, but I'm not sure on what you mean by Logic NBT tags. Did you mean Logic Variables? I've heard of NBT, just not Logic NBT. I also cannot find anything that detects what dimension the player is in. I know my Dimension ID.

Last seen on 05:19, 9. Nov 2019
Joined Dec 2018
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Nevermind! I figured it out.
Sat, 10/19/2019 - 01:19

Nevermind! I figured it out.