Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


Forge Modder
  • Posts

  • Joined

  • Last visited

Everything posted by SamTebbs33

  1. I just thought that canHarvestBlock() was the general (not player-specific) way of checking if a block is harvestable and thought I should be calling it in order to not harvest blocks that shouldn't be harvestable by a non-player entity/machine. Please don't get so hostile all of a sudden.
  2. Will I need to fire the HarvestDropsEvent in order to break the block and spawn the drops? I tried calling canHarvestBlock() with a null player object and as expected I got an NPE.
  3. I am writing some code that will harvest a number of blocks around it (all of which implement IGrowable) and to stop abuse and breaking the mechanics of other mods I will need to check if the block is harvest-able with canHarvestBlock(...) and then harvest it with harvestBlock(...) if it is. These methods require an EntityPlayer object, which isn't applicable since the code will be run from within a tile entity. I could pass null as the player value but I never like doing that due to the risk of running into an NPE. Is there some accepted or established method of checking if a block is harvest-able and then harvesting it without using an EntityPlayer object? I'm open to using libraries.
  4. My world generator is only called in ocean biome chunks (using scala). Code that prints the biome (worldGen.scala): override def generate(random: Random, chunkX: Int, chunkZ: Int, world: World, chunkGenerator: IChunkGenerator, chunkProvider: IChunkProvider): Unit = { println(world.getBiomeProvider.getBiomeGenerator(new BlockPos(chunkX, 0, chunkZ))) } Registration code (in common proxy init method): GameRegistry.registerWorldGenerator(new WorldGen, 10) When generating a new world or travelling over un-generated chunks (that aren't ocean biomes) it prints out BiomeOcean@xxxxx
  5. Back in 1.7 an before, I had made a system that assigned textures to blocks with support for their names and having different textures for different sides of the block (the code would handle displaying the relevant side by using metadata based on rotation), but now that metadata has been abandoned and textures have to be designated in a .json file (WHY MOJANG!?!?!?!!?), this system is completely broken. What was great about my old system was that I only had to provide the textures in the resource path and then give each block an unlocalised name and the rest was processed by the mod. How would I achieve a similar system but using the new (annoying) .json system?
  6. I decided to start updating some of my code for the latest 1.8 release, and saw that a lot of the methods in the World class have been removed, such as getBlock() and getBlockMetadata(). What have they been replaced by?
  7. That's exactly what I did Perhaps I have it but just can't find it, where is it located after running setupDecompWorkspace?
  8. I installed the forge eclipse workspace and opened it up in eclipse. I've got the Minecraft project with the example mod but where do I get the minecraft source code from? I used to get it by running install.sh in the forge download, but that isn't there anymore.
  9. If you want to make a block that clings to the side of something, you'll need to change its block bounds. If you override the setBlockBoundsBasedOnState method in Block, you can set block bounds for distinct blocks in the world by using setBlockBounds(minx, minY, minZ, maxX, maxY, maxZ) Changing the block bounds will make your block less like a cube, depending on what you set them to.
  10. Try looking at the WorldGenStructure classes in the Minecraft source code, that's your best bet. Whenever you want to create something that is similar to what's already in Minecraft, you should always look at the source code, it's avery helpful method.
  11. You need to use j.getItemDamage(). That gets the damage/metadata of the itemstack
  12. IF you want to create the item, you'll need to make an item class like normal and then override the onItemUse method in Item and use the following code in the overridden method. You will need to change Block.cocoaPlant.blockID to the ID of your grape block and Block.wood.blockID to the ID of the block you want to plant the grape on. int i1 = par3World.getBlockId(par4, par5, par6); int j1 = par3World.getBlockMetadata(par4, par5, par6); if (i1 == Block.wood.blockID && BlockLog.limitToValidMetadata(j1) == 3) { if (par7 == 0) { return false; } if (par7 == 1) { return false; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } if (par3World.isAirBlock(par4, par5, par6)) { int k1 = Block.blocksList[block.cocoaPlant.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, 0); par3World.setBlock(par4, par5, par6, Block.cocoaPlant.blockID, k1, 2); if (!par2EntityPlayer.capabilities.isCreativeMode) { --par1ItemStack.stackSize; } } return true; }
  13. Hi, I have been testing my entity AI and the world seems to freeze (can't move entities, can't break blocks but can move around et.c) a short while after I spawn an entity from my mod, does anyone have any ideas as to why this could be? Here's my source code: https://github.com/VivaDaylight3/myrmecology Thanks in advance!
  14. Does it work under the exact same conditions (mod version, mc version, mods installed, forge version et.c) on window computers?
  15. Hi! I would like to make it possible to de-spawn a certain entity when left-clicking it on en entity, is it possible to cancel the damage inflicted? http://pastebin.com/z7cw3T04
  16. Hi, my users are getting this seemingly undebuggable error. I haven't been able to work our how my mod is causing this error: Here's a link to the GitHub issue: https://github.com/VivaDaylight3/myrmecology/issues/6
  17. Hi, how would I go about getting a list or array of tile entities / blocks with an inventory in a radius around a set of corrdinates? I've got the method to find block IDs in a radius but not how to then get the inventory or tile entity from there.
  18. Can we see the code you use to register your entity? Misuse of entity IDs can sometimes cause texture issues according to my experience.
  19. Thanks for sharing! Would you mind giving me a quick rundown on how I would use your algorithm? Thanks!
  20. Hi, is it possible to get the coordinates of every wood block in a tree? I realise that this could be done by just searching for all wood blocks in a radius, but that would also return wood blocks not actually part of the tree and even blocks connected to the tree by leaves. I know that tree feller mods do this somehow. Thanks in advance
  21. Thanks for the feedback, but I tried it and the list size is 0 even if there are loads of items around the mod using this method: public static List getEntityItemsInRadius(World world, double x, double y, double z, int radius) { List list = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getAABBPool().getAABB(x-radius, y-radius, z-radius, x + radius, y + radius, z + radius)); return list; } radius = 10
  • Create New...

Important Information

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