Jump to content

[1.12.2] Not sure on Predicate<IBlockState> initialization


Recommended Posts

Posted

So I was trying to create ores for the end, and I noticed that the constructor for the WorldGenMinable had a third argument which I'm assuming which blocks can be replaced. I'm referring to the "Predicate<IBlockState>". The problem is that I don't know how to use predicate.

 

Assuming my IBlockState is

Blocks.END_STONE.getDefaultState()

How would I turn this into a Predicate?

Posted
5 hours ago, diesieben07 said:

...provide something that returns true when the block passed in is the one you want to replace.

That's the reason I made this topic, I've never even seen a predicate before, and I don't know what to pass it.

I saw this as an example of initializing a predicate:

Predicate<String> allCaps = new Predicate<String>();

The problem is that it's giving me an error that "Cannot instantiate the type Predicate<String>". So how am I supposed to initialize it correctly?

Posted
4 hours ago, diesieben07 said:

Predicate is an interface. If you do not know what an interface is or how it works, you need to learn basic Java first.

https://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html

Also relevant (but you should probably just read all of those tutorials if you don't know Java):

https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html

 

Please stop acting like I've had 0 experience with Java, it doesn't help at all. I know enough Java to make a competent program with it.

 

So with that said, I have two questions:

1. I've only really seen the <> brackets used with ArrayList. What exactly did they do again?

2. Given that Predicate is an interface, are there any classes that implement it (specifically minecraft classes)?

Posted
34 minutes ago, diesieben07 said:

Use your IDE. 

Ok, so I'm using eclipse. I've barely used it before, so I don't know much about it.

 

Also, why can't you just send a line of code that properly initializes the Predicate<IBlockState>? I'm guessing it'll be just one line, like most initializations, and it's getting kind of annoying when this topic could've been solved in one comment.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So am trying to make a custom 1.19.2 modpack and everything works until I add Oculus. I have tried Oculus+Embedium and Oculus+Rubdium and by themselves they work but as soon as I add anything it crashes no matter what it is. The modpack works fine with just Embedium and Rubdium. Can you help me to see if this is something i can fix or do i just have to deal with not having shaders. Here is the crash log. Thank you for your time. https://paste.ee/p/WXfNZ24K
    • What do I do now when it says "1 error"?
    • Hello everyone new here how are you all?
    • I haven't tested it but under https://minecraft.wiki/w/Items_model_definition it says now:   So I guess the resource location must have changed with 1.24.4, which means you need to move your models/item/ to the new source. But as I said I haven't tested this so it also may be that this wont work. Nevertheless give it a try      EDIT (important) So now I tested it and found out how it works   Let the model files (e.g. the .json from blockbench) within "assets/<your_mod_id>/models/item" In addition to that do the following: Every model you added will need a new file under "assets/<your_mod_id>/items" That file is also a JSON and looks like this: { "model": { "type": "minecraft:model", "model": "your_mod_id:item/custom_item" } } - "type" can be minecraft:model, minecraft:composite, minecraft:condition, minecraft:select, minecraft:range_dispatch, minecraft:empty, minecraft:bundle/selected_item or minecraft:special. (In most cases you would need minecraft:model) - "model" is the path to your actual model for this item. For example the value above would point to "assets/your_mod_id/models/item/custom_item"
  • Topics

×
×
  • Create New...

Important Information

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