Jump 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.

Featured Replies

Posted

So I decompiled a mod to get the entity bullet and I can't figure out what one of the fields is. Field: field_70170_p

Here is the code:

 

package com.gunmod.masterminer.entity;

 

import java.util.Random;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntityThrowable;

import net.minecraft.init.Blocks;

import net.minecraft.util.DamageSource;

import net.minecraft.util.MathHelper;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.world.World;

 

public class EntityBullet

  extends EntityThrowable

{

  private int bulletdamage;

  public Entity shootingEntity;

 

  public EntityBullet(World par1World)

  {

    super(par1World);

    setSize(0.1F, 0.1F);

  }

 

  public EntityBullet(World par1World, EntityPlayer par2EntityLiving, int damage)

  {

    super(par1World, par2EntityLiving);

    this.bulletdamage = damage;

   

    this.shootingEntity = par2EntityLiving;

    setSize(0.5F, 0.5F);

    setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);

    this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * 3.141593F) * 0.16F;

    this.posY -= 0.1000000014901161D;

    this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * 3.141593F) * 0.16F;

    setPosition(this.posX, this.posY, this.posZ);

    this.yOffset = 0.0F;

    this.motionX = (-MathHelper.sin(this.rotationYaw / 180.0F * 3.141593F) * MathHelper.cos(this.rotationPitch / 180.0F * 3.141593F));

    this.motionZ = (MathHelper.cos(this.rotationYaw / 180.0F * 3.141593F) * MathHelper.cos(this.rotationPitch / 180.0F * 3.141593F));

    this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * 3.141593F));

    setThrowableHeading(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F);

  }

 

  public EntityBullet(World par1World, double par2, double par4, double par6)

  {

    super(par1World, par2, par4, par6);

  }

 

  protected float func_70185_h()

  {

    return 0.001F;

  }

 

  public void func_70016_h(double par1, double par3, double par5)

  {

    this.motionX = par1;

    this.motionY = par3;

    this.motionZ = par5;

    if ((this.prevRotationPitch == 0.0F) && (this.prevRotationYaw == 0.0F))

    {

      float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);

      this.prevRotationYaw = (this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / 3.141592653589793D));

      this.prevRotationPitch = (this.rotationPitch = (float)(Math.atan2(par3, f) * 180.0D / 3.141592653589793D));

      this.prevRotationPitch = this.rotationPitch;

      this.prevRotationYaw = this.rotationYaw;

      setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

    }

  }

 

  public void setArrowHeading(double par1, double par3, double par5, float par7, float par8)

  {

    float f = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5);

    par1 /= f;

    par3 /= f;

    par5 /= f;

    par1 += this.rand.nextGaussian() * 0.007499999832361937D * par8;

    par3 += this.rand.nextGaussian() * 0.007499999832361937D * par8;

    par5 += this.rand.nextGaussian() * 0.007499999832361937D * par8;

    par1 *= par7;

    par3 *= par7;

    par5 *= par7;

    this.motionX = par1;

    this.motionY = par3;

    this.motionZ = par5;

    float f1 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);

    this.prevRotationYaw = (this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / 3.141592653589793D));

    this.prevRotationPitch = (this.rotationPitch = (float)(Math.atan2(par3, f1) * 180.0D / 3.141592653589793D));

  }

 

  protected void func_70184_a(MovingObjectPosition par1MovingObjectPosition)

  {

    if (par1MovingObjectPosition.entityHit != null)

    {

      int var2 = this.bulletdamage;

      if (!par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), var2)) {}

    }

    if ((this.field_70170_p.getBlock(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) == Blocks.field_150359_w) || (this.field_70170_p.func_147439_a(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) == Blocks.field_150410_aZ) || (this.field_70170_p.func_147439_a(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) == Blocks.field_150426_aN) || (this.field_70170_p.func_147439_a(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) == Blocks.field_150399_cn) || (this.field_70170_p.func_147439_a(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) == Blocks.field_150397_co))

    {

      this.field_70170_p.setBlock(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d, Blocks.field_150350_a);

      this.field_70170_p.getBlock(this, "random.glass", 1.0F, 1.0F);

    }

    if ((this.field_70170_p.func_147439_a(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d).func_149688_o() != Material.field_151576_e) || (

   

 

 

 

      (!this.field_70170_p.field_72995_K) && (this.field_70170_p.getBlock(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) != Blocks.field_150329_H) && (this.field_70170_p.getBlock(par1MovingObjectPosition.field_72311_b, par1MovingObjectPosition.field_72312_c, par1MovingObjectPosition.field_72309_d) != Blocks.field_150398_cm))) {

      setDead();

    }

  }

}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

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.