Jump to content

WildHeart

Members
  • Posts

    236
  • Joined

  • Last visited

Everything posted by WildHeart

  1. So it turns out I need to write my ItemBlock nbt storage, and to store the meta for each block there?
  2. 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.
  3. 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?
  4. 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); } } }
  5. 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; }
  6. Where you can read more about metadata for blocks?
  7. Then I need not to take EnumFacing.getHorizontal, to do it my way?
  8. 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:
  9. Oh, I forgot to unsubscribe that everything is found and made their own, but thanks anyway! Close topic.
  10. 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)?
  11. Wow, didn't know that everything is so thoughtfully. I'll try to move.
  12. 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.
  13. while (apples.hasNext()) { if(apples.next() instanceof ItemFood) { apples.remove(); } } ?
  14. 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; } } }
  15. 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() } }
  16. 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) { } } } }
  17. 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.
  18. 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?
  19. 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!
  20. 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?
  21. 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!
  22. 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; }
  23. Forgot to say, I changed the age. Now he is 4 instead of 8.
  24. 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(); }
×
×
  • Create New...

Important Information

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