Jump to content

Morteboule

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Morteboule

  1. Thanks
  2. Hello, I have another issue: In my ItemGun i have this: if (!par2World.isRemote) { par2World.spawnEntityInWorld(new EntityBullet(par2World, ((EntityPlayer)par3Entity), 21.0F)); par2World.spawnEntityInWorld(new EntityNoiseLocation(par2World, ((EntityPlayer)par3Entity), this.noiseRange)); } And in my EntityBullet i have this in onUpdate: if(this.stopTick && this.doneDisplay) { int nbMs = nbTicks * 50; System.out.println(this.entityId + " 100 meters in " + nbMs + "ms"); this.doneDisplay = false; } this.stopTick take false when in onUpdate again: if (this.inGround) { int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); this.stopTick = true; ............ } My issue is when my bullet hit a block, this: System.out.println(this.entityId + " 100 meters in " + nbMs + "ms"); is writting twice in consol and most of time nbMs is different (1 tick more) I don't know why this is showing twice, my entity is only spawning once i think with isRemote. Thanks
  3. I don't get it. In this; @SideOnly(Side.CLIENT) public void reloadingWeapon(Entity player, ItemStack itemStack) { if(player instanceof EntityPlayer) { //System.out.println("ReloadingWeapon"); if(((EntityPlayer)player).inventory.hasItem(this.bulletID)) { ((EntityPlayer)player).inventory.consumeInventoryItem(this.bulletID); } } } How can i look for the actual damage of the item (which is the actual number of bullet in the magazine) before consume it?
  4. Thanks for your reply. I've setted this.setMaxDamage(this.maxBullet); in constructor but when want to set the actual damage value (number of bullet who is randomly choosen) it ask for an itemstack but i don't have one in constructor. How can i set damage in constructor ?(Will be only used for display) public ItemMagazine(int id, int par2maxbullet) { super(id); this.maxStackSize = 1; this.maxBullet = par2maxbullet; this.bullet = itemRand.nextInt(this.maxBullet - 1) + 1; this.setMaxDamage(this.maxBullet); setCreativeTab(CreativeTabs.tabCombat); } And even if i can set damage, how can i get it in my ItemGun? (imagine i have 2 differents magazines) Thanks!
  5. Hello, In fact i have 2 weapons magazine in my inventory and each one has it s own number of ammo inside (ex: one has 3 and the other has 5) but it's the same item, number of ammo is a rand in the constructor. When i press a key i would like my weapon consumes one of magazine item but first taking the variable number of ammo inside it but i don't know how to acceed this value (to know wich one the weapon magazine the game will consume). The 2 weapons magazines are not stackable. Is there a solution? Thanks
  6. Hi everyone, I'm working on a FOV sight for mobs but i'm in trouble with minecraft vectors. I triyed to made a vector from where the mob is looking at (with rotationYaw et rotationYawHead) to the mob and another one from the player to the mob (this one works great) But with the first vector when i apply a dotProduct i think the vector is not: (Where the mob looking at/ mob) but more: (position of world 0,0,0, / mob) my dot Product reach ~1 when i move the player between the mob and the coord 0,0,0 no matter wich value rotationYaw is (or YawHead). Here is my code: public void onLivingUpdate() { System.out.println("ANGLE YAW:" + this.rotationYaw); System.out.println("ANGLE YAWHEAD:" + this.rotationYawHead); float f1; float f2; float f3; float f4; f1 = MathHelper.cos(-this.rotationYawHead * 0.017453292F); f2 = MathHelper.sin(-this.rotationYawHead * 0.017453292F); f3 = -MathHelper.cos(-this.rotationPitch * 0.017453292F); f4 = MathHelper.sin(-this.rotationPitch * 0.017453292F); Vec3 vecSight = this.worldObj.getWorldVec3Pool().getVecFromPool((double)f2 * f3, (double)f4, (double)(f1 * f3)); Vec3 vecMob = this.getPosition(1.0F); Vec3 vec2 = normalize(subtract(vecSight, vecMob)); Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player = mc.thePlayer; Vec3 vecPlayer = player.getPosition(1.0F); Vec3 vec1 = normalize(subtract(vecPlayer, vecMob)); double dp = dotProduct(vec1, vec2); System.out.println("DP : " + dp); if(dp > 1.0F - 0.5F) { System.out.println("SEE YOU"); } super.onLivingUpdate(); } I know it's a mess but it's for debugging Thanks for help! EDIT: Probleme solved juste forgot the mob position before rotationYaw ! Sorry
  7. ETID: I thought i've already did but thank you!
  8. Yeah i know it's a float value and i've already googled but still don't know what is it
  9. Hello all, I'm working on my mod but there is something i don't understand in minecraft vector: In method getLook(float par1) in EntityLivingBase there is f1 = MathHelper.cos(-this.rotationYaw * 0.017453292F - (float)Math.PI); I don't know what 0.017453292F is? I know it's not really important to continue my mod but if someone knows what does it mean i would like to know too Thanks!
×
×
  • Create New...

Important Information

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