Skip to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. Look at net.minecraft.dispenser DispenserBehaviorMobEgg You'll probably need to duplicate that class for your spawn eggs and add the behavior to the dispenser behavior listing (see DispenserBehaviors).
  2. Wow, this is hilariously bad. /** This is set to true for client worlds, and false for server worlds. */ public boolean isRemote;
  3. TBH, I yoinked that out of the....boat code.
  4. float f = 1.0F; float f1 = p.prevRotationPitch + (p.rotationPitch - p.prevRotationPitch) * f; float f2 = p.prevRotationYaw + (p.rotationYaw - p.prevRotationYaw) * f; double d0 = p.prevPosX + (p.posX - p.prevPosX) * (double)f; double d1 = p.prevPosY + (p.posY - p.prevPosY) * (double)f + 1.62D - (double)p.yOffset; double d2 = p.prevPosZ + (p.posZ - p.prevPosZ) * (double)f; Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI); float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); float f6 = MathHelper.sin(-f1 * 0.017453292F); float f7 = f4 * f5; float f8 = f3 * f5; double d3 = 5.0D; Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3); MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3, vec31, false, true); if (movingobjectposition == null) { return; } if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) { int ix = movingobjectposition.blockX; int iy = movingobjectposition.blockY; int iz = movingobjectposition.blockZ; //block is at ix, iy, iz }
  5. I know what you mean by "a damaged item" that is not causing my inability to help you. My inability to help you stems from "return a" when the function you are working with does not return an item. Of any kind. In any case, damaging an item: par0ItemStack.setItemDamage(value) If you want to change the item ID, you're going to need to make a new ItemStack(item)
  6. What do you mean return a damaged item, the function: public static int getItemBurnTime returns an integer.
  7. Ok great. Take an integer. Perform math on it. Return the integer.
  8. Dude, it's math. I can't help you because I don't know what you need this value for.
  9. It's an integer. Do whatever you want to with it.
  10. par0ItemStack.getItemDamage() ?
  11. net.minecraft.client.gui GuiInGame.java line 839
  12. More like "no respect for anyone asking what appears to be an uninformed question" regardless of how informed that person actually is.
  13. It's what happens when you tear your hair out trying to do something that should be simple, only to find that Forge didn't unfinalize something* and get dragged back into the help forum. *Lex told me that there's no reason it should be unfinalized, three days later a pull request is made, acted on, and merged with the main trunk. I think Lex just hates me.
  14. Always check for the type you're casting to.
  15. if(entity instanceof EntityLivingBase) { //your code }
  16. Good thing you solved it, as that error is woefully inadequate, as there are something like FIVE different problems that will generate that error. I had the misfortune of having the most uncommon one when I was doing my gui container.
  17. FML != Forge. FML converts ModLoader functions into Forge functions so that ModLoader mods are compatible with Forge.
  18. My guess is that you saved a reference to the icon registerer, and used it later. Bit of a workaround, but I'd have thought that it would have stopped stitching textures by then (i.e. newly added icons would be "ignored").
  19. Block.onAdded(...) //called any time the block is placed into the world for any reason, including block updates and being pushed by pistons. or Block.onBlockPlaced(...) //called any time the block is placed into the world by the player
  20. In theory. Unfortunately, that would probably be a base class edit.
  21. Yes. (I don't have the details behind how you would want to configure it, etc., so I cannot be more helpful).
  22. In the one GUI I've built, I've got these lines (and you dont): GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_ALPHA_TEST);
  23. Snip tool, actually, but it amounts to the same thing. (I love the Windows Vista/7 snip tool. *Drool*)
  24. Ok, this is fairly easy then. public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { int level = 20; //pretend the player has 20 levels to spend par1ItemStack = EnchantmentHelper.addRandomEnchantment(new Random(), par1ItemStack, level); } In theory that should work. There may be some helpers that need to be called to get your custom item recognized as valid [tool|bow|armor], I'm not sure. My items are going about it slightly differently (as I'm using one item class that results in items with varying effects, so "is it a tool?" is dependent on NBT data) so I'm actually enchanting a vanilla pickaxe/sword/armor (as appropriate) and then copying the relevant NBT data over to my item: Item item = Item.pickaxeWood; //pick a random amount of experience to use. Higher amounts are rarer. Minimum 5. int level = 4; do { ++level; } while(level < 30 && instance.rand.nextInt( != 0); //if it has the deal-damage effect, treat it as a sword if(effectsOnItem.contains(2) && instance.rand.nextBoolean()) { //get item's material switch(artifact.stackTagCompound.getInteger("material")) { case 0: item = Item.swordWood; break; case 1: item = Item.swordStone; break; case 2: item = Item.swordIron; break; case 3: item = Item.swordGold; break; case 4: item = Item.swordDiamond; break; } } //else treat it as a tool (imperfect, but acceptable; armor not coded yet) else { switch(artifact.stackTagCompound.getInteger("material")) { case 0: item = Item.pickaxeWood; break; case 1: item = Item.pickaxeStone; break; case 2: item = Item.pickaxeIron; break; case 3: item = Item.pickaxeGold; break; case 4: item = Item.pickaxeDiamond; break; } } //enchant the sword/pickaxe ItemStack stack = new ItemStack(item); stack = EnchantmentHelper.addRandomEnchantment(instance.rand, stack, level); //copy the enchantment from the temporary item to the real item artifact.stackTagCompound.setTag("ench", stack.stackTagCompound.getTag("ench").copy());/code] It's very easy if you are looking for a very specific enchantment, as ItemStack has this function: public void addEnchantment(Enchantment par1Enchantment, int par2){...} Easy peasy!

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.