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


  • Posts

  • Joined

  • Last visited

Everything posted by SeptemberBlue

  1. Before I attempt block states, is there another approach I could do? As in, refresh the block so it does the event again? EDIT: one other issue I just realized. I'll need to set the item colour, but I'm not sure how I'd go from ItemStack to TileEntity.
  2. So wait, do I add that to my BlockState json? 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?
  3. Ok, I've fixed up the code so that the colour does change now, but the block does not actually change colour. Is there some way I can call the event every time the color gets updated?
  4. 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() { } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("color", color); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); } public int getColor() { return color; } public void setColor (int c) { color=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: @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(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.
  5. Done. 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. @Nullable 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.
  6. 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?
  7. Sweet, set up the lambda expression, gave it a colour, and now everything works fine! Only issue now is that I want the colour to be set based on the NBT tag of the block, since I made it a tile entity with a color tag. How would I access the tag?
  8. I was trying to follow what he said, which would mean that it's not a correct lambda expression. Good to know.
  9. 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?
  10. new IBlockColor.colorMultiplier(0,0,0,0) How is this not a new instance?
  11. @SubscribeEvent 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?
  12. @SideOnly(Side.CLIENT) 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)
  13. Alright, so for the interface, it needs an IBlockState, IBlockAccess, and a BlockPos (also needs an int but that's easy). Are there any methods that I can call for these?
  14. (First off thanks for the documentation!) As for the other two points, I have this so far: @SubscribeEvent 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?
  15. I'm not entirely sure how I'd do this. I see that I have code like this: @SubscribeEvent 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?
  16. Ok, so now I have my block that's a TileEntity, and it has its own color variable. There's that, and then I set the TintIndex for some of the faces to 0 for the block model. Is there a method I could use which would add a colour overlay to faces with a TintIndex of 0? Also, if I should use that, what should I use in its place?
  17. 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.
  18. 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, GameRegistry.registerTileEntity() This appears to be deprecated, so I'm not sure what I'm supposed to replace it with (assuming I should).
  19. Didn't notice the StonePredicate class before. Made an EndStonePredicate class, passed that as an argument and now everything works fine.
  20. Alright, this is clearly going nowhere. I'm just going to extend the WorldGenMinable class and override a method.
  21. 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.
  22. 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)?
  23. 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?
  24. 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?
  25. Alright, then I think that's everything. Suppose this can be locked now.
  • Create New...

Important Information

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