Jump to content

MineModder2000

Members
  • Posts

    298
  • Joined

  • Last visited

Everything posted by MineModder2000

  1. Yeah I had figured that out. I also just figured out how to remove the specific entity from the index ?
  2. biome.getSpawns(EntityClassification.CREATURE).remove(EntityType.PIG);
  3. for (Biome biome : ForgeRegistries.BIOMES) { biome.getSpawns(EntityClassification.CREATURE).clear(); biome.getSpawns(EntityClassification.CREATURE).add(new Biome.SpawnListEntry(EntityType.PIG, 1, 3, 5)); } I can clear all existing spawns from a biome using the clear method, which allows me to add a spawn exactly how I want, but then everything is gone. There are remove methods but they don't seem to be able to remove specific entities. Anyone know how to do this?
  4. You will need an understanding of Java, an IDE (e.g. Eclipse), and then knowledge of working with Forge (assuming it's a forge based mod).
  5. Oh I just realized that there is a canBlockSeeSky(pos) method inside of world, that's what I needed to check in addition. All working now ?
  6. Actually not so unassigned, this doesn't account for covering. If a block is a under a tree for example, it won't get rain on it, but according to these checks it is raining.
  7. I need to check if it's raining on a particular block. The isRaining() method checks if it's raining globally, the isRainingAt() method just doesn't seem to work, it always returns false. @SubscribeEvent public void EntityPlaceEvent(EntityPlaceEvent event) { World world = event.getEntity().world; BlockPos blockpos = event.getPos(); BlockState blockstate = world.getBlockState(blockpos); if (event.getState().getBlock() == Blocks.CAMPFIRE && world.isRainingAt(blockpos)) { world.setBlockState(blockpos, blockstate.with(CampfireBlock.LIT, false)); } }
  8. I love you, didn't know this event existed, but it's definitely the right one, thanks. PS : Interesting username....
  9. The code isn't working as intended, it's going by the block the player is standing on not looking at.
  10. Well it's never naturally null, that's only if I comment out the code that sets it. The bigger problem is getting the blockPos of the block the player is looking at.
  11. As stated it's fetching the position of the block that the player is standing on. If it's null the game crashes.
  12. Yeah nvm, I didn't think this question through. Sorry, my bad.
  13. Is it possible to check if a block is not connected to other blocks of the same type?
  14. I tried to implement the code from debug overlay : RayTraceResult result; BlockPos blockpos = null; result = event.getPlayer().func_213324_a(20.0D, 0.0F, true); if (result.getType() == RayTraceResult.Type.BLOCK) { blockpos = ((BlockRayTraceResult)result).getPos(); } if ((event.getPlayer().getHeldItemMainhand().getItem() == Items.GLASS_BOTTLE || event.getPlayer().getHeldItemMainhand().getItem() == Items.WATER_BUCKET) && (!event.getWorld().getBiome(blockpos).toString().contains("River"))) { event.setCanceled(true); } But its still going by the block that the player is standing on, not looking at.
  15. if (this.leftClickCounter <= 0 && !this.player.isHandActive()) { if (leftClick && this.objectMouseOver != null && this.objectMouseOver.getType() == RayTraceResult.Type.BLOCK) { BlockRayTraceResult blockraytraceresult = (BlockRayTraceResult)this.objectMouseOver; BlockPos blockpos = blockraytraceresult.getPos(); if (!this.world.isAirBlock(blockpos)) { Direction direction = blockraytraceresult.getFace(); if (this.playerController.onPlayerDamageBlock(blockpos, direction)) { this.particles.addBlockHitEffects(blockpos, blockraytraceresult); this.player.swingArm(Hand.MAIN_HAND); I don't understand this code, objectMouseOver is not set anywhere in the class, so how is it being used?
  16. I don't understand what function, what existing client side code? What does running a ray trace mean?
  17. Okay so the BlockRayTraceResult constructor takes the following : Vec3d, Direction, BlockPos, Boolean. I think I got the correct Vec3d and Direction, but I am not sure how to get the targeted Block, so I can get it's position. @SuppressWarnings("deprecation") @SubscribeEvent public void rightClickItem(RightClickItem event) { BlockRayTraceResult result; result = new BlockRayTraceResult(event.getEntityPlayer().getLookVec(), event.getFace(), event.getPos(), false); if ((event.getEntityPlayer().getHeldItemMainhand().getItem() == Items.GLASS_BOTTLE || event.getEntityPlayer().getHeldItemMainhand().getItem() == Items.WATER_BUCKET) && (!event.getWorld().getBiome(result.getPos()).toString().contains("River"))) { event.setCanceled(true); } }
  18. I should've specified, I want this check to happen when the player is holding an item, so the RightClickItem event is what I want cancelled when the block is in the wrong biome. It actually doesn't work that bad the way I have it, it would just be better if it was based on the targeted block rather than the block the player is on.
  19. I am using the event.getWorld().getBiome() method for RightClickItem Event. It takes a position as a parameter. If I use event.getPos() I get the position the player is standing in, but I want the position of the block being targeted, if possible. - Thanks.
  20. Well I used a traditional Java technique, and got it working via a config text file. This works fine, eventually though, I would like to make an in game GUI.
  21. I am getting requests for configurable options for a mod I released recently, but don't know how to go about it. Preferably, I would implement this via in game GUI, but a config file wouldn't be bad either, if its easier. Please help, thanks.
  22. Because I have it working now of course ?
  23. I found a way to do this actually using chunk inhabited time.
×
×
  • Create New...

Important Information

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