Search in sources :

Example 1 with BipedPart

use of riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart in project Armourers-Workshop by RiskyKen.

the class GuiMannequinTabRotations method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    if (button == resetRotsButton) {
        guiLoaded = false;
        bipedRotations.resetRotations();
        bipedPartChange(activeBipedPart);
        guiLoaded = true;
        checkAndSendRotationValues();
    }
    if (button == randomRotsButton) {
        guiLoaded = false;
        Random rnd = new Random();
        for (int i = 0; i < bipedParts.length; i++) {
            BipedPart part = bipedRotations.getPartForIndex(i);
            if (part != bipedRotations.chest) {
                part.rotationX = (float) Math.toRadians(rnd.nextFloat() * 180F - 90F);
                part.rotationY = (float) Math.toRadians(rnd.nextFloat() * 180F - 90F);
                part.rotationZ = (float) Math.toRadians(rnd.nextFloat() * 180F - 90F);
                bipedPartChange(activeBipedPart);
            }
        }
        guiLoaded = true;
        checkAndSendRotationValues();
    }
}
Also used : BipedPart(riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart) Random(java.util.Random)

Example 2 with BipedPart

use of riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart in project Armourers-Workshop by RiskyKen.

the class GuiMannequinTabRotations method checkAndSendRotationValues.

public void checkAndSendRotationValues() {
    BipedPart activePart = bipedRotations.getPartForIndex(activeBipedPart);
    activePart.setRotationsDegrees((float) -bipedRotXslider.getValue(), (float) -bipedRotYslider.getValue(), (float) -bipedRotZslider.getValue());
    if (!this.bipedRotations.equals(this.lastBipedRotations)) {
        NBTTagCompound compound = new NBTTagCompound();
        this.bipedRotations.saveNBTData(compound);
        this.lastBipedRotations.loadNBTData(compound);
        MessageClientGuiBipedRotations message = new MessageClientGuiBipedRotations(bipedRotations);
        PacketHandler.networkWrapper.sendToServer(message);
    }
}
Also used : MessageClientGuiBipedRotations(riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiBipedRotations) BipedPart(riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 3 with BipedPart

use of riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart in project Armourers-Workshop by RiskyKen.

the class GuiMannequinTabRotations method bipedPartChange.

private void bipedPartChange(int partIndex) {
    activeBipedPart = partIndex;
    BipedPart part = bipedRotations.getPartForIndex(activeBipedPart);
    guiLoaded = false;
    bipedRotXslider.setValue(Math.toDegrees(-part.rotationX));
    bipedRotYslider.setValue(Math.toDegrees(-part.rotationY));
    bipedRotZslider.setValue(Math.toDegrees(-part.rotationZ));
    bipedRotXslider.updateSlider();
    bipedRotYslider.updateSlider();
    bipedRotZslider.updateSlider();
    guiLoaded = true;
}
Also used : BipedPart(riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart)

Aggregations

BipedPart (riskyken.armourersWorkshop.common.data.BipedRotations.BipedPart)3 Random (java.util.Random)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 MessageClientGuiBipedRotations (riskyken.armourersWorkshop.common.network.messages.client.MessageClientGuiBipedRotations)1