package net.samswi.modminecraft.client.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractButton;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

@Mixin(AbstractWidget.class)
public class ButtonMixin {

    @Inject(at = @At("HEAD"), method = "render")
    public void injectbuild(GuiGraphics guiGraphics, int i, int j, float f, CallbackInfo ci){
        if(Math.random() < 0.2F) ((AbstractWidget)(Object)this).setX((int) (((AbstractWidget)(Object)this).getX() + (int)((Math.random())*3))-1);
        if(Math.random() < 0.2F) ((AbstractWidget)(Object)this).setY((int) (((AbstractWidget)(Object)this).getX() + (int)((Math.random())*3))-1);
        if(Math.random() < 0.2F) ((AbstractWidget)(Object)this).setHeight((int) (((AbstractWidget)(Object)this).getHeight() + (int)((Math.random())*3))-1);
        if(Math.random() < 0.2F) ((AbstractWidget)(Object)this).setWidth((int) (((AbstractWidget)(Object)this).getWidth() + (int)((Math.random())*3))-1);
//        int x = ((AbstractWidget)(Object)this).getX();
//        int y = ((AbstractWidget)(Object)this).getY();

    }

}
