Jump to content
  • Home
  • Files
  • Docs
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
  • Auto Register Tile Entities
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
TesterTesting135

Auto Register Tile Entities

By TesterTesting135, October 10, 2019 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

So, I'm making a 1.12.2 mod and would like a way to auto-register my tile entities. I have a list of them stored in an array, but I am having trouble getting the resource location of the tile entity. I've tried using tileEntity.getBlockType(), but that returns null. Is there a way I could do this?

  • Quote

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

It seems that the tile entity will still register even though the resource location is incorrect. Why is this?

  • Quote

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

Even in the tile entities class, if I do .blocktype, it returns null.

  • Quote

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

Essentially I need a method to return the tile entities registry name.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted October 10, 2019
16 minutes ago, TesterTesting135 said:

It seems that the tile entity will still register even though the resource location is incorrect. Why is this?

Probably a bug of some sorts. They might not serialized if its null.

Just now, TesterTesting135 said:

Essentially I need a method to return the tile entities registry name.

You have to make one your self.

 

2 minutes ago, TesterTesting135 said:

Even in the tile entities class, if I do .blocktype, it returns null.

Have you looked for where it is set to a value?

 

23 minutes ago, TesterTesting135 said:

I've tried using tileEntity.getBlockType(), but that returns null.

That's because getBlockType is a method that wraps to World#getBlockState at the tile entities position.

 

24 minutes ago, TesterTesting135 said:

but I am having trouble getting the resource location of the tile entity

You get to make it up your self it's an id.

 

Please don't spam your own thread.

  • Quote

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

Ok, sorry for spamming my own thread. I also tried making a method to get the registry name in the tile entity class, but it also returned null as this.blockType returns null.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted October 10, 2019
3 minutes ago, TesterTesting135 said:

but it also returned null as this.blockType returns null.

Well as I said have you looked to see where it is initialized? When does it get its value. My bet is when it is placed into the World.

 

7 minutes ago, Animefan8888 said:

You get to make it up your self it's an id.

Hint use the new keyword.

  • Quote

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019
2 minutes ago, Animefan8888 said:

Hint use the new keyword.

I understand how to make a resource location.

 

3 minutes ago, Animefan8888 said:

Well as I said have you looked to see where it is initialized? When does it get its value. My bet is when it is placed into the World.

The problem is, during the block registry world is null.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted October 10, 2019
2 minutes ago, TesterTesting135 said:

The problem is, during the block registry world is null.

Correct and there won't ever be one, and there also isnt a position that TileEntity is at in the world either.

 

3 minutes ago, TesterTesting135 said:

I understand how to make a resource location.

Ok then I dont know what your problem is.

  • Quote

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

My problem is that I want to automatically get the registry name of the tile entity without anything else (like the block), but i don't think there is a method for that.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    741

Animefan8888

Animefan8888    741

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 741
  • 6157 posts
Posted October 10, 2019
7 minutes ago, TesterTesting135 said:

My problem is that I want to automatically get the registry name of the tile entity without anything else (like the block), but i don't think there is a method for that.

No because a TileEntity can be placed at any position at any block. It just has to be created a new if that Block doesnt say it had a TileEntity. IE you can use the vanilla TileEntities on your blocks if you wanted to. The registry name is specific to the TileEntity. If you want you could use your Block field for the block in question and call Block#getRegistryName.

  • Quote

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Share this post


Link to post
Share on other sites

TesterTesting135    0

TesterTesting135

TesterTesting135    0

  • Creeper Killer
  • TesterTesting135
  • Members
  • 0
  • 105 posts
Posted October 10, 2019

Ooooh, that explains a lot. Thanks for clearing it up for me.

  • 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

    • Hubmac
      The item given to the player disappears

      By Hubmac · Posted 2 minutes ago

      Ok thanks, it works. I still have a question, how can I download "ServerPlayerEntity" in my case I convert "LivingEntity" to "ServerPlayerEntity" but is there any way to get "ServerPlayerEntity" from anywhere
    • Deadlocked47
      Can't get into forge discord

      By Deadlocked47 · Posted 3 minutes ago

      So I was in the forge project discord and I use it alot to see what new mods are being made and to get Help with mods. One of my friends came over to my house and i went downstairs to get something and left my pc on. while I was downstairs, he went into my discord account and spammed shrek images and got me banned from the forge discord. Is there any way to get a ban appeal or something like that, because I like and use that discord a lot. Thank you.
    • diesieben07
      I can't download 1.16.5 forge

      By diesieben07 · Posted 5 minutes ago

      Some zip managers like to take control of the .jar file extension away from Java. Make sure you have Java installed and try running Jarfix once, then try the installer again.
    • Lil Bub Ben
      I can't download 1.16.5 forge

      By Lil Bub Ben · Posted 10 minutes ago

      I have a windows 10 and every time I download the installer it wouldn't work unless it was a windows installer. and 1.16.5 doesn't have a Win installer. can somebody help me work around this.
    • Twu
      Need help with Potion Brewing recipes

      By Twu · Posted 33 minutes ago

      Thank you so much
  • Topics

    • Lil Bub Ben
      1
      I can't download 1.16.5 forge

      By Lil Bub Ben
      Started 5 minutes ago

    • Twu
      2
      Need help with Potion Brewing recipes

      By Twu
      Started 14 hours ago

    • Latobius
      3
      1.16.4 Can't connect to server, incomplete server tags.

      By Latobius
      Started 11 hours ago

    • Hubmac
      1
      The item given to the player disappears

      By Hubmac
      Started 1 hour ago

    • KBomb
      11
      Can't Connect to Forge 1.16.5 Server

      By KBomb
      Started Thursday at 11:58 PM

  • Who's Online (See full list)

    • diesieben07
    • lupicus
    • Unlucky
    • Hubmac
    • Aviator737
    • samjviana
    • Deadlocked47
    • Lil Bub Ben
    • Seika85
    • Pickle_Face5
    • czho
    • SubliminallySublime
    • Luis_ST
    • wilpito
    • Twu
    • NullDev
    • Differentiation
    • Tanguygab
    • blackviper2104
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Auto Register Tile Entities
  • Theme

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