Siqhter
Members-
Posts
149 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Siqhter
-
Then just loop through the slots and check if any are empty. I think you can check for ItemStack.isEmpty().
-
By full do you mean full stacks or just an occupied slot?
-
If you take a look at ItemEnderPearl's class, it uses a cooldown. I know this is different than what you have, but the end result should be what you're looking for. playerIn.getCooldownTracker().setCooldown(this, 20);
-
I had looked at it yesterday, and didn't understand what the code in the FORGE START section did, but I do know and finally got it working. For blocks with tileentities, do you really need the 3 methods all the time?
-
I was working on this getDrops method, but everytime I broke a block the console threw a NullPointerException error. I fixed that, but now the block isn't returning the correct blockstate color from the tileentity. Not sure if the null check is the problem, here is my code:
-
Maybe check if world is remote? I've had this problem before with duplicate events.
-
I'm storing the color property in a tileentity. But I don't know if that's what you're asking for. This works fine for getting the block's correct color state when placed.
-
Oh I see what you mean. When I do use metadata to get the color for the block drop, it returns a random color, not the correct one. I fixed this earlier with byDyeDamage, but I don't know how to do it in this context.
-
So, as opposed to using a tileentity?
-
I know, I was just showing you what method I was using previously and I'm wondering how to update it. I tried calling getColor from the tileentity, but still stuck.
-
It worked when I was storing color in metadata, but not now that it's store in a TE. @Override public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { drops.add(new ItemStack(this, 1, this.getMetaFromState(state))); }
-
However, would you know what I would need to use to get the correct drop? I can't seem to use byDyeDamage.
-
If tile entity is not saving the color on quitting the map, would that be a sync issue? Not sure why it just started. Nevermind.
-
Thank you.
-
Sorry I had changed that method around before and I forgot it wasn't doing anything. That works now, just wondering why this method, when dye is applied, changes the block to a random color and not the corresponding one.
-
Here is the latest block code
-
I know, but I had used a tileentity to store facing values, and I'm just confused on how to literally swap the color and facing properties, not saying I'm going to keep it this way, just want to finish it how I started it. Could you explain what you mean here?
-
This is everything updated in the tileentity class. I guess I'm just not understanding something.
-
Ok, thanks that was very helpful. Everything in that post however I was already implementing, except one method, but I think it's still not syncing. Is that everything I have to do in the TE? If I'm pulling the color from the TE Then I don't know how to get the data for each color, it just returns what I defined color as
-
Quick update, sorry but I'm still stuck on this. My tileentity for color is: and getActualState: but this only returns RED, obviously, but I don't understand how to get the data from the block.
-
Ok, I will look into it. For now I am curious, just because I'm trying to switch color and facing so I store color in the TE. (I will end up changing it to what has been recommended). But in getActualState I'm trying to call the TE and get the data from it, but I'm not quite sure how. @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { super.getActualState(state, worldIn, pos); TileEntityCounter tileEntity = (TileEntityCounter) worldIn.getTileEntity(pos); EnumDyeColor color = tileEntity.getColor(); return state.withProperty(COLOR, color); }
-
Ok, thanks. And just to check I defined my color in the TE as It doesn't need to be an integer or is this alright?
-
Would this go in getActualState?
-
Well I have heard a couple people on this post say something about switching facing and color properties so that I can store color in the TE. Right now color is in the metadata, but if I instead put it in the TE, than how exactly would I call it in the block class instead of using getMetaFromState and getStateFromMeta?