Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Posts posted by SeptemberBlue

  1. 3 minutes ago, Animefan8888 said:

    You need to add a dummy BooleanProperty to your BlockState.

    So wait, do I add that to my BlockState json?


    3 minutes ago, Animefan8888 said:

    No that won't do anything. 

    How would that not do anything? I was thinking I'd add an if statement to the readNBT part that checks if the colour changed, and if it did, call the event to change accordingly. Or are you saying that if I did try to call the event, nothing would happen?

  2. Alright, it seems to be picking the color of the block, which is good. What's weird though is that I can't change the color. I've used blockdata to try change the color value to something else, but when I check the block again, the color value reset.


    the class:

    public class TileEntityCanvas extends TileEntity {
    	private int color;
    	public TileEntityCanvas() {
    	public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    		compound.setInteger("color", color);
    		return compound;
    	public void readFromNBT(NBTTagCompound compound) {
    	public int getColor() {
    		return color;
    	public void setColor (int c) {

    EDIT: Pretty sure this has to do with the writeToNBT, will add an if statement to check if the "color" value changed. Looking for a method that gets an NBT value.


    EDIT 2:

    	public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    		if (!compound.hasKey("color") || compound.getInteger("color") != color) compound.setInteger("color", color);
    		return compound;

    For some reason, the color variable still won't change.

  3. 14 minutes ago, Animefan8888 said:

    This is what you should do. There is no pre-existing method.


    14 minutes ago, Animefan8888 said:

    You don't really know what a lambda expression is. Go read up on them seriously, they are greatly useful.

    My basic understanding of them so far is that you give them the parameters of a function, and then on the other side give it a return value. Will read up on them more though.

    14 minutes ago, Animefan8888 said:

    Do you know how to call a method?

    TileEntity getTileEntity(BlockPos pos);

    Not when it looks like this (from IBlockAccess).


    EDIT: DAMMIT, never thought to use the arguments from the method. I might be able to solve my own problem here.

  4. 1 minute ago, Animefan8888 said:

    If it's in the TileEntity you have access to the IBlockAccess and the BlockPos. You can get the TileEntity and then access your field for the color.

    Before I attempt any of the above, my TileEntity's color variable is private. Should I make a get method, or should I use some preexisting method?


    As for what you've said, I'm not entirely sure how to go about it. I see that IBlockAccess has a getTileEntity() method, and that takes a BlockPos. I don't really know how I'm supposed to put those together though. Can I use a lambda expression for IBlockAccess, even if it has other methods?

  5. 2 minutes ago, Animefan8888 said:

    Look it up. This is not a Java forum. Your IDE should be giving you a red underline right underneath that. Which is a clear clue that it is a Java issue.

    I'm still not clear which part exactly is wrong.


    Am I supposed to create a class that implements the interface? Should I give its method the correct arguments? Or is creating an instance not the same as initializing?

  6. 1 minute ago, Animefan8888 said:

    Are you trying to call the method? That's not what you are supposed to do. You need to create an IBlockColor instance and register it.

    public static void registerBlockColors(final ColorHandlerEvent.Block event) {
    	event.getBlockColors().registerBlockColorHandler(new IBlockColor.colorMultiplier(0,0,0,0), ModBlocks.CANVAS);

    So how do I register this interface?

  7. 6 hours ago, diesieben07 said:

    What are you talking about?

    public interface IBlockColor
        int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex);

    The method takes an IBlockState, an IBlockAccess, a BlockPos, and an int. I'm going to set the tintIndex to 0, since that corresponds with the json files. As for the other three, I'm probably going to want the IBlockState, IBlockAccess, and BlockPos for all blocks that need to be coloured (canvas blocks in this case)

  8. 54 minutes ago, diesieben07 said:
    • Events are explained in the documentation.
    • You need to subscribe to ColorHandlerEvent.Block, get the BlockColors instance from the event and then register your IBlockColor.
    • Yes, IBlockColor definitely exists, it is in the net.minecraft.client.renderer.color package.

    (First off thanks for the documentation!)


    As for the other two points, I have this so far:

    public static void registerBlockColors(final ColorHandlerEvent.Block event) {
    	event.getBlockColors().registerBlockColorHandler(blockColor, ModBlocks.CANVAS);

    I'm going to replace blockColor. Since IBlockColor is an interface, do I need to make a class that implements it?

  9. 1 hour ago, diesieben07 said:

    Subscribe to ColorHandlerEvent.Block and register an IBlockColor instance for your block.

    I'm not entirely sure how I'd do this. I see that I have code like this:

    	public static void onBlockRegister(RegistryEvent.Register<Block> event) {
    		event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0]));

    So I'm guessing I'd do something similar.


    Is this on the right track, or do I have this all wrong? Also, anything I should look at to get a better understanding of what you mean?

    EDIT: I've found this topic here. I know it's for a later version, but I'm assuming it'll also work for 1.12.2. Looking at their solution there, I have two questions. First off, what does the register method take? I was guessing the variable for the block plus an int for the colour, but that didn't seem to work. Also where can I find the main event bus? Is it that init thing?


    EDIT 2: IBlockColor doesn't seem to exist. Do I have to create it?

  10. 10 minutes ago, diesieben07 said:

    There are two versions of registerTileEntity. Only one is deprecated.

    I really do not know how you can miss this, do you not use your IDE?

    I see two methods, but both appear with strike through. The first two arguments are the same, but one takes a String and the other takes a Resource Location. Am I supposed to use the one with the latter?

    EDIT: Yep, changed the second argument and the method no longer appears with a strike through. Thanks!


    As for your other comment, the only time I've used my IDE (eclipse) is for when I wanted to work on my minecraft mod. So yeah, I don't know too much about my IDE. I've figured some things out though, so I'm not completely clueless.

  11. I can't really figure out what I need to do in order to colour a block. I've seen some methods that return the colour of a block, and I saw the Block class had a recolorBlock method, but I'm still not entirely sure what I'd have to do.


    EDIT: so to give the block a colour value, I gave it a TileEntity class. Only issue is,


    This appears to be deprecated, so I'm not sure what I'm supposed to replace it with (assuming I should).

  12. 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.

  13. 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.


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



    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)?

  14. 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?

  15. 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


    How would I turn this into a Predicate?

  • Create New...

Important Information

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