
WildHeart
Members-
Posts
236 -
Joined
-
Last visited
Everything posted by WildHeart
-
So it turns out I need to write my ItemBlock nbt storage, and to store the meta for each block there?
-
With the blocks in the inventory no problem, the problem is that when I put the block of its variants remains the same as the first block.
-
Hi, there is one block with a meta tag from 1-15, is to take in hand this block it shows as it should, but if you put it in the variable variants shows the registered name of the block. How to fix?
-
Solved! @SubscribeEvent public void onDrop(BlockEvent.HarvestDropsEvent e) { if(!e.getWorld().isRemote) { if(e.getWorld().getBlockState(e.getPos()).getBlock() instanceof BlockLeaves) { e.getDrops().removeIf(itemStack -> itemStack == null || itemStack.getItem() == Items.APPLE); } } }
-
Solved @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)).withProperty(BARREL, Boolean.valueOf((meta & 8) > 0)).withProperty(SPIGOT, Boolean.valueOf((meta & 4) > 0)); } @Override public int getMetaFromState(IBlockState state) { int i = 0; i = i | state.getValue(FACING).getHorizontalIndex(); if(state.getValue(BARREL).booleanValue()) { i |= 8; } if(state.getValue(SPIGOT).booleanValue()) { i |= 4; } return i; }
-
Where you can read more about metadata for blocks?
-
Then I need not to take EnumFacing.getHorizontal, to do it my way?
-
Hello, i have a problem. If you arrange the blocks to the North or to the East after rejoining the game, everything is fine, but if placed on a South or West some of the blocks shifted. What could be the problem? BlockSide:
-
Oh, I forgot to unsubscribe that everything is found and made their own, but thanks anyway! Close topic.
-
Hello, I did the thing which has metadata, about 12 pieces. How now quickly register the renderer(in addition to the creation of a new render with the change of parameter meta)?
-
Worked, thank you!
-
Wow, didn't know that everything is so thoughtfully. I'll try to move.
-
Hello, there is a model Collector resin and I'm trying to do, that he was raised in the opinion of the player, but there is a problem. When done, the model stops working. In the console and logs nothing. Code: Blockstates: Please help.
-
while (apples.hasNext()) { if(apples.next() instanceof ItemFood) { apples.remove(); } } ?
-
Maybe?: if(e.getWorld().getBlockState(e.getPos()).getBlock() instanceof BlockLeaves) { Iterator apples = e.getDrops().iterator(); while (apples.hasNext()) { if(e.getDrops() instanceof ItemFood) { e.setCanceled(true); break; } } }
-
Hmm, now how to remove specifically apples? @SubscribeEvent public void onDrop(BlockEvent.HarvestDropsEvent e) { if(e.getWorld().isRemote) return; if(e.getWorld().getBlockState(e.getPos()).getBlock() instanceof BlockLeaves) { e.getDrops() } }
-
Hello, how to remove drop from the leaves? @SubscribeEvent public void onDrop(LivingDropsEvent e) { if(e.getEntity().worldObj.isRemote) return; for(EntityItem entityItem : e.getDrops()) { if(entityItem.getEntityItem().getItem() instanceof ItemFood) { if(entityItem.getEntityItem().getItem() == Items.APPLE) { } } } }
-
I rewrite mod is not a veteran of older versions, and as a modern encoder for 1.8+ versions. Ie I with 1.6.4 and below was not working for me remains a mystery packets that I threw and buildcraft api which has changed over time.
-
Hello, I rewrite my mod to a newer version and faced the problem. What is replaced by this package: Packet250CustomPayload? And now a question for those who are versed in buildcraft. What now comes as a replacement for these classes: IPowerReceptor, PowerHandler, PowerReceiver and etc?
-
Yes, you correctly understood me, but the fact that I use a bunch of servers with mods and plugins. I.e. Cauldron. The version of my project is 1.7.10. Once the sponge will be released in a stable state, I'll update all to the latest versions. In the meantime, I would like to know the solution for 1.7.10 version, thank you!
-
Started to port the old fashion for my project, but I ran into a problem. Packet250CustomPayload what is the replacement for this package in titleentity?
-
So, I did what you wanted and works as I need. What did I do? I started using getActualState checking the block on the bottom. Finally works as I intended. Special thanks to diesieben07 for your help and nerves of steel. I will continue to explore Properties, in order not to ask such questions, thanks to all!
-
Begin to understand mc code I found this code. He in fact is the answer to my question? /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta & 7)).withProperty(NODROP, Boolean.valueOf((meta & 8) > 0)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); if (((Boolean)state.getValue(NODROP)).booleanValue()) { i |= 8; } return i; }
-
Forgot to say, I changed the age. Now he is 4 instead of 8.
-
Right? @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(HALF, meta == 0 ? EnumCropHalf.LOWER : EnumCropHalf.UPPER).withProperty(AGE_DOUBLE, Integer.valueOf(meta)); } @Override public int getMetaFromState(IBlockState state) { EnumCropHalf type = state.getValue(HALF); return type.getMeta() & ((Integer)state.getValue(AGE_DOUBLE)).intValue(); }