Everything posted by Draco18s
-
Custom Dispenser Behaviour Help
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).
-
Block set in code doesn't save
Wow, this is hilariously bad. /** This is set to true for client worlds, and false for server worlds. */ public boolean isRemote;
-
Getting the block a player is looking at?
TBH, I yoinked that out of the....boat code.
-
Getting the block a player is looking at?
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 }
-
SOLVED
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)
-
SOLVED
What do you mean return a damaged item, the function: public static int getItemBurnTime returns an integer.
-
SOLVED
Ok great. Take an integer. Perform math on it. Return the integer.
-
SOLVED
Dude, it's math. I can't help you because I don't know what you need this value for.
-
SOLVED
It's an integer. Do whatever you want to with it.
-
SOLVED
par0ItemStack.getItemDamage() ?
-
1.6.2 Enderdragon/Wither Health Bar
net.minecraft.client.gui GuiInGame.java line 839
-
[1.5.2] Can't have more than one GUI
More like "no respect for anyone asking what appears to be an uninformed question" regardless of how informed that person actually is.
-
[1.5.2] Can't have more than one GUI
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.
-
[solved] problem with given player potion effects when on a block
Always check for the type you're casting to.
-
[solved] problem with given player potion effects when on a block
if(entity instanceof EntityLivingBase) { //your code }
-
[1.5.2] Can't have more than one GUI
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.
-
New modder tring to get start, not finding the information I want
FML != Forge. FML converts ModLoader functions into Forge functions so that ModLoader mods are compatible with Forge.
-
Making an icon depend on itemstack nbt
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").
-
How does Minecraft detect where it is placing a block?
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
-
Making an icon depend on itemstack nbt
In theory. Unfortunately, that would probably be a base class edit.
-
Making an icon depend on itemstack nbt
Yes. (I don't have the details behind how you would want to configure it, etc., so I cannot be more helpful).
-
[solved]Creating new GUI - Problem with alpha(transparency of my health bar)
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);
-
[1.5.2] Can't have more than one GUI
Snip tool, actually, but it amounts to the same thing. (I love the Windows Vista/7 snip tool. *Drool*)
-
Enchant Item/Armor on Crafting
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!
-
[1.5.2] Can't have more than one GUI
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.