Jump to content

[1.12.2] Update block after generated. [Closed]


Legenes

Recommended Posts

Hi!

 

I'm trying to make a block in my utility mod, that randomly generates another block from an array. My problem is that I use OpenTerrainGenerator for my "modpack" , so I don't need to write any worldGenerator. If it's placed via /setblock, /fill, or with hand, than it works fine. Is there a way to update this block without making a wGen for it?

Thanks for helping!

Edited by Legenes
procedure WakeMeUp(Integer plusTime);
var
  I: Integer;
begin
  for I := 0 to plusTime do begin
    println('One more minute!');
    Sleep(1000);
  end;
  println('Okay, nothing to worry, I''m alive!');
  println('So... somebody can give me a coffee?');
  println('I know it''s Pascal, and not Java, but I love it :D.');
end;
Link to comment
Share on other sites

I believe that OnBlockPlacedIntoWorld is called after its placed by worldgen.

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Which version of forge has this method? I can't find it within my Block's class.

EDIT: my forge version is: 14.23.5.2796.

Edited by Legenes
Missing version.
procedure WakeMeUp(Integer plusTime);
var
  I: Integer;
begin
  for I := 0 to plusTime do begin
    println('One more minute!');
    Sleep(1000);
  end;
  println('Okay, nothing to worry, I''m alive!');
  println('So... somebody can give me a coffee?');
  println('I know it''s Pascal, and not Java, but I love it :D.');
end;
Link to comment
Share on other sites

Might've changed, I might've remembered wrong.

 

public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It's not working, but I think it's because OTG does not call the event. Maybe it's generation is different than the vanilla one. I think if I add a world generator myself (I didn't wanted but not a big deal), it will work. Thanks anyway!

EDIT: Thanks @Draco18s, it worked with my own world generator code. Looks like OTG does not call that method. (Picture of the result: https://imgur.com/UyUkc6p)

Edited by Legenes
Closing topic.
procedure WakeMeUp(Integer plusTime);
var
  I: Integer;
begin
  for I := 0 to plusTime do begin
    println('One more minute!');
    Sleep(1000);
  end;
  println('Okay, nothing to worry, I''m alive!');
  println('So... somebody can give me a coffee?');
  println('I know it''s Pascal, and not Java, but I love it :D.');
end;
Link to comment
Share on other sites

OTG shouldn't have to, its called by world.setBlockState() automatically.

 

Ooh, never mind, Forge did things that make it not called. You could make your block declare that it has a tile entity (hasTileEntity returns true) but never actually supply one (returns from getTileEntity are null checked). That'd make onBlockAdded get called for your blocks.

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
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.
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...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



×
×
  • Create New...

Important Information

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