Posted July 29, 20196 yr 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?
July 30, 20196 yr Author 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?
July 30, 20196 yr Author 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)?
July 30, 20196 yr Author 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.
July 30, 20196 yr Author Alright, this is clearly going nowhere. I'm just going to extend the WorldGenMinable class and override a method.
July 30, 20196 yr Author Didn't notice the StonePredicate class before. Made an EndStonePredicate class, passed that as an argument and now everything works fine.
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.