Jump to content

Atijaf

Members
  • Posts

    198
  • Joined

  • Last visited

Everything posted by Atijaf

  1. I decided to add an if statement to check if posX , Y, and Z, are 0. If they are, don't continue. It's working client and server side.
  2. Inside the event, "PlayerEvent.BreakSpeed", returns incorrect blockPos information. More on that... While debugging, the first 3 passes through that event work out fine and return correct information. The last pass through the event returns a BlockPos with the values of 0, 0, 0. tested it with bare minimum amount of code. Thanks!
  3. I have learned that you cannot edit vanilla minecraft's block hardness or harvest levels required. I am now looking for an alternative... How would I make diamond ore drop, even if i'm using my hand or any other tool that does not have the required harvest level to harvest diamond ore?
  4. How do I manually use spoilers? Not working for me:( @SubscribeEvent public void onHarvestBlock(BlockEvent.HarvestDropsEvent event){ world = event.world; pos = event.pos; state = event.state; int fortune = event.fortuneLevel; List<ItemStack> blockDrops = event.state.getBlock().getDrops(world, pos, state, fortune); event.drops.clear(); event.dropChance = 1.0F; for(int i = 0; i < blockDrops.size(); i++){ event.drops.add(blockDrops.get(i)); } }
  5. I'm using "BlockEvent.HarvestDropsEvent event", But it isn't being called because nothing is being dropped. Do I have to declare that it will drop inside the "BlockEvent.BreakEvent event"?
  6. I've tried it in both. While debugging, it shows that it changed it, but once the game starts and i attempt to break it, it doesn't drop. It also breaks as slow as it would using my hand.
  7. I've attempted to change the required harvest level of diamond ore to 0, but it reverts back after the game started. How would I change the required harvest level for a block?
  8. Haha:) I did that immediately after I edited my post. Thanks for the help!
  9. Thanks for the tip! Well I feel slightly embarrassed... I thought it was working. How would I edit or re-declare the "blockStrength" method?
  10. I am wanting to control the speed at which the player can mine blocks. The problem: It seems to work the way I want it to... Except when I go to mine a block with the proper tool. IE. using a diamond pickaxe on diamond ore vs. using your hand on diamond ore. I want both to mine at the same speed. Here is my method: (Sorry, spoilers aren't working) @SubscribeEvent public void onBlockStartBreak(PlayerEvent.BreakSpeed event){ event.newSpeed = 5; } Any idea why a diamond pickaxe would be faster at mining diamond ore than a hand? I know it doesn't make too much sense to do this, but this is the first step in the process and I need to get a better understanding of what's actually going on. Thanks!
  11. Would there be any way to change the hardness value of a meta block, like diorite?
  12. I created a new block and I want it to drop a vanilla diorite block. How would I go about this? Here's my class. Sorry, It wouldn't let me place it in a spoiler. public class stoneBlock extends Block{ public stoneBlock(Material materialIn) { super(materialIn); this.setHarvestLevel("pickaxe", 0); } public Item getItemDropped(IBlockState state, Random rand, int fortune){ return new ItemStack(Item.getItemFromBlock(Blocks.stone), 1, 3); } }
  13. If the player is in the room, he is safe from the outside elements.
  14. Would it be possible to check if a player is inside an enclosed room?
  15. Common mistake:p Overthinking thingsXD Thank you for the help
  16. I tried it, but feel like I didn't do something right because I'm getting an exception. As for the error, I debugged it and it throws an exception on the "event.drops.add" method.
  17. I am subscribing the event BlockEvent.HarvestDropsEvent event and was wondering how make a block, like default stone, drop granite instead. This is my code. Thanks.
  18. Perfect! Thanks:) You also helped me in my other post! Thanks again.
  19. Help me understand this please. This map associates a short with the Block, right? So that I can basically use the value inside as an id for the block, without actually changing the block id.
  20. Thanks everyone for the help and input!
  21. I am fairly new at hashMaps. I'll see what I can do!
  22. I am using a 2d array. Ex: public static short[][] Example = new short[500][16]; // Example[blockId][MetaId] = Short Number.
  23. I had a look at it and am understanding what it is doing. However, I am unsure how I would check the instance of that class if it holds the BlockPos of the block I'm breaking. Would I use a hashMap for storing them? Also, How would I go about using the variable BlockPos in a hashMap? Thanks a bunch!
  24. Thanks for a fast reply. I am aware that it does it automatically, but being able to adjust, or override the automatic IDs, would be very useful in my code.
  25. Would there be a way to change the block id of a newly created block or item?
×
×
  • Create New...

Important Information

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