
yanksrock1019
Members-
Posts
193 -
Joined
-
Last visited
Everything posted by yanksrock1019
-
Potion Effect on Armor with custom enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
I tried this but it didn't work @SubscribeEvent public void onPlayerTick(PlayerTickEvent event){ if(event.player.getCurrentArmor(3)!= null){ ItemStack boots = event.player.getCurrentArmor(3); if(boots.getItem() == Items.diamond_boots){ int j = EnchantmentHelper.getEnchantmentLevel(MainClass.speedBoost.effectId, boots); if(j > 0){ event.player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 50, j - 1)); } } } } -
Potion Effect on Armor with custom enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Would it be like If(armor.hasEnchantment(enchantmen)){ } -
Potion Effect on Armor with custom enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Ok, but how would i check if it has the enchantment -
Potion Effect on Armor with custom enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Would I subscribe to that event in my ServerTickHandler class? -
Potion Effect on Armor with custom enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
*bump -
So right now I have it so that if my custom armor has the enchantment that it gives the player speed boost. But if you enchant other armor, it doesn't give the effect. How do I do this?
-
*bump
-
That's changes the a attack damage for all tools though, I want just the sword.
-
How do you set the attack damage for a sword? Sorry this is kind of a noob question
-
Didn't work
-
Not finding anything
-
When I place the furnace down while looking any direction, it always faces the same direction, but the particles are the correct direction package com.puplet.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.puplet.lib.Strings; import com.puplet.main.MainClass; import com.puplet.tile_entity.TileEntityPupletFurnace; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class PupletFurnace extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon top; @SideOnly(Side.CLIENT) private IIcon front; private static boolean isBurning; private final boolean isBurning2; private final Random random = new Random(); protected PupletFurnace(boolean isActive) { super(Material.rock); isBurning2 = isActive; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconregister) { this.blockIcon = iconregister.registerIcon(Strings.modid + ":PupletFurnaceSide"); this.front = iconregister.registerIcon(this.isBurning2 ? Strings.modid + ":PupletFurnaceActive" : Strings.modid + ":PupletFurnaceIdle"); this.top = iconregister.registerIcon(Strings.modid + ":PupletFurnaceTop"); } public IIcon getIcon(int side, int meta) { if (side == 1) { return top; } else if (side == 3) { return front; } else { return this.blockIcon; } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { player.openGui(MainClass.modInstance, 0, world, x, y, z); return true; } public Item getItemDropped(int par1, Random random, int par3) { return Item.getItemFromBlock(PupletBlocks.blockPupletFurnaceIdle); } public Item getItem(World world, int par2, int par3, int par4) { return Item.getItemFromBlock(PupletBlocks.blockPupletFurnaceIdle); } public TileEntity createNewTileEntity(World world, int par2) { return new TileEntityPupletFurnace(); } public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.direction(world, x, y, z); } private void direction(World world, int x, int y, int z) { if (!world.isRemote) { Block direction = world.getBlock(x, y, z - 1); Block direction1 = world.getBlock(x, y, z + 1); Block direction2 = world.getBlock(x - 1, y, z); Block direction3 = world.getBlock(x + 1, y, z); byte byte0 = 3; if (direction.func_149730_j() && direction.func_149730_j()) { byte0 = 3; } if (direction1.func_149730_j() && direction1.func_149730_j()) { byte0 = 2; } if (direction2.func_149730_j() && direction2.func_149730_j()) { byte0 = 5; } if (direction3.func_149730_j() && direction3.func_149730_j()) { byte0 = 4; } world.setBlockMetadataWithNotify(x, y, z, byte0, 2); } } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack itemstack) { int direction = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (direction == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (direction == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (direction == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (direction == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if (itemstack.hasDisplayName()) { ((TileEntityPupletFurnace) world.getTileEntity(x, y, z)).furnaceName(itemstack.getDisplayName()); } } public static void updateBlockState(boolean burning, World world, int x, int y, int z) { int direction = world.getBlockMetadata(x, y, z); TileEntity tileentity = world.getTileEntity(x, y, z); isBurning = true; if (burning) { world.setBlock(x, y, z, PupletBlocks.blockPupletFurnaceActive); } else { world.setBlock(x, y, z, PupletBlocks.blockPupletFurnaceIdle); } isBurning = false; world.setBlockMetadataWithNotify(x, y, z, direction, 2); if (tileentity != null) { tileentity.validate(); world.setTileEntity(x, y, z, tileentity); } } public void breakBlock(World world, int x, int y, int z, Block block, int meta) { if (!isBurning) { TileEntityPupletFurnace tileentitytutfurnace = (TileEntityPupletFurnace) world.getTileEntity(x, y, z); if (tileentitytutfurnace != null) { for (int i = 0; i < tileentitytutfurnace.getSizeInventory(); ++i) { ItemStack itemstack = tileentitytutfurnace.getStackInSlot(i); if (itemstack != null) { float f = this.random.nextFloat() * 0.6F + 0.1F; float f1 = this.random.nextFloat() * 0.6F + 0.1F; float f2 = this.random.nextFloat() * 0.6F + 0.1F; while (itemstack.stackSize > 0) { int j = this.random.nextInt(21) + 10; if (j > itemstack.stackSize) { j = itemstack.stackSize; } itemstack.stackSize -= j; EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound(((NBTTagCompound) itemstack.getTagCompound().copy())); } float f3 = 0.025F; entityitem.motionX = (double) ((float) this.random.nextGaussian() * f3); entityitem.motionY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double) ((float) this.random.nextGaussian() * f3); world.spawnEntityInWorld(entityitem); } } } world.func_147453_f(x, y, z, block); } } super.breakBlock(world, x, y, z, block, meta); } @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { if (this.isBurning2) { int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_); float f = (float)p_149734_2_ + 0.5F; float f1 = (float)p_149734_3_ + 0.0F + p_149734_5_.nextFloat() * 6.0F / 16.0F; float f2 = (float)p_149734_4_ + 0.5F; float f3 = 0.52F; float f4 = p_149734_5_.nextFloat() * 0.6F - 0.3F; if (l == 4) { p_149734_1_.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 5) { p_149734_1_.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 2) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); } else if (l == 3) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); } } } }
-
*bump
-
TileEntity: Chest:
-
When I put something in the chest, and log out, then log back in, the thing in the chest is gone. How can I prevent this?
-
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Ok, now it gives me the potion effect but it wont make it so that if I have the enchantment "Speed Boost 3" I will get speed 3 potion effect. -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Ok, so I changed it to (armor == new ItemStack(PupletItems.bootsPuplet)) What about the other thing, it's asking for an ItemStack. -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Highlighted the wrong for you. Thanks, but I can't see why that would be wrong, don't I have to declare what piece of armor it is, and also create a new ItemStack since getEnchantmentLevel takes ItemStacks not Items -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
I think I'm going about this wrong. @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { if(armor.getItem() == PupletItems.bootsPuplet){ int j = EnchantmentHelper.getEnchantmentLevel(MainClass.speedBoost.effectId, new ItemStack(PupletItems.bootsPuplet)); if(j > 0){ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 500, 4)); } } } -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Just realized it's actually effect id. -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Dude, just because I don't know where this is supposed to go doesn't mean I don't know simple java. This has nothing to do with basic java. I deals with minecraft which is why I'm here. However, having a good grasp of fundamental Java would allow you to quickly solve this Minecraft-related problem, because all you need is the enchantment level (an integer), which you now know how to retrieve thanks to diesieben07, and basic Java to relate that level to the potion duration or amplifier (both also integers). I think most people on these forums are more than happy to give advice about Minecraft-related questions, such as "how do I get the level of an enchantment?", but how you use that level is entirely up to you and your skills with Java. True, I mean I know what integers are and stuff but for the enchantment id, if it's my custom enchantment, would typing the id that I set work or would I have to use .getId() -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Dude, just because I don't know where this is supposed to go doesn't mean I don't know simple java. This has nothing to do with basic java. I deals with minecraft which is why I'm here. -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
Would this go under the potion effect? -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
I have this so far @Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { if(armor.getItem() == PupletItems.bootsPuplet){ player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 500, 4)); } } Now how do I make it dependent on my custom enchantment, and base the speed level on the level of enchantment? -
Adding an effect to an entity based on an enchantment
yanksrock1019 replied to yanksrock1019's topic in Modder Support
I know how to override stuff I just dont know where to put the onArmorTick and what to put inside it.