I am trying to update some variables in my class, in a Minecraft forge environment. First of all, I would like to say that the length of the class exceeds 600 lines so I have taken snippets of the code (this will be why certain variables don't get initialised in the following code snippets as they are initialised elsewhere in the class.) I have tried different methods trying to call and changed the variable but none have successfully worked.
Edit: (isAccelerating being set to 2):
if(slot.isItemEqual(new ItemStack(ModItems.Particles, 1, 19))){
            if(this.isAccelerating == 0){
                if(this.module == 1){
                    if(this.energyStored >= 600000){
                        this.j = 1200;
                        this.stoneBuffer = 8;
                        this.isAccelerating = 2;
                        return true;
                    }
                }
                else{
                    this.j = 1200;
                    this.stoneBuffer = 8;
Edit:
It seems that the isAccelerating variable is being set to 2 and is running, however, the energy is not being reduced. Here is where the energy is consumed:
if(i<1200){
            System.out.println("1");
            i++;
            if(i%20 == 0){
                worldObj.playSound(xCoord+5, yCoord, zCoord, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord-5, yCoord, zCoord, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord, yCoord, zCoord+5, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord, yCoord, zCoord-5, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord-5, yCoord, zCoord-5, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord+5, yCoord, zCoord-5, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord-5, yCoord, zCoord+5, "random.explode", 1F, 1F, true);
                worldObj.playSound(xCoord+5, yCoord, zCoord+5, "random.explode", 1F, 1F, true);
            }
            if(this.energyStored < 500){
                System.out.println("2");
                this.energyStored = 0;
                this.isAccelerating = 0;
            }
            else{
                System.out.println("3");
                this.energyStored -= 500;
            }
        }
        else{
            j = 0;
            i = 0;
            this.isAccelerating = 0;
            this.stoneBuffer = 0;
            Entity entity = new EntityItem(worldObj);
            ItemStack itemstack = new ItemStack(ModItems.Particles, 1, 8);
            this.output(itemstack);
        }
In this code, the system will print 1 and 3, suggesting it is running the code where the energy is consumed but not actually doing so.
Edit:
I have found a solution to this issue. For future reference I had to add these lines of code to sync the server and client:
this.markDirty();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
Thanks to those who gave help.
 
     
    