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

Java reflecting is a way to bypass class and security restrictions in java.

 

It depends on 'what' you want to change as to whether reflections will work or not.

  • Author

What I am wanting to change is part of the MovingObjectPosition

 

 

package net.minecraft.src;

public class MovingObjectPosition
{
    /** What type of ray trace hit was this? 0 = block, 1 = entity */
    public EnumMovingObjectType typeOfHit;

    /** x coordinate of the block ray traced against */
    public int blockX;

    /** y coordinate of the block ray traced against */
    public int blockY;

    /** z coordinate of the block ray traced against */
    public int blockZ;

    /**
     * Which side was hit. If its -1 then it went the full length of the ray trace. Bottom = 0, Top = 1, East = 2, West
     * = 3, North = 4, South = 5.
     */
    public int sideHit;

    /** The vector position of the hit */
    public Vec3D hitVec;

    /** The hit entity */
    public Entity entityHit;
    
    /** Used to determine what sub-segment is hit */
    public int subHit = -1;

    public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3D par5Vec3D)
    {
        this.typeOfHit = EnumMovingObjectType.TILE;
        this.blockX = par1;
        this.blockY = par2;
        this.blockZ = par3;
        this.sideHit = par4;
        this.hitVec = Vec3D.createVector(par5Vec3D.xCoord, par5Vec3D.yCoord, par5Vec3D.zCoord);
    }

    public MovingObjectPosition(Entity par1Entity)
    {
        this.typeOfHit = EnumMovingObjectType.ENTITY;
        this.entityHit = par1Entity;
        this.hitVec = Vec3D.createVector(par1Entity.posX, par1Entity.posY, par1Entity.posZ);
    }
}

 

 

I want the line

public Entity entityHit;

to be

public static Entity entityHit;

 

Would that be possible?

What I am wanting to change is part of the MovingObjectPosition

 

 

package net.minecraft.src;

public class MovingObjectPosition
{
    /** What type of ray trace hit was this? 0 = block, 1 = entity */
    public EnumMovingObjectType typeOfHit;

    /** x coordinate of the block ray traced against */
    public int blockX;

    /** y coordinate of the block ray traced against */
    public int blockY;

    /** z coordinate of the block ray traced against */
    public int blockZ;

    /**
     * Which side was hit. If its -1 then it went the full length of the ray trace. Bottom = 0, Top = 1, East = 2, West
     * = 3, North = 4, South = 5.
     */
    public int sideHit;

    /** The vector position of the hit */
    public Vec3D hitVec;

    /** The hit entity */
    public Entity entityHit;
    
    /** Used to determine what sub-segment is hit */
    public int subHit = -1;

    public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3D par5Vec3D)
    {
        this.typeOfHit = EnumMovingObjectType.TILE;
        this.blockX = par1;
        this.blockY = par2;
        this.blockZ = par3;
        this.sideHit = par4;
        this.hitVec = Vec3D.createVector(par5Vec3D.xCoord, par5Vec3D.yCoord, par5Vec3D.zCoord);
    }

    public MovingObjectPosition(Entity par1Entity)
    {
        this.typeOfHit = EnumMovingObjectType.ENTITY;
        this.entityHit = par1Entity;
        this.hitVec = Vec3D.createVector(par1Entity.posX, par1Entity.posY, par1Entity.posZ);
    }
}

 

 

I want the line

public Entity entityHit;

to be

public static Entity entityHit;

 

Would that be possible?

 

Do you know exactly what static does... ?

No... and the code i was using gave me some unexpected results... so no longer need it

 

A bit of a tip here: You should put your code down. Go learn Java, make a few test programs, follow some tutorials, and then pick your code back up again.

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.