Jump to content

nworB_cirE

Members
  • Posts

    4
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

nworB_cirE's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I saw you're planning on adding RP power. If that ever happens, that will be great. Any chance of ever supporting BC3 power, or is that too OP (redstone engines)? I would use the transformers mod, but I haven't been running IC2 lately.
  2. Do I need to submit a pull request or something to get this put in?
  3. So I tried to implement this myself. Here's what I did: EnchantmentHelper.java public static boolean[] enchantBlocks = new boolean[4096]; public static void setBlock(int par1, boolean par2) { enchantBlocks[par1] = par2; } public static boolean isEnchantmentBlock(int par1) { if (enchantBlocks[par1]||par1 == Block.bookShelf.blockID) { return true; } return false; } ContainerEnchantment.java public void onCraftMatrixChanged(IInventory par1IInventory) { if (par1IInventory == this.tableInventory) { ItemStack var2 = par1IInventory.getStackInSlot(0); int var3; if (var2 != null && var2.isItemEnchantable()) { this.nameSeed = this.rand.nextLong(); if (!this.worldPointer.isRemote) { var3 = 0; int var4; for (var4 = -1; var4 <= 1; ++var4) { for (int var5 = -1; var5 <= 1; ++var5) { if ((var4 != 0 || var5 != 0) && this.worldPointer.isAirBlock(this.posX + var5, this.posY, this.posZ + var4) && this.worldPointer.isAirBlock(this.posX + var5, this.posY + 1, this.posZ + var4)) { if (EnchantmentHelper.isEnchantmentBlock(this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4 * 2))) { ++var3; } if (EnchantmentHelper.isEnchantmentBlock(this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY + 1, this.posZ + var4 * 2))) { ++var3; } if (var5 != 0 && var4 != 0) { if (EnchantmentHelper.isEnchantmentBlock(this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4))) { ++var3; } if (EnchantmentHelper.isEnchantmentBlock(this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY + 1, this.posZ + var4))) { ++var3; } if (EnchantmentHelper.isEnchantmentBlock(this.worldPointer.getBlockId(this.posX + var5, this.posY, this.posZ + var4 * 2))) { ++var3; } if (EnchantmentHelper.isEnchantmentBlock(this.worldPointer.getBlockId(this.posX + var5, this.posY + 1, this.posZ + var4 * 2))) { ++var3; } } } } } for (var4 = 0; var4 < 3; ++var4) { this.enchantLevels[var4] = EnchantmentHelper.calcItemStackEnchantability(this.rand, var4, var3, var2); } this.updateCraftingResults(); } } else { for (var3 = 0; var3 < 3; ++var3) { this.enchantLevels[var3] = 0; } } } } BlockEnchantmentTable.java public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { super.randomDisplayTick(par1World, par2, par3, par4, par5Random); for (int var6 = par2 - 2; var6 <= par2 + 2; ++var6) { for (int var7 = par4 - 2; var7 <= par4 + 2; ++var7) { if (var6 > par2 - 2 && var6 < par2 + 2 && var7 == par4 - 1) { var7 = par4 + 2; } if (par5Random.nextInt(16) == 0) { for (int var8 = par3; var8 <= par3 + 1; ++var8) { if (EnchantmentHelper.isEnchantmentBlock(par1World.getBlockId(var6, var8, var7))) { if (!par1World.isAirBlock((var6 - par2) / 2 + par2, var8, (var7 - par4) / 2 + par4)) { break; } par1World.spawnParticle("enchantmenttable", (double)par2 + 0.5D, (double)par3 + 2.0D, (double)par4 + 0.5D, (double)((float)(var6 - par2) + par5Random.nextFloat()) - 0.5D, (double)((float)(var8 - par3) - par5Random.nextFloat() - 1.0F), (double)((float)(var7 - par4) + par5Random.nextFloat()) - 0.5D); } } } } } } Though I don't know if ContainerEnchantment is the best place to put those hooks...
  4. Basically, I want to replace the code in ContainerEnchantment.class that references bookshelves with an array of possible blocks. Something along the lines of the following: In ContainerEnchantment.class public static Block[] enchantmentBlocks = new int[4096]; enchantmentBlocks[0] = Block.bookShelf; private static int currentNumber = 1; In GameRegistry.class public static void addEnchantmentBlock(Block block) { enchantmentBlocks[currentNumber] = block; currentNumber++; } Then replace all of this if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4 * 2) == Block.bookShelf.blockID) { ++var3; } with something like this. for (int i = 0; i < currentNumber; i++) { if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4 * 2) == enchantmentBlocks[i].blockID) { ++var3; } } And the same thing in TileEntityEnchantmentTable.class. Of course, I'm not sure if ContainerEnchantment is the place to put this; it should be somewhere where the array gets initialized once during startup and the testing for blockIDs only happens per table.
×
×
  • Create New...

Important Information

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