Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I though I had found a workaround to this, but I didn't...So, is there a simple way to find a block somewhere in the world? It sounds simple, but it wont work. I want to teleport to a block in another dimension through my custom portal if that block exists. If not, create that block. I have the create a block working, but it always goes to that creating multiple instances of that block in the world right next to each other. It wont recognize that the block exists...Any Help?

How are you searching right now?

 

- - -

 

Wasn't there originally a thread for this?

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
  • Author

How are you searching right now?

 

- - -

 

Wasn't there originally a thread for this?

 

There was originally a thread by me, and I thought I found a workaround so I closed it. Now I realized it doesn't work. Right now I am using :

 

if(worldserver.getBlock(entity.chunkCoordX, entity.chunkCoordY, entity.chunkCoordZ) instanceof MyPortal)

 

It doesn't work

You are checking for a block at the chunk coord, not the player's coord. Check at the player's coord.

 

- - -

 

Also, don't close your thread if you think you've figured it out. Keep it there so people can learn from it.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
  • Author

You are checking for a block at the chunk coord, not the player's coord. Check at the player's coord.

 

- - -

 

Also, don't close your thread if you think you've figured it out. Keep it there so people can learn from it.

 

When I do entity.posX, entity.posY, and entity.posZ, it gives me an error, becuase those are doubles but getBlock needs integers.

 

Also, I didn't realize that, next time I will keep my thread open :)

Learn Java. Learn how to cast. Then, it won't be an issue.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
  • Author

Learn Java. Learn how to cast. Then, it won't be an issue.

 

I did that, And I even put a println to see if it works and it doesnt do it

 

if(worldserver.getBlock((int)entity.posX, (int)entity.posY, (int)entity.posZ) instanceof HeavenPortal){

    System.out.println("Hello199282");

Then it's not being called. (I'd also make it:

 

(int)Math.floor(entity.posX)

 

to avoid rounding issues)

 

Is the method being called at all?

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
  • Author

Then it's not being called. (I'd also make it:

 

(int)Math.floor(entity.posX)

 

to avoid rounding issues)

 

Is the method being called at all?

 

It is inside the onEntityCollidedWithBlock, which I know works because I can add the teleport line of code and it teleports the player to another dimension when they walk into the block. It just isn't working with this...

Try to print out the name of the block that you do get at that position.

 

Also, if you have it in onEntityCollidedWithBlock why would you check the entity position?  Wouldn't the entity position be same as the block that it just collided with?

 

(Aside: do you really want all entities to be teleported?  If not you might want to check that the entity is a player entity as well.)

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Try to print out the name of the block that you do get at that position.

 

Also, if you have it in onEntityCollidedWithBlock why would you check the entity position?  Wouldn't the entity position be same as the block that it just collided with?

 

(Aside: do you really want all entities to be teleported?  If not you might want to check that the entity is a player entity as well.)

About the onEntityCollidedWithBlock ith block method: yes, the round-of values are thesame coords, but the posX,posY and posZ are doubles so they can be like 6.333, which means it's about a third on that coordinate, so you can be a bit more specific, In this case it might not be useful, but it could be for others.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.