use of lumien.randomthings.network.messages.MessageVoxelProjector in project Random-Things by lumien231.
the class GuiVoxelProjector method initGui.
@Override
public void initGui() {
super.initGui();
this.buttonList.add(new GuiSlider(0, this.guiLeft + 5, this.guiTop + 90, 120, 20, "Model Rotation: ", "", 0, 360, this.te.getModelRotation(), false, true, new GuiSlider.ISlider() {
@Override
public void onChangeSliderValue(GuiSlider slider) {
int rotation = slider.getValueInt();
GuiVoxelProjector.this.te.setModelRotation(rotation);
if (rotation != GuiVoxelProjector.this.oldRotation) {
GuiVoxelProjector.this.oldRotation = (int) Math.floor(slider.sliderValue * 360);
MessageVoxelProjector message = new MessageVoxelProjector(GuiVoxelProjector.this.te.getPos());
message.setModelRotation(rotation);
PacketHandler.INSTANCE.sendToServer(message);
}
}
}));
this.buttonList.add(new GuiSlider(1, this.guiLeft + 5, this.guiTop + 60, 120, 20, "Scale: ", "", 1, 20, this.te.getScale(), false, true, new GuiSlider.ISlider() {
@Override
public void onChangeSliderValue(GuiSlider slider) {
int scale = slider.getValueInt();
GuiVoxelProjector.this.te.setScale(scale);
if (scale != GuiVoxelProjector.this.oldScale) {
GuiVoxelProjector.this.oldScale = scale;
MessageVoxelProjector message = new MessageVoxelProjector(GuiVoxelProjector.this.te.getPos());
message.setScale(scale);
PacketHandler.INSTANCE.sendToServer(message);
}
}
}));
this.buttonList.add(new GuiSlider(2, this.guiLeft + 5, this.guiTop + 120, 120, 20, "Rotation Speed: ", "", 0, 40, this.te.getRotationSpeed(), false, true, new GuiSlider.ISlider() {
@Override
public void onChangeSliderValue(GuiSlider slider) {
int rotationSpeed = slider.getValueInt();
GuiVoxelProjector.this.te.setRotationSpeed(rotationSpeed);
if (rotationSpeed != GuiVoxelProjector.this.oldRotationSpeed) {
GuiVoxelProjector.this.oldRotationSpeed = rotationSpeed;
MessageVoxelProjector message = new MessageVoxelProjector(GuiVoxelProjector.this.te.getPos());
message.setRotationSpeed(rotationSpeed);
PacketHandler.INSTANCE.sendToServer(message);
}
}
}));
toggleAmbientLight = new GuiCustomButton(this, 3, te.ambientLight(), this.guiLeft + xSize - 25, this.guiTop + 60, 20, 20, "", buttons, 0, 0);
toggleRandomizer = new GuiCustomButton(this, 4, te.randomize(), this.guiLeft + xSize - 25, this.guiTop + 85, 20, 20, "", buttons, 42, 0);
this.buttonList.add(toggleAmbientLight);
this.buttonList.add(toggleRandomizer);
availableModels = new GuiStringList(this, Minecraft.getMinecraft(), 120, 50, this.guiLeft + 5, this.guiTop + 150, width, height, Lists.<String>newArrayList());
}
use of lumien.randomthings.network.messages.MessageVoxelProjector in project Random-Things by lumien231.
the class GuiVoxelProjector method pressed.
@Override
public void pressed(String string) {
MessageVoxelProjector message = new MessageVoxelProjector(this.te.getPos());
message.setModel(string);
PacketHandler.INSTANCE.sendToServer(message);
}
use of lumien.randomthings.network.messages.MessageVoxelProjector in project Random-Things by lumien231.
the class GuiVoxelProjector method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if (button == toggleAmbientLight) {
toggleAmbientLight.toggle();
MessageVoxelProjector message = new MessageVoxelProjector(this.te.getPos());
message.setAmbientLight(toggleAmbientLight.getValue());
PacketHandler.INSTANCE.sendToServer(message);
}
if (button == toggleRandomizer) {
toggleRandomizer.toggle();
MessageVoxelProjector message = new MessageVoxelProjector(this.te.getPos());
message.setRandomize(toggleRandomizer.getValue());
PacketHandler.INSTANCE.sendToServer(message);
}
}
Aggregations