Jump to content

SamTebbs33

Forge Modder
  • Posts

    79
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://github.com/SamTebbs33
  • Location
    United Kingdom

SamTebbs33's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  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; }
×
×
  • Create New...

Important Information

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