perromercenary00
Members-
Posts
849 -
Joined
-
Last visited
-
Days Won
5
Everything posted by perromercenary00
-
i have a question over your question if you have more than one ItemCustomBow in the hot bar wen you pull one of the bows all the bows in hot bar get pulled to or just afect the one you have in hands?
-
i have a question over your question if you have more than one ItemCustomBow in the hot bar wen you pull one of the bows all the bows in hot bar get pulled to or just afect the one you have in hands?
-
im pretty sure to see some similar question before but dont find it so i ask again i have this item bulletclip whit an nbttag int "municion" and have an item bullets and this one have nbttag int "municion" = 1 awanna make a recipe having in mind this nbttags so if i put a bulletclip whith 5 bullets in the input plus a bullet it must return a bulletclip whith nbt =6 in the exit
-
i wass reading the exaple from ItemVariants for wath i understand youare setting the diferentas values of color an emptiness to metadata and thats mi trouble i do the bulletsclip whit 7 meta sub items representing all the states of emptiness from 0 bullets to sevent this clip only hold sevent bullets and have 8 diferent textures for the meta items representing from empty clip to seven bullets doing this way i could only make clips to 15 bullets and that for colt1911 is fine but i have anothers guns whit clips to 20 30 and 60 bullets so i think if i store the munition cuantity in NBT tags i gona use more less code and more simple but lose the grafical display of the bullets in the clip and lose the hability to load the clip in the worktable well thast another cuestion,it is posible to make recipes based on nbt tags ?
-
jejeje you get mi in the half of the way Code: [select] ["display": { "thirdperson": { "rotation": [ 0,0, 0 ], "translation": [ 0, 1.25, -3.5 ], "scale": [ 0.85, 0.85, 0.85 ] }, "firstperson": { "rotation": [ 90, 0, 180 ], "translation": [ -4, 6, -4 ], "scale": [ 1.0, 1.0, 1.0 ] }, "gui": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 4, 2 ], "scale": [ 4, 4, 4 ] } now i can change the look of the 3d model in the inventory now the second part is this I have items whit animations a pistol that take out the clip an change for other a chaing saw that actualy run wen this animations are execute it execute as well in the hot bar for that is i need to set a 2d icon in the inventory or at least a diferent model soo if it exist something like a tag "icon":"mimod:elIcono", at like alredy exist "particle": "#cross" it would be great
-
well i modify mi textures class to work whith itemStack hoping this could work but naa it still change the texture for all the clips at time , may if i put the texture change part in other method but where package mercenarymod.items.armasdefuego.colt1911; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.Random; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.stats.StatList; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import mercenarymod.materialesMercenarios; import mercenarymod.Mercenary; import net.minecraft.block.Block; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntitySnowball; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import mercenarymod.items.MercenaryModItems; import mercenarymod.utilidades.nbtMercenaria; import mercenarymod.utilidades.registrarTextura; import mercenarymod.utilidades.chat; import mercenarymod.utilidades.util; import net.minecraft.block.state.IBlockState; public class cargadorColt1911 extends Item{ public static String name = "cargadorColt1911"; public static int meta; public static int bullets=0; public cargadorColt1911(){ setUnlocalizedName(Mercenary.MODID + "_" + name); GameRegistry.registerItem(this, name); setCreativeTab(Mercenary.herramientas); this.setHasSubtypes(true); this.maxStackSize = 1; ;} public ItemStack onItemRightClick(ItemStack cargador, World worldIn, EntityPlayer playerIn) { bullets = 0 + (int)(Math.random()*10); nbtMercenaria.setInttag(cargador, "municionRestante", bullets); //tiempoCargador.habilitar( worldIn,playerIn, cargador); if ((bullets<7)&(bullets>0)){ registrarTextura.itemStack(cargador,0,"suspensionderedstone"+bullets); } if (bullets=={ registrarTextura.itemStack(cargador,0,"papa"); } if (bullets==9){ registrarTextura.itemStack(cargador,0,"patadecabra"); } return cargador; } public String getUnlocalizedName(ItemStack stack) { int m= stack.getMetadata(); if (m == 0){return name+"_vacio";} return name; } @SideOnly(Side.CLIENT) public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { subItems.add(new ItemStack(itemIn, 1, 0)); subItems.add(new ItemStack(itemIn, 1, 7)); } @SideOnly(Side.CLIENT) public void addInformation(ItemStack cargador, EntityPlayer player, List list, boolean aBoolean) { int municion=nbtMercenaria.getInttag(cargador, "municionRestante"); String lore="balas="+municion; if(lore != "") { list.add(lore); } } }//fin de la classe alredy text puting in addInformation and nop all the bulletclips change the texture for the same at the same time
-
well i think bows behave this way but not understand how they do it i have this item is a clip loader for a gun and i wanna change this especific clip texture to show the amount of bullets remainded but wen i swich this item texture it swichs for all the other bullet clips ass well am storing the bullets cuantity in a nbt Tag named "municionRestante" first am setting the texture for all clips in my texturex class whith registrarTextura.item(MercenaryModItems.bulletsClip,0,"bulletsClip_empty"); and i tink there is were the trouble begin there must be another metod someting like bulletclip.setThisWhithEspecificTexture("modmercenario:textura16"); soo ? ¿what must be done to set diferent texturex for diferent instances of the same item
-
im afrait to ask this silly cuestion but but curisity wins over fear and doing a mod whith lots of thinks and plnaing to do a map using the elements of the mod but notice that in the others map i download and play in my 1.8 game (not forge but normal minecraft) the comand blocks dont work and wen i look into dem they are empty. for example there is this The Mystery of Gliston v1.2 you start the game inside a cabin at the front door outside the house there is a swich that must send you to the begining of the map but the swicht don't work the same goes whith five nigths at freddy house map swichs dont work today i try http://www.bad website is bad.net/thief-craft-puzzle-map/ you start in a walled yard filled whith presure plates wired to commands blocks and dont work so you get stuck there then I set to creative mode and check the command bloks and they are empty but not all of them hummm 1.8 is a version im not playing to much to say but im moding for this soo my teories list is filled whith 1) you must cast some kind of command or set option to commands blocks work wen you wanna play a map and im not aware of this requiriment 2)some shitty bug in minecraft clean commands in command blocks 3)moders are not doing their work what you think ?
-
good days i have this issue i create a custom 3d model whith json files and can set rotation an scale dor first view third view but not for the icon in inventory , here in inventory it takes the custom 3d model but in some items it looks better than in others my item is a custom patadecabra just for the nostalgic and want to keep the 3d model model wen in hand but in inventory i wanna put a normal 2d icon. this two pictures show the issue https://www.dropbox.com/s/o7nakvr1cubcz9b/crowbar0.png?dl=0 https://www.dropbox.com/s/0azt8m7nelp4na7/crowbar1.png?dl=0 item json { "parent": "modmercenario:item/parentales/patadecabra_parental", "textures": { "layer0": "modmercenario:items/materiales/barradeacero", "pata0":"modmercenario:items/espadas/patadecabra0", "pata1":"modmercenario:items/espadas/patadecabra1", "pata2":"modmercenario:items/espadas/patadecabra2", "pata3":"modmercenario:items/espadas/patadecabra3", "pata4":"modmercenario:items/espadas/patadecabra4", "pata5":"modmercenario:items/espadas/patadecabra5", "pata6":"modmercenario:items/espadas/patadecabra6", "pata7":"modmercenario:items/espadas/patadecabra7" }, "display": { "thirdperson": { "rotation": [ 0,0, 0 ], "translation": [ 0, 1.25, -3.5 ], "scale": [ 0.85, 0.85, 0.85 ] }, "firstperson": { "rotation": [ 90, 0, 180 ], "translation": [ -4, 6, -4 ], "scale": [ 1.0, 1.0, 1.0 ] } } } parental json { "ambientocclusion": false, "textures": { "particle": "#pata0" }, "elements": [ { "from": [ 7, 4, 6 ], "to": [ 9, 5, 20 ], "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 0, "rescale": false }, "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" } } }, { "from": [ 7, 4, 2 ], "to": [ 9, 5, 6 ], "rotation": { "origin": [ 8, 8, 8 ], "axis": "y", "angle": 0, "rescale": false }, "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" } } }, { "from": [ 7, 4, 2], "to": [ 9, 8.9, 3 ], "rotation": { "origin": [ 2,4,2 ], "axis": "x", "angle": -22.5, "rescale": false }, "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" } } }, { "from": [ 6.5, 8.25, 0], "to": [ 9.5, 11, 1 ], "rotation": { "origin": [ 7.5,8,0 ], "axis": "z", "angle": 0, "rescale": false }, "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata2" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata2" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata4" }, "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata3" } } }, { "from": [ 6.5, 4, 19], "to": [ 9.5, 5, 22 ], "rotation": { "origin": [ 8,4,20 ], "axis": "x", "angle": 22.5, "rescale": false }, "shade": false, "faces": { "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata5" }, "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata5" }, "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata0" }, "up": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata1" }, "down": { "uv": [ 0, 0, 16, 16 ], "texture": "#pata6" } } } ] } loking in the item json you can set rotation position and scale for show in first and third view but it would be great it someone knows how to set it for inventory view
-
[1.8] how you make a item emit ligth ?
perromercenary00 replied to perromercenary00's topic in Modder Support
nop i dont seeit but was thinking the same, i have a hand gun and wan this gun to flash a ligth around wen shoot and coincidently i was thinkin to spawn a empty ligth block for 100ms the other thing i have in mind is to add this gun to the ligt emiting items list in the dinamic ligths mod and demand the mod as dependenci but no way to turn on and off my specific gun on the fly hoohoho i just realize how to do a lantern to behave like the one in the first silent hill then there is not a more elegant solution to make spark mi gun -
good days. i wondering how you make an item thath emit ligth wen hold in steve hand just like the dinamic ligths mod from atomicstrykers any idea ?
-
[1.8] Method to get the Texture from a Item ?
perromercenary00 replied to Dr_Schnauzer's topic in Modder Support
i have that question to but i have something more complex in mind , in the java side and in the inner side of the png files but the your sounds more simple if you uncompress the minecraft jar , the jar from the game not the one in eclipse you can get all the textures just fint gold ingot open it whith gimp .minecraft/versions/1.8/1.8/assets/minecraft/textures/items/gold_ingot.png gold ingot has 8 diferent colors the brigthes yellow is ffff8b -
[1.8]Mobs wen hit get temporal inmunity ? <SOLVED>
perromercenary00 replied to perromercenary00's topic in Modder Support
ñaa just getit EntityLivingBase Mobbentity=(EntityLivingBase) movingobjectposition.entityHit; Mobbentity.maxHurtResistantTime=0; now there is no more loss bullets but i need testing whith non vainilla mobs before know if it won crash -
[1.8]Mobs wen hit get temporal inmunity ? <SOLVED>
perromercenary00 replied to perromercenary00's topic in Modder Support
complicated We are talking about vanilla minecraft mobs so any modifications wanted must be done in my bullet class I manage to get the entity that receives the damage but nothing so close to set hurttime just a Mobentity.hurtResistantTime; and dont know exactly what this is for soo idont find how to set the mob hurtResistantTime to zero from mi bullet class what I want is set to set hurtResistantTime to zero to the mob at the time of shooting before causing the damage altering just the code in my bullet class Entity Mobentity=movingobjectposition.entityHit; int d=Mobentity.hurtResistantTime; chat.chatr( (EntityPlayer) shootingEntity, "hurtTime"+d+" entity Name="+Mobentity.getName()); it returns : [20:23:16] [Client thread/INFO]: [CHAT] §c hurtTime 0 entity Name=Zombie [20:23:17] [Client thread/INFO]: [CHAT] §c hurtTime 7 entity Name=Zombie [20:23:17] [Client thread/INFO]: [CHAT] §c hurtTime 8 entity Name=Zombie im loading the entity from movingobjectposition.entityHit; but dont have method to set this value any idea how could do this -
[1.8] Single Json-File for couple of Items ?
perromercenary00 replied to Dr_Schnauzer's topic in Modder Support
well is true you cant set the same texture for all the item you want but you gonna end whit a bunch of items loking the same -
[1.8] how you use Planks in recipes ??<SOLVED>
perromercenary00 replied to perromercenary00's topic in Modder Support
well it point me to something i put this in mi recipes class new ShapedOreRecipe(Items.diamond, "###", "###", "###", '#', "logWood"); dont work but also dont crash. but if i do GameRegistry.addRecipe(new ItemStack(Items.potato), new Object[] {"###", "###", "###", '#', "logWood"}); java.lang.NullPointerException at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:261) ~[forgeSrc-1.8-11.14.0.1261-1.8.jar:?] but i notice i could do this and works GameRegistry.addRecipe(new ItemStack(Blocks.log), new Object[] {"PPP", "PPP", "PPP", 'P', Blocks.planks}); GameRegistry.addRecipe(new ItemStack(Blocks.planks), new Object[] {"LLL", "LLL", "LLL", 'L', Blocks.log}); dont matter if you mix diferent kind of planks but always return oak enougth for now post solved. -
[1.8]Mobs wen hit get temporal inmunity ? <SOLVED>
perromercenary00 posted a topic in Modder Support
goods days i have done a gun a colt 1911 model and have notice that i cant shoot fast multiple times a mob whitout lost some shoots but there is no trouble if i shoot wait and shoot again. this could be not notice wen hiting zombies whit swords of arrows coz knock back and time to tense a new arrow will cover the feature ¿ some one knows how many time exactly dure this temporal inmunity am prety sure is more than 1/4 second but less than half or at less a method to meassure it? i need this to adjust time betwin shoots -
goods puting logs and planks in the world is somethiing i dont know how to do less know is for me using them in recipes soo i need to create a recipe acepting any kind of plank not just roble (oak) how do you do a recipes using planks and logs ?
-
Yap i solv it well itink i do i just muve the set container item to the water bucket in input know i think i just move the trouble to other place but for now is fine it becomes rigth this GameRegistry.addRecipe(new ItemStack(MercenaryModItems.aceroMercenario), new Object[] {" # ", " W ", " ", '#' , MercenaryModItems.hierroAlrojo, 'W' , Items.water_bucket.setContainerItem(Items.bucket) }); and there is no more buckets in the derivated items crafting whith acero mercenario
-
ñaa this morning i begin tu understand the arrow entity class, i was calling the arrow the wrong way afther realize that i could modify the arrow set the damage and the speed the texture was easy just creating my own arrow in other place it lost the texture to call this arrow/bullet in the world i must conjure this way mercenarymod.items.armasdefuego.balas.balaPunto45ACPv2 p45 = new mercenarymod.items.armasdefuego.balas.balaPunto45ACPv2(worldIn, playerIn, 1.0F); worldIn.spawnEntityInWorld(p45); and the 45acp class package mercenarymod.items.armasdefuego.balas; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class balaPunto45ACPv2 extends Entity implements IProjectile { private int xTile = -1; private int yTile = -1; private int zTile = -1; private Block inTile; private int inData; private boolean inGround; public int canBePickedUp; public int arrowShake; public Entity shootingEntity; private int ticksInGround; private int ticksInAir; //Daño causado = ((damage*6.6)/0.5) private double damage = 0.62D; //0.62 equivale a 8.184 de daño private int knockbackStrength; private static final String __OBFID = "CL_00001715"; public static EntityLivingBase steve0; public balaPunto45ACPv2(World worldIn) { super(worldIn); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); } public balaPunto45ACPv2(World worldIn, double x, double y, double z) { super(worldIn); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); this.setPosition(x, y, z); } public balaPunto45ACPv2(World worldIn, EntityLivingBase shooter, EntityLivingBase p_i1755_3_, float p_i1755_4_, float p_i1755_5_) { super(worldIn); this.renderDistanceWeight = 10.0D; this.shootingEntity = shooter; if (shooter instanceof EntityPlayer) { this.canBePickedUp = 0; } this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D; double d0 = p_i1755_3_.posX - shooter.posX; double d1 = p_i1755_3_.getEntityBoundingBox().minY + (double)(p_i1755_3_.height / 3.0F) - this.posY; double d2 = p_i1755_3_.posZ - shooter.posZ; double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); if (d3 >= 1.0E-7D) { float f2 = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; float f3 = (float)(-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; double d5 = d2 / d3; this.setLocationAndAngles(shooter.posX + d4, this.posY, shooter.posZ + d5, f2, f3); float f4 = (float)(d3 * 0.20000000298023224D); this.setThrowableHeading(d0, d1 + (double)f4, d2, p_i1755_4_, p_i1755_5_); } } // //Esta es el metodo que estoy ejecutando y el float ya no sirve para nada // public balaPunto45ACPv2(World worldIn, EntityLivingBase shooter, float p_i1756_3_) { super(worldIn); this.renderDistanceWeight = 10.0D; this.shootingEntity = shooter; //shooter.playSound("modmercenario:colt1911Disparo", 1.0F, 1.0F); if (shooter instanceof EntityPlayer) { this.canBePickedUp = 0; } this.setSize(0.5F, 0.5F); this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.posY -= 0.10000000149011612D; this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ); this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); //this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, p_i1756_3_ * 1.5F, 1.0F); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, 15.0F, 0.0F); } protected void entityInit() { this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); } public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) { float f2 = MathHelper.sqrt_double(x * x + y * y + z * z); x /= (double)f2; y /= (double)f2; z /= (double)f2; x += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; y += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; z += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; x *= (double)velocity; y *= (double)velocity; z *= (double)velocity; this.motionX = x; this.motionY = y; this.motionZ = z; float f3 = MathHelper.sqrt_double(x * x + z * z); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f3) * 180.0D / Math.PI); this.ticksInGround = 0; } @SideOnly(Side.CLIENT) public void func_180426_a(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, int p_180426_9_, boolean p_180426_10_) { this.setPosition(p_180426_1_, p_180426_3_, p_180426_5_); this.setRotation(p_180426_7_, p_180426_8_); } @SideOnly(Side.CLIENT) public void setVelocity(double x, double y, double z) { this.motionX = x; this.motionY = y; this.motionZ = z; if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(x * x + z * z); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(x, z) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(y, (double)f) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch; this.prevRotationYaw = this.rotationYaw; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); this.ticksInGround = 0; } } public void onUpdate() { super.onUpdate(); if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI); } BlockPos blockpos = new BlockPos(this.xTile, this.yTile, this.zTile); IBlockState iblockstate = this.worldObj.getBlockState(blockpos); Block block = iblockstate.getBlock(); if (block.getMaterial() != Material.air) { block.setBlockBoundsBasedOnState(this.worldObj, blockpos); AxisAlignedBB axisalignedbb = block.getCollisionBoundingBox(this.worldObj, blockpos, iblockstate); if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3(this.posX, this.posY, this.posZ))) { this.inGround = true; } } if (this.arrowShake > 0) { --this.arrowShake; } if (this.inGround) { int j = block.getMetaFromState(iblockstate); if (block == this.inTile && j == this.inData) { ++this.ticksInGround; if (this.ticksInGround >= 1200) { this.setDead(); } } else { this.inGround = false; this.motionX *= (double)(this.rand.nextFloat() * 0.2F); this.motionY *= (double)(this.rand.nextFloat() * 0.2F); this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); this.ticksInGround = 0; this.ticksInAir = 0; } } else { ++this.ticksInAir; Vec3 vec31 = new Vec3(this.posX, this.posY, this.posZ); Vec3 vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); vec31 = new Vec3(this.posX, this.posY, this.posZ); vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { vec3 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int i; float f1; for (i = 0; i < list.size(); ++i) { Entity entity1 = (Entity)list.get(i); if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand((double)f1, (double)f1, (double)f1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); if (movingobjectposition1 != null) { double d1 = vec31.distanceTo(movingobjectposition1.hitVec); if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } } } } if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit; if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } float f2; float f3; float f4; if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); int k = MathHelper.ceiling_double_int((double)f2 * this.damage); if (this.getIsCritical()) { k += this.rand.nextInt(k / 2 + 2); } DamageSource damagesource; if (this.shootingEntity == null) { damagesource = DamageSource.causeThrownDamage(this, this); } else { damagesource = DamageSource.causeThrownDamage(this, this.shootingEntity); } if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { movingobjectposition.entityHit.setFire(5); } if (movingobjectposition.entityHit.attackEntityFrom(damagesource, (float)k)) { if (movingobjectposition.entityHit instanceof EntityLivingBase) { EntityLivingBase entitylivingbase = (EntityLivingBase)movingobjectposition.entityHit; if (!this.worldObj.isRemote) { entitylivingbase.setArrowCountInEntity(entitylivingbase.getArrowCountInEntity() + 1); } if (this.knockbackStrength > 0) { f4 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); if (f4 > 0.0F) { movingobjectposition.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)f4); } } if (this.shootingEntity instanceof EntityLivingBase) { EnchantmentHelper.func_151384_a(entitylivingbase, this.shootingEntity); EnchantmentHelper.func_151385_b((EntityLivingBase)this.shootingEntity, entitylivingbase); } if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); } } //this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); //playerIn.playSound( "modmercenario:colt1911Disparo", 1.0F, 1.0F); //this.playSound("modmercenario:colt1911Disparo", 1.0F, 1.0F); if (!(movingobjectposition.entityHit instanceof EntityEnderman)) { this.setDead(); } } else { this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; this.motionZ *= -0.10000000149011612D; this.rotationYaw += 180.0F; this.prevRotationYaw += 180.0F; this.ticksInAir = 0; } } else { BlockPos blockpos1 = movingobjectposition.getBlockPos(); this.xTile = blockpos1.getX(); this.yTile = blockpos1.getY(); this.zTile = blockpos1.getZ(); iblockstate = this.worldObj.getBlockState(blockpos1); this.inTile = iblockstate.getBlock(); this.inData = this.inTile.getMetaFromState(iblockstate); this.motionX = (double)((float)(movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = (double)((float)(movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = (double)((float)(movingobjectposition.hitVec.zCoord - this.posZ)); f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / (double)f3 * 0.05000000074505806D; this.posY -= this.motionY / (double)f3 * 0.05000000074505806D; this.posZ -= this.motionZ / (double)f3 * 0.05000000074505806D; //this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); //this.playSound("modmercenario:colt1911Disparo", 1.0F, 1.0F); this.inGround = true; this.arrowShake = 7; this.setIsCritical(false); if (this.inTile.getMaterial() != Material.air) { this.inTile.onEntityCollidedWithBlock(this.worldObj, blockpos1, iblockstate, this); } } } if (this.getIsCritical()) { for (i = 0; i < 4; ++i) { this.worldObj.spawnParticle(EnumParticleTypes.CRIT, this.posX + this.motionX * (double)i / 4.0D, this.posY + this.motionY * (double)i / 4.0D, this.posZ + this.motionZ * (double)i / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ, new int[0]); } } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; f3 = 0.99F; f1 = 0.05F; if (this.isInWater()) { for (int l = 0; l < 4; ++l) { f4 = 0.25F; this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * (double)f4, this.posY - this.motionY * (double)f4, this.posZ - this.motionZ * (double)f4, this.motionX, this.motionY, this.motionZ, new int[0]); } f3 = 0.6F; } if (this.isWet()) { this.extinguish(); } this.motionX *= (double)f3; this.motionY *= (double)f3; this.motionZ *= (double)f3; this.motionY -= (double)f1; this.setPosition(this.posX, this.posY, this.posZ); this.doBlockCollisions(); } } public void writeEntityToNBT(NBTTagCompound tagCompound) { tagCompound.setShort("xTile", (short)this.xTile); tagCompound.setShort("yTile", (short)this.yTile); tagCompound.setShort("zTile", (short)this.zTile); tagCompound.setShort("life", (short)this.ticksInGround); ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile); tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString()); tagCompound.setByte("inData", (byte)this.inData); tagCompound.setByte("shake", (byte)this.arrowShake); tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); tagCompound.setByte("pickup", (byte)this.canBePickedUp); tagCompound.setDouble("damage", this.damage); } public void readEntityFromNBT(NBTTagCompound tagCompund) { this.xTile = tagCompund.getShort("xTile"); this.yTile = tagCompund.getShort("yTile"); this.zTile = tagCompund.getShort("zTile"); this.ticksInGround = tagCompund.getShort("life"); if (tagCompund.hasKey("inTile", ) { this.inTile = Block.getBlockFromName(tagCompund.getString("inTile")); } else { this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255); } this.inData = tagCompund.getByte("inData") & 255; this.arrowShake = tagCompund.getByte("shake") & 255; this.inGround = tagCompund.getByte("inGround") == 1; if (tagCompund.hasKey("damage", 99)) { this.damage = tagCompund.getDouble("damage"); } if (tagCompund.hasKey("pickup", 99)) { this.canBePickedUp = tagCompund.getByte("pickup"); } else if (tagCompund.hasKey("player", 99)) { this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0; } } public void onCollideWithPlayer(EntityPlayer entityIn) { if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityIn.capabilities.isCreativeMode; if (this.canBePickedUp == 1 && !entityIn.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { flag = false; } if (flag) { //this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); //this.playSound("modmercenario:colt1911Disparo", 1.0F, 1.0F); entityIn.onItemPickup(this, 1); this.setDead(); } } } protected boolean canTriggerWalking() { return false; } //################################################################################################# public void setDamage(double p_70239_1_) { this.damage = p_70239_1_; } public double getDamage() { return this.damage; } public void setKnockbackStrength(int p_70240_1_) { this.knockbackStrength = p_70240_1_; } public boolean canAttackWithItem() { return false; } public void setIsCritical(boolean p_70243_1_) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); if (p_70243_1_) { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 1))); } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -2))); } } public boolean getIsCritical() { byte b0 = this.dataWatcher.getWatchableObjectByte(16); return (b0 & 1) != 0; } //################################################################################################# }//fin de la classe video for scala