* Preparing rotation thing
This commit is contained in:
parent
a27164056a
commit
06925f9ffc
|
|
@ -7,7 +7,6 @@ This is the unfinished port of the WebDisplays mod for Minecraft 1.12.2. The tex
|
||||||
* Read config (see "Config elements" below)
|
* Read config (see "Config elements" below)
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
* Center camera to screen when using keyboard
|
|
||||||
* Top/bottom screen orientation
|
* Top/bottom screen orientation
|
||||||
* GuiSetURL2 missing buttons
|
* GuiSetURL2 missing buttons
|
||||||
* Automatically add protocol to URLs
|
* Automatically add protocol to URLs
|
||||||
|
|
@ -32,3 +31,5 @@ This is the unfinished port of the WebDisplays mod for Minecraft 1.12.2. The tex
|
||||||
* Plugin API
|
* Plugin API
|
||||||
* The Shop
|
* The Shop
|
||||||
* CC Interface, if CC gets updated...
|
* CC Interface, if CC gets updated...
|
||||||
|
* Center camera to screen when using keyboard
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,7 @@ import net.montoyo.wd.core.HasAdvancement;
|
||||||
import net.montoyo.wd.core.JSServerRequest;
|
import net.montoyo.wd.core.JSServerRequest;
|
||||||
import net.montoyo.wd.data.GuiData;
|
import net.montoyo.wd.data.GuiData;
|
||||||
import net.montoyo.wd.entity.TileEntityScreen;
|
import net.montoyo.wd.entity.TileEntityScreen;
|
||||||
import net.montoyo.wd.utilities.BlockSide;
|
import net.montoyo.wd.utilities.*;
|
||||||
import net.montoyo.wd.utilities.NameUUIDPair;
|
|
||||||
import net.montoyo.wd.utilities.Vector2i;
|
|
||||||
import net.montoyo.wd.utilities.Vector3i;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
@ -63,6 +60,9 @@ public class SharedProxy {
|
||||||
public void screenUpdateResolutionInGui(Vector3i pos, BlockSide side, Vector2i res) {
|
public void screenUpdateResolutionInGui(Vector3i pos, BlockSide side, Vector2i res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void screenUpdateRotationInGui(Vector3i pos, BlockSide side, Rotation rot) {
|
||||||
|
}
|
||||||
|
|
||||||
public void displaySetPadURLGui(String padURL) {
|
public void displaySetPadURLGui(String padURL) {
|
||||||
Log.error("Called SharedProxy.displaySetPadURLGui() on server side...");
|
Log.error("Called SharedProxy.displaySetPadURLGui() on server side...");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,16 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void screenUpdateRotationInGui(Vector3i pos, BlockSide side, Rotation rot) {
|
||||||
|
if(mc.currentScreen != null && mc.currentScreen instanceof GuiScreenConfig) {
|
||||||
|
GuiScreenConfig gsc = (GuiScreenConfig) mc.currentScreen;
|
||||||
|
|
||||||
|
if(gsc.isScreen(pos, side))
|
||||||
|
gsc.updateRotation(rot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void displaySetPadURLGui(String padURL) {
|
public void displaySetPadURLGui(String padURL) {
|
||||||
mc.displayGuiScreen(new GuiSetURL2(padURL));
|
mc.displayGuiScreen(new GuiSetURL2(padURL));
|
||||||
|
|
@ -288,7 +298,7 @@ public class ClientProxy extends SharedProxy implements IResourceManagerReloadLi
|
||||||
/**************************************** RESOURCE MANAGER METHODS ****************************************/
|
/**************************************** RESOURCE MANAGER METHODS ****************************************/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResourceManagerReload(IResourceManager rm) {
|
public void onResourceManagerReload(@Nonnull IResourceManager rm) {
|
||||||
Log.info("Resource manager reload: clearing GUI cache...");
|
Log.info("Resource manager reload: clearing GUI cache...");
|
||||||
GuiLoader.clearCache();
|
GuiLoader.clearCache();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -347,6 +347,9 @@ public final class JSQueryDispatcher {
|
||||||
boolean res = (tes.getScreen(side).owner != null && tes.getScreen(side).owner.uuid.equals(mc.player.getGameProfile().getId()));
|
boolean res = (tes.getScreen(side).owner != null && tes.getScreen(side).owner.uuid.equals(mc.player.getGameProfile().getId()));
|
||||||
cb.success("{\"isOwner\":" + (res ? "true}" : "false}"));
|
cb.success("{\"isOwner\":" + (res ? "true}" : "false}"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
register("GetRotation", (cb, tes, side, args) -> cb.success("{\"rotation\":" + tes.getScreen(side).rotation.ordinal() + "}"));
|
||||||
|
register("GetSide", (cb, tes, side, args) -> cb.success("{\"side\":" + tes.getScreen(side).side.ordinal() + "}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
package net.montoyo.wd.client.gui;
|
package net.montoyo.wd.client.gui;
|
||||||
|
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.montoyo.wd.WebDisplays;
|
import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.client.gui.controls.*;
|
import net.montoyo.wd.client.gui.controls.*;
|
||||||
|
|
@ -27,6 +28,7 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
private NameUUIDPair[] friends;
|
private NameUUIDPair[] friends;
|
||||||
private int friendRights;
|
private int friendRights;
|
||||||
private int otherRights;
|
private int otherRights;
|
||||||
|
private Rotation rotation = Rotation.ROT_0;
|
||||||
|
|
||||||
//Autocomplete handling
|
//Autocomplete handling
|
||||||
private boolean waitingAC;
|
private boolean waitingAC;
|
||||||
|
|
@ -96,6 +98,9 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
@FillControl
|
@FillControl
|
||||||
private UpgradeGroup ugUpgrades;
|
private UpgradeGroup ugUpgrades;
|
||||||
|
|
||||||
|
@FillControl
|
||||||
|
private Button btnChangeRot;
|
||||||
|
|
||||||
private CheckBox[] friendBoxes;
|
private CheckBox[] friendBoxes;
|
||||||
private CheckBox[] otherBoxes;
|
private CheckBox[] otherBoxes;
|
||||||
|
|
||||||
|
|
@ -129,6 +134,8 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
TileEntityScreen.Screen scr = tes.getScreen(side);
|
TileEntityScreen.Screen scr = tes.getScreen(side);
|
||||||
if(scr != null) {
|
if(scr != null) {
|
||||||
owner = scr.owner;
|
owner = scr.owner;
|
||||||
|
rotation = scr.rotation;
|
||||||
|
|
||||||
tfResX.setText("" + scr.resolution.x);
|
tfResX.setText("" + scr.resolution.x);
|
||||||
tfResY.setText("" + scr.resolution.y);
|
tfResY.setText("" + scr.resolution.y);
|
||||||
|
|
||||||
|
|
@ -139,7 +146,7 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
if(owner == null)
|
if(owner == null)
|
||||||
owner = new NameUUIDPair("???", UUID.randomUUID());
|
owner = new NameUUIDPair("???", UUID.randomUUID());
|
||||||
|
|
||||||
lblOwner.setLabel(lblOwner.getLabel() + owner.name);
|
lblOwner.setLabel(lblOwner.getLabel() + ' ' + owner.name);
|
||||||
for(NameUUIDPair f : friends)
|
for(NameUUIDPair f : friends)
|
||||||
lstFriends.addElementRaw(f.name, f);
|
lstFriends.addElementRaw(f.name, f);
|
||||||
|
|
||||||
|
|
@ -147,10 +154,15 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
updateRights(friendRights, friendRights, friendBoxes, true);
|
updateRights(friendRights, friendRights, friendBoxes, true);
|
||||||
updateRights(otherRights, otherRights, otherBoxes, true);
|
updateRights(otherRights, otherRights, otherBoxes, true);
|
||||||
updateMyRights();
|
updateMyRights();
|
||||||
|
updateRotationStr();
|
||||||
|
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getRecord(WebDisplays.INSTANCE.soundScreenCfg, 1.0f, 1.0f));
|
mc.getSoundHandler().playSound(PositionedSoundRecord.getRecord(WebDisplays.INSTANCE.soundScreenCfg, 1.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateRotationStr() {
|
||||||
|
btnChangeRot.setLabel(I18n.format("webdisplays.gui.screencfg.rot" + rotation.getAngleAsInt()));
|
||||||
|
}
|
||||||
|
|
||||||
private void addFriend(String name) {
|
private void addFriend(String name) {
|
||||||
if(!name.isEmpty()) {
|
if(!name.isEmpty()) {
|
||||||
requestAutocomplete(name, true);
|
requestAutocomplete(name, true);
|
||||||
|
|
@ -188,6 +200,10 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
addFriend(tfFriend.getText().trim());
|
addFriend(tfFriend.getText().trim());
|
||||||
else if(ev.getSource() == btnSetRes)
|
else if(ev.getSource() == btnSetRes)
|
||||||
clickSetRes();
|
clickSetRes();
|
||||||
|
else if(ev.getSource() == btnChangeRot) {
|
||||||
|
Rotation[] rots = Rotation.values();
|
||||||
|
WebDisplays.NET_HANDLER.sendToServer(new SMessageScreenCtrl(tes, side, rots[(rotation.ordinal() + 1) % rots.length]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GuiSubscribe
|
@GuiSubscribe
|
||||||
|
|
@ -419,6 +435,7 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
flag = (myRights & ScreenRights.CHANGE_RESOLUTION) == 0;
|
flag = (myRights & ScreenRights.CHANGE_RESOLUTION) == 0;
|
||||||
tfResX.setDisabled(flag);
|
tfResX.setDisabled(flag);
|
||||||
tfResY.setDisabled(flag);
|
tfResY.setDisabled(flag);
|
||||||
|
btnChangeRot.setDisabled(flag);
|
||||||
|
|
||||||
if(flag)
|
if(flag)
|
||||||
btnSetRes.setDisabled(true);
|
btnSetRes.setDisabled(true);
|
||||||
|
|
@ -433,4 +450,9 @@ public class GuiScreenConfig extends WDScreen {
|
||||||
btnSetRes.setDisabled(true);
|
btnSetRes.setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateRotation(Rotation rot) {
|
||||||
|
rotation = rot;
|
||||||
|
updateRotationStr();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.montoyo.wd.WebDisplays;
|
import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.client.ClientProxy;
|
import net.montoyo.wd.client.ClientProxy;
|
||||||
import net.montoyo.wd.entity.TileEntityScreen;
|
import net.montoyo.wd.entity.TileEntityScreen;
|
||||||
|
import net.montoyo.wd.utilities.Rotation;
|
||||||
import net.montoyo.wd.utilities.Vector3f;
|
import net.montoyo.wd.utilities.Vector3f;
|
||||||
import net.montoyo.wd.utilities.Vector3i;
|
import net.montoyo.wd.utilities.Vector3i;
|
||||||
|
|
||||||
|
|
@ -41,7 +42,12 @@ public class ScreenRenderer extends TileEntitySpecialRenderer<TileEntityScreen>
|
||||||
TileEntityScreen.Screen scr = te.getScreen(i);
|
TileEntityScreen.Screen scr = te.getScreen(i);
|
||||||
if(scr.browser == null) {
|
if(scr.browser == null) {
|
||||||
scr.browser = ((ClientProxy) WebDisplays.PROXY).getMCEF().createBrowser(scr.url);
|
scr.browser = ((ClientProxy) WebDisplays.PROXY).getMCEF().createBrowser(scr.url);
|
||||||
scr.browser.resize(scr.resolution.x, scr.resolution.y);
|
|
||||||
|
if(scr.rotation.isVertical)
|
||||||
|
scr.browser.resize(scr.resolution.y, scr.resolution.x);
|
||||||
|
else
|
||||||
|
scr.browser.resize(scr.resolution.x, scr.resolution.y);
|
||||||
|
|
||||||
scr.doTurnOnAnim = true;
|
scr.doTurnOnAnim = true;
|
||||||
scr.turnOnTime = System.currentTimeMillis();
|
scr.turnOnTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
@ -98,9 +104,18 @@ public class ScreenRenderer extends TileEntitySpecialRenderer<TileEntityScreen>
|
||||||
glScalef(ft, ft, 1.0f);
|
glScalef(ft, ft, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!scr.rotation.isNull)
|
||||||
|
glRotatef(scr.rotation.angle, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
float sw = ((float) scr.size.x) * 0.5f - 2.f / 16.f;
|
float sw = ((float) scr.size.x) * 0.5f - 2.f / 16.f;
|
||||||
float sh = ((float) scr.size.y) * 0.5f - 2.f / 16.f;
|
float sh = ((float) scr.size.y) * 0.5f - 2.f / 16.f;
|
||||||
|
|
||||||
|
if(scr.rotation.isVertical) {
|
||||||
|
float tmp = sw;
|
||||||
|
sw = sh;
|
||||||
|
sh = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: Use tesselator
|
//TODO: Use tesselator
|
||||||
glBindTexture(GL_TEXTURE_2D, scr.browser.getTextureID());
|
glBindTexture(GL_TEXTURE_2D, scr.browser.getTextureID());
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ package net.montoyo.wd.core;
|
||||||
public abstract class ScreenRights {
|
public abstract class ScreenRights {
|
||||||
|
|
||||||
public static final int CHANGE_URL = 1;
|
public static final int CHANGE_URL = 1;
|
||||||
public static final int CLICK = 2;
|
public static final int CLICK = 2; //Click AND type
|
||||||
public static final int MANAGE_FRIEND_LIST = 4;
|
public static final int MANAGE_FRIEND_LIST = 4;
|
||||||
public static final int MANAGE_OTHER_RIGHTS = 8;
|
public static final int MANAGE_OTHER_RIGHTS = 8;
|
||||||
public static final int MANAGE_UPGRADES = 16;
|
public static final int MANAGE_UPGRADES = 16;
|
||||||
public static final int CHANGE_RESOLUTION = 32;
|
public static final int CHANGE_RESOLUTION = 32; //Change resolution AND rotation
|
||||||
|
|
||||||
public static final int NONE = 0;
|
public static final int NONE = 0;
|
||||||
public static final int ALL = 0xFF;
|
public static final int ALL = 0xFF;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import net.montoyo.wd.net.CMessageJSResponse;
|
||||||
import net.montoyo.wd.net.CMessageScreenUpdate;
|
import net.montoyo.wd.net.CMessageScreenUpdate;
|
||||||
import net.montoyo.wd.net.SMessageRequestTEData;
|
import net.montoyo.wd.net.SMessageRequestTEData;
|
||||||
import net.montoyo.wd.utilities.*;
|
import net.montoyo.wd.utilities.*;
|
||||||
|
import net.montoyo.wd.utilities.Rotation;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -41,6 +42,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
public BlockSide side;
|
public BlockSide side;
|
||||||
public Vector2i size;
|
public Vector2i size;
|
||||||
public Vector2i resolution;
|
public Vector2i resolution;
|
||||||
|
public Rotation rotation = Rotation.ROT_0;
|
||||||
public String url;
|
public String url;
|
||||||
private VideoType videoType;
|
private VideoType videoType;
|
||||||
public NameUUIDPair owner;
|
public NameUUIDPair owner;
|
||||||
|
|
@ -60,6 +62,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
ret.side = BlockSide.values()[tag.getByte("Side")];
|
ret.side = BlockSide.values()[tag.getByte("Side")];
|
||||||
ret.size = new Vector2i(tag.getInteger("Width"), tag.getInteger("Height"));
|
ret.size = new Vector2i(tag.getInteger("Width"), tag.getInteger("Height"));
|
||||||
ret.resolution = new Vector2i(tag.getInteger("ResolutionX"), tag.getInteger("ResolutionY"));
|
ret.resolution = new Vector2i(tag.getInteger("ResolutionX"), tag.getInteger("ResolutionY"));
|
||||||
|
ret.rotation = Rotation.values()[tag.getByte("Rotation")];
|
||||||
ret.url = tag.getString("URL");
|
ret.url = tag.getString("URL");
|
||||||
ret.videoType = VideoType.getTypeFromURL(ret.url);
|
ret.videoType = VideoType.getTypeFromURL(ret.url);
|
||||||
|
|
||||||
|
|
@ -109,6 +112,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
tag.setInteger("Height", size.y);
|
tag.setInteger("Height", size.y);
|
||||||
tag.setInteger("ResolutionX", resolution.x);
|
tag.setInteger("ResolutionX", resolution.x);
|
||||||
tag.setInteger("ResolutionY", resolution.y);
|
tag.setInteger("ResolutionY", resolution.y);
|
||||||
|
tag.setByte("Rotation", (byte) rotation.ordinal());
|
||||||
tag.setString("URL", url);
|
tag.setString("URL", url);
|
||||||
|
|
||||||
if(owner == null)
|
if(owner == null)
|
||||||
|
|
@ -353,7 +357,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
|
|
||||||
if(!world.isRemote) {
|
if(!world.isRemote) {
|
||||||
if(screens.isEmpty()) //No more screens: remove tile entity
|
if(screens.isEmpty()) //No more screens: remove tile entity
|
||||||
world.setBlockState(getPos(), WebDisplays.INSTANCE.blockScreen.getDefaultState().withProperty(BlockScreen.hasTE, false));
|
world.setBlockState(pos, WebDisplays.INSTANCE.blockScreen.getDefaultState().withProperty(BlockScreen.hasTE, false));
|
||||||
else
|
else
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
@ -374,7 +378,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
scr.resolution = res;
|
scr.resolution = res;
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
WebDisplays.PROXY.screenUpdateResolutionInGui(new Vector3i(getPos()), side, res);
|
WebDisplays.PROXY.screenUpdateResolutionInGui(new Vector3i(pos), side, res);
|
||||||
|
|
||||||
if(scr.browser != null) {
|
if(scr.browser != null) {
|
||||||
scr.browser.close();
|
scr.browser.close();
|
||||||
|
|
@ -638,7 +642,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
super.validate();
|
super.validate();
|
||||||
|
|
||||||
if(world.isRemote)
|
if(world.isRemote)
|
||||||
Log.info("===> TES( VALIDATE) %s", getPos().toString());
|
Log.info("===> TES( VALIDATE) %s", pos.toString());
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -646,7 +650,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
|
||||||
if(world.isRemote) {
|
if(world.isRemote) {
|
||||||
Log.info("===> TES(INVALIDATE) %s", getPos().toString());
|
Log.info("===> TES(INVALIDATE) %s", pos.toString());
|
||||||
onChunkUnload();
|
onChunkUnload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -801,6 +805,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.upgrade(this, side), point());
|
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.upgrade(this, side), point());
|
||||||
itemAsUpgrade.onInstall(this, side, player, isCopy);
|
itemAsUpgrade.onInstall(this, side, player, isCopy);
|
||||||
playSoundAt(WebDisplays.INSTANCE.soundUpgradeAdd, pos, 1.0f, 1.0f);
|
playSoundAt(WebDisplays.INSTANCE.soundUpgradeAdd, pos, 1.0f, 1.0f);
|
||||||
|
markDirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -854,6 +859,7 @@ public class TileEntityScreen extends TileEntity {
|
||||||
scr.upgrades.remove(idxToRemove);
|
scr.upgrades.remove(idxToRemove);
|
||||||
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.upgrade(this, side), point());
|
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.upgrade(this, side), point());
|
||||||
playSoundAt(WebDisplays.INSTANCE.soundUpgradeDel, pos, 1.0f, 1.0f);
|
playSoundAt(WebDisplays.INSTANCE.soundUpgradeDel, pos, 1.0f, 1.0f);
|
||||||
|
markDirty();
|
||||||
} else
|
} else
|
||||||
Log.warning("Tried to remove non-existing upgrade %s to screen %s at %s", safeName(is), side.toString(), pos.toString());
|
Log.warning("Tried to remove non-existing upgrade %s to screen %s at %s", safeName(is), side.toString(), pos.toString());
|
||||||
}
|
}
|
||||||
|
|
@ -957,6 +963,31 @@ public class TileEntityScreen extends TileEntity {
|
||||||
scr.owner = new NameUUIDPair(newOwner.getGameProfile());
|
scr.owner = new NameUUIDPair(newOwner.getGameProfile());
|
||||||
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.owner(this, side, scr.owner), point());
|
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.owner(this, side, scr.owner), point());
|
||||||
checkLaserUserRights(scr);
|
checkLaserUserRights(scr);
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRotation(BlockSide side, Rotation rot) {
|
||||||
|
Screen scr = getScreen(side);
|
||||||
|
if(scr == null) {
|
||||||
|
Log.error("Trying to change rotation of invalid screen on side %s", side.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(world.isRemote) {
|
||||||
|
boolean oldWasVertical = scr.rotation.isVertical;
|
||||||
|
scr.rotation = rot;
|
||||||
|
|
||||||
|
WebDisplays.PROXY.screenUpdateRotationInGui(new Vector3i(pos), side, rot);
|
||||||
|
|
||||||
|
if(scr.browser != null && oldWasVertical != rot.isVertical) {
|
||||||
|
scr.browser.close();
|
||||||
|
scr.browser = null; //Will be re-created by renderer
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
scr.rotation = rot;
|
||||||
|
WebDisplays.NET_HANDLER.sendToAllAround(CMessageScreenUpdate.rotation(this, side, rot), point());
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ public class CMessageAddScreen implements IMessage, Runnable {
|
||||||
screens[i].size = new Vector2i(buf);
|
screens[i].size = new Vector2i(buf);
|
||||||
screens[i].url = ByteBufUtils.readUTF8String(buf);
|
screens[i].url = ByteBufUtils.readUTF8String(buf);
|
||||||
screens[i].resolution = new Vector2i(buf);
|
screens[i].resolution = new Vector2i(buf);
|
||||||
|
screens[i].rotation = Rotation.values()[buf.readByte() & 3];
|
||||||
screens[i].owner = new NameUUIDPair(buf);
|
screens[i].owner = new NameUUIDPair(buf);
|
||||||
screens[i].upgrades = new ArrayList<>();
|
screens[i].upgrades = new ArrayList<>();
|
||||||
|
|
||||||
|
|
@ -75,6 +76,7 @@ public class CMessageAddScreen implements IMessage, Runnable {
|
||||||
scr.size.writeTo(buf);
|
scr.size.writeTo(buf);
|
||||||
ByteBufUtils.writeUTF8String(buf, scr.url);
|
ByteBufUtils.writeUTF8String(buf, scr.url);
|
||||||
scr.resolution.writeTo(buf);
|
scr.resolution.writeTo(buf);
|
||||||
|
buf.writeByte(scr.rotation.ordinal());
|
||||||
scr.owner.writeTo(buf);
|
scr.owner.writeTo(buf);
|
||||||
buf.writeByte(scr.upgrades.size());
|
buf.writeByte(scr.upgrades.size());
|
||||||
|
|
||||||
|
|
@ -99,9 +101,10 @@ public class CMessageAddScreen implements IMessage, Runnable {
|
||||||
|
|
||||||
for(TileEntityScreen.Screen entry: screens) {
|
for(TileEntityScreen.Screen entry: screens) {
|
||||||
TileEntityScreen.Screen scr = tes.addScreen(entry.side, entry.size, entry.resolution, null, false);
|
TileEntityScreen.Screen scr = tes.addScreen(entry.side, entry.size, entry.resolution, null, false);
|
||||||
|
scr.rotation = entry.rotation;
|
||||||
scr.url = entry.url;
|
scr.url = entry.url;
|
||||||
scr.upgrades = entry.upgrades;
|
|
||||||
scr.owner = entry.owner;
|
scr.owner = entry.owner;
|
||||||
|
scr.upgrades = entry.upgrades;
|
||||||
|
|
||||||
if(scr.browser != null)
|
if(scr.browser != null)
|
||||||
scr.browser.loadURL(entry.url);
|
scr.browser.loadURL(entry.url);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ public class CMessageScreenUpdate implements IMessage, Runnable {
|
||||||
public static final int UPDATE_UPGRADES = 5;
|
public static final int UPDATE_UPGRADES = 5;
|
||||||
public static final int UPDATE_JS_REDSTONE = 6;
|
public static final int UPDATE_JS_REDSTONE = 6;
|
||||||
public static final int UPDATE_OWNER = 7;
|
public static final int UPDATE_OWNER = 7;
|
||||||
|
public static final int UPDATE_ROTATION = 8;
|
||||||
|
|
||||||
public static final int MOUSE_CLICK = 0;
|
public static final int MOUSE_CLICK = 0;
|
||||||
public static final int MOUSE_UP = 1;
|
public static final int MOUSE_UP = 1;
|
||||||
|
|
@ -45,6 +46,7 @@ public class CMessageScreenUpdate implements IMessage, Runnable {
|
||||||
private ItemStack[] upgrades;
|
private ItemStack[] upgrades;
|
||||||
private int redstoneLevel;
|
private int redstoneLevel;
|
||||||
private NameUUIDPair owner;
|
private NameUUIDPair owner;
|
||||||
|
private Rotation rotation;
|
||||||
|
|
||||||
public CMessageScreenUpdate() {
|
public CMessageScreenUpdate() {
|
||||||
}
|
}
|
||||||
|
|
@ -132,6 +134,16 @@ public class CMessageScreenUpdate implements IMessage, Runnable {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CMessageScreenUpdate rotation(TileEntityScreen tes, BlockSide side, Rotation rot) {
|
||||||
|
CMessageScreenUpdate ret = new CMessageScreenUpdate();
|
||||||
|
ret.pos = new Vector3i(tes.getPos());
|
||||||
|
ret.side = side;
|
||||||
|
ret.action = UPDATE_ROTATION;
|
||||||
|
ret.rotation = rot;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromBytes(ByteBuf buf) {
|
public void fromBytes(ByteBuf buf) {
|
||||||
pos = new Vector3i(buf);
|
pos = new Vector3i(buf);
|
||||||
|
|
@ -159,6 +171,8 @@ public class CMessageScreenUpdate implements IMessage, Runnable {
|
||||||
redstoneLevel = buf.readByte();
|
redstoneLevel = buf.readByte();
|
||||||
} else if(action == UPDATE_OWNER)
|
} else if(action == UPDATE_OWNER)
|
||||||
owner = new NameUUIDPair(buf);
|
owner = new NameUUIDPair(buf);
|
||||||
|
else if(action == UPDATE_ROTATION)
|
||||||
|
rotation = Rotation.values()[buf.readByte() & 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -188,6 +202,8 @@ public class CMessageScreenUpdate implements IMessage, Runnable {
|
||||||
buf.writeByte(redstoneLevel);
|
buf.writeByte(redstoneLevel);
|
||||||
} else if(action == UPDATE_OWNER)
|
} else if(action == UPDATE_OWNER)
|
||||||
owner.writeTo(buf);
|
owner.writeTo(buf);
|
||||||
|
else if(action == UPDATE_ROTATION)
|
||||||
|
buf.writeByte(rotation.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -224,7 +240,9 @@ public class CMessageScreenUpdate implements IMessage, Runnable {
|
||||||
|
|
||||||
if(scr != null)
|
if(scr != null)
|
||||||
scr.owner = owner;
|
scr.owner = owner;
|
||||||
} else
|
} else if(action == UPDATE_ROTATION)
|
||||||
|
tes.setRotation(side, rotation);
|
||||||
|
else
|
||||||
Log.warning("===> TODO"); //TODO
|
Log.warning("===> TODO"); //TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
public static final int CTRL_LASER_MOVE = 9;
|
public static final int CTRL_LASER_MOVE = 9;
|
||||||
public static final int CTRL_LASER_UP = 10;
|
public static final int CTRL_LASER_UP = 10;
|
||||||
public static final int CTRL_JS_REQUEST = 11;
|
public static final int CTRL_JS_REQUEST = 11;
|
||||||
|
public static final int CTRL_SET_ROTATION = 12;
|
||||||
|
|
||||||
private int ctrl;
|
private int ctrl;
|
||||||
private int dim;
|
private int dim;
|
||||||
|
|
@ -54,6 +55,7 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
private int jsReqID;
|
private int jsReqID;
|
||||||
private JSServerRequest jsReqType;
|
private JSServerRequest jsReqType;
|
||||||
private Object[] jsReqData;
|
private Object[] jsReqData;
|
||||||
|
private Rotation rotation;
|
||||||
|
|
||||||
public SMessageScreenCtrl() {
|
public SMessageScreenCtrl() {
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +101,14 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
toRemove = toRem;
|
toRemove = toRem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SMessageScreenCtrl(TileEntityScreen tes, BlockSide side, Rotation rot) {
|
||||||
|
ctrl = CTRL_SET_ROTATION;
|
||||||
|
dim = tes.getWorld().provider.getDimension();
|
||||||
|
pos = new Vector3i(tes.getPos());
|
||||||
|
this.side = side;
|
||||||
|
rotation = rot;
|
||||||
|
}
|
||||||
|
|
||||||
public static SMessageScreenCtrl type(TileEntityScreen tes, BlockSide side, String text, BlockPos soundPos) {
|
public static SMessageScreenCtrl type(TileEntityScreen tes, BlockSide side, String text, BlockPos soundPos) {
|
||||||
SMessageScreenCtrl ret = new SMessageScreenCtrl();
|
SMessageScreenCtrl ret = new SMessageScreenCtrl();
|
||||||
ret.ctrl = CTRL_TYPE;
|
ret.ctrl = CTRL_TYPE;
|
||||||
|
|
@ -157,7 +167,7 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
ctrl = buf.readByte();
|
ctrl = buf.readByte();
|
||||||
dim = buf.readInt();
|
dim = buf.readInt();
|
||||||
pos = new Vector3i(buf);
|
pos = new Vector3i(buf);
|
||||||
side = BlockSide.values()[buf.readByte()];
|
side = BlockSide.fromInt(buf.readByte());
|
||||||
|
|
||||||
if(ctrl == CTRL_SET_URL)
|
if(ctrl == CTRL_SET_URL)
|
||||||
url = ByteBufUtils.readUTF8String(buf);
|
url = ByteBufUtils.readUTF8String(buf);
|
||||||
|
|
@ -183,7 +193,8 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
|
|
||||||
if(jsReqType != null)
|
if(jsReqType != null)
|
||||||
jsReqData = jsReqType.deserialize(buf);
|
jsReqData = jsReqType.deserialize(buf);
|
||||||
}
|
} else if(ctrl == CTRL_SET_ROTATION)
|
||||||
|
rotation = Rotation.values()[buf.readByte() & 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -215,11 +226,17 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
|
|
||||||
if(!jsReqType.serialize(buf, jsReqData))
|
if(!jsReqType.serialize(buf, jsReqData))
|
||||||
throw new RuntimeException("Could not serialize CTRL_JS_REQUEST " + jsReqType);
|
throw new RuntimeException("Could not serialize CTRL_JS_REQUEST " + jsReqType);
|
||||||
}
|
} else if(ctrl == CTRL_SET_ROTATION)
|
||||||
|
buf.writeByte(rotation.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if(side == null) {
|
||||||
|
Log.warning("Caught invalid packet from %s (UUID %s) referencing an invalid block side", player.getName(), player.getGameProfile().getId().toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
runUnsafe();
|
runUnsafe();
|
||||||
} catch(MissingPermissionException e) {
|
} catch(MissingPermissionException e) {
|
||||||
|
|
@ -242,7 +259,7 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
|
|
||||||
TileEntity te = world.getTileEntity(bp);
|
TileEntity te = world.getTileEntity(bp);
|
||||||
if(te == null || !(te instanceof TileEntityScreen)) {
|
if(te == null || !(te instanceof TileEntityScreen)) {
|
||||||
Log.error("TileEntity at %s is not a screen; can't change url!", pos.toString());
|
Log.error("TileEntity at %s is not a screen; can't control it!", pos.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -262,11 +279,14 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
tes.removeFriend(player, side, friend);
|
tes.removeFriend(player, side, friend);
|
||||||
} else if(ctrl == CTRL_SET_RIGHTS) {
|
} else if(ctrl == CTRL_SET_RIGHTS) {
|
||||||
TileEntityScreen.Screen scr = tes.getScreen(side);
|
TileEntityScreen.Screen scr = tes.getScreen(side);
|
||||||
int fr = scr.owner.uuid.equals(player.getGameProfile().getId()) ? friendRights : scr.friendRights;
|
|
||||||
int or = (scr.rightsFor(player) & ScreenRights.MANAGE_OTHER_RIGHTS) == 0 ? scr.otherRights : otherRights;
|
|
||||||
|
|
||||||
if(scr.friendRights != fr || scr.otherRights != or)
|
if(scr != null) {
|
||||||
tes.setRights(player, side, fr, or);
|
int fr = scr.owner.uuid.equals(player.getGameProfile().getId()) ? friendRights : scr.friendRights;
|
||||||
|
int or = (scr.rightsFor(player) & ScreenRights.MANAGE_OTHER_RIGHTS) == 0 ? scr.otherRights : otherRights;
|
||||||
|
|
||||||
|
if(scr.friendRights != fr || scr.otherRights != or)
|
||||||
|
tes.setRights(player, side, fr, or);
|
||||||
|
}
|
||||||
} else if(ctrl == CTRL_SET_RESOLUTION) {
|
} else if(ctrl == CTRL_SET_RESOLUTION) {
|
||||||
checkPermission(tes, ScreenRights.CHANGE_RESOLUTION);
|
checkPermission(tes, ScreenRights.CHANGE_RESOLUTION);
|
||||||
tes.setResolution(side, vec2i);
|
tes.setResolution(side, vec2i);
|
||||||
|
|
@ -285,6 +305,9 @@ public class SMessageScreenCtrl implements IMessage, Runnable {
|
||||||
Log.warning("Caught invalid JS request from player %s (UUID %s)", player.getName(), player.getGameProfile().getId().toString());
|
Log.warning("Caught invalid JS request from player %s (UUID %s)", player.getName(), player.getGameProfile().getId().toString());
|
||||||
else
|
else
|
||||||
tes.handleJSRequest(player, side, jsReqID, jsReqType, jsReqData);
|
tes.handleJSRequest(player, side, jsReqID, jsReqType, jsReqData);
|
||||||
|
} else if(ctrl == CTRL_SET_ROTATION) {
|
||||||
|
checkPermission(tes, ScreenRights.CHANGE_RESOLUTION);
|
||||||
|
tes.setRotation(side, rotation);
|
||||||
} else
|
} else
|
||||||
Log.info("SMessageScreenCtrl: TODO"); //TODO: other ctrl messages
|
Log.info("SMessageScreenCtrl: TODO"); //TODO: other ctrl messages
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,4 +45,9 @@ public enum BlockSide {
|
||||||
return div * 2 + rest;
|
return div * 2 + rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockSide fromInt(int s) {
|
||||||
|
BlockSide[] values = values();
|
||||||
|
return (s < 0 || s >= values.length) ? null : values[s];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
28
src/main/java/net/montoyo/wd/utilities/Rotation.java
Normal file
28
src/main/java/net/montoyo/wd/utilities/Rotation.java
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 BARBOTIN Nicolas
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.montoyo.wd.utilities;
|
||||||
|
|
||||||
|
public enum Rotation {
|
||||||
|
|
||||||
|
ROT_0(0.0f, false),
|
||||||
|
ROT_90(90.0f, true),
|
||||||
|
ROT_180(180.0f, false),
|
||||||
|
ROT_270(270.0f, true);
|
||||||
|
|
||||||
|
public final float angle;
|
||||||
|
public final boolean isVertical;
|
||||||
|
public final boolean isNull;
|
||||||
|
|
||||||
|
Rotation(float a, boolean v) {
|
||||||
|
angle = a;
|
||||||
|
isVertical = v;
|
||||||
|
isNull = (a == 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAngleAsInt() {
|
||||||
|
return (int) angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,186 +1,198 @@
|
||||||
{
|
{
|
||||||
"controls": [
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"name": "lblOwner",
|
||||||
|
"label": "$webdisplays.gui.screencfg.owner",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"shadowed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"label": "$webdisplays.gui.screencfg.friends",
|
||||||
|
"x": 0,
|
||||||
|
"y": 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "List",
|
||||||
|
"name": "lstFriends",
|
||||||
|
"x": 0,
|
||||||
|
"y": 24,
|
||||||
|
"width": 100,
|
||||||
|
"height": 170,
|
||||||
|
"selectionColor": "red"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextField",
|
||||||
|
"name": "tfFriend",
|
||||||
|
"x": 0,
|
||||||
|
"y": 198,
|
||||||
|
"width": 76,
|
||||||
|
"maxLength": 128
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "btnAdd",
|
||||||
|
"x": 80,
|
||||||
|
"y": 199,
|
||||||
|
"width": 20,
|
||||||
|
"label": "+"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"x": 104,
|
||||||
|
"y": 12,
|
||||||
|
"label": "$webdisplays.gui.screencfg.permissions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ControlGroup",
|
||||||
|
"name": "grpFriends",
|
||||||
|
"x": 104,
|
||||||
|
"y": 24,
|
||||||
|
"label": "$webdisplays.gui.screencfg.friends",
|
||||||
|
"width": 150,
|
||||||
|
"height": 112,
|
||||||
|
"childs": [
|
||||||
{
|
{
|
||||||
"type": "Label",
|
"type": "CheckBox",
|
||||||
"name": "lblOwner",
|
"name": "boxFSetUrl",
|
||||||
"label": "$webdisplays.gui.screencfg.owner",
|
"x": 0,
|
||||||
"x": 0,
|
"y": 0,
|
||||||
"y": 0,
|
"label": "$webdisplays.gui.screencfg.seturl"
|
||||||
"shadowed": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Label",
|
"type": "CheckBox",
|
||||||
"label": "$webdisplays.gui.screencfg.friends",
|
"name": "boxFClick",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 12
|
"y": 16,
|
||||||
|
"label": "$webdisplays.gui.screencfg.click"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "List",
|
"type": "CheckBox",
|
||||||
"name": "lstFriends",
|
"name": "boxFFriends",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 24,
|
"y": 32,
|
||||||
"width": 100,
|
"label": "$webdisplays.gui.screencfg.friendlist"
|
||||||
"height": 170,
|
|
||||||
"selectionColor": "red"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "TextField",
|
"type": "CheckBox",
|
||||||
"name": "tfFriend",
|
"name": "boxFOthers",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 198,
|
"y": 48,
|
||||||
"width": 76,
|
"label": "$webdisplays.gui.screencfg.otherrights"
|
||||||
"maxLength": 128
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Button",
|
"type": "CheckBox",
|
||||||
"name": "btnAdd",
|
"name": "boxFUpgrades",
|
||||||
"x": 80,
|
"x": 0,
|
||||||
"y": 199,
|
"y": 64,
|
||||||
"width": 20,
|
"label": "$webdisplays.gui.screencfg.mupgrades"
|
||||||
"label": "+"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "Label",
|
"type": "CheckBox",
|
||||||
"x": 104,
|
"name": "boxFResolution",
|
||||||
"y": 12,
|
"x": 0,
|
||||||
"label": "$webdisplays.gui.screencfg.permissions"
|
"y": 80,
|
||||||
},
|
"label": "$webdisplays.gui.screencfg.mres"
|
||||||
{
|
|
||||||
"type": "ControlGroup",
|
|
||||||
"name": "grpFriends",
|
|
||||||
"x": 104,
|
|
||||||
"y": 24,
|
|
||||||
"label": "$webdisplays.gui.screencfg.friends",
|
|
||||||
"width": 150,
|
|
||||||
"height": 112,
|
|
||||||
"childs": [
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxFSetUrl",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"label": "$webdisplays.gui.screencfg.seturl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxFClick",
|
|
||||||
"x": 0,
|
|
||||||
"y": 16,
|
|
||||||
"label": "$webdisplays.gui.screencfg.click"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxFFriends",
|
|
||||||
"x": 0,
|
|
||||||
"y": 32,
|
|
||||||
"label": "$webdisplays.gui.screencfg.friendlist"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxFOthers",
|
|
||||||
"x": 0,
|
|
||||||
"y": 48,
|
|
||||||
"label": "$webdisplays.gui.screencfg.otherrights"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxFUpgrades",
|
|
||||||
"x": 0,
|
|
||||||
"y": 64,
|
|
||||||
"label": "$webdisplays.gui.screencfg.mupgrades"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxFResolution",
|
|
||||||
"x": 0,
|
|
||||||
"y": 80,
|
|
||||||
"label": "$webdisplays.gui.screencfg.mres"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ControlGroup",
|
|
||||||
"name": "grpOthers",
|
|
||||||
"x": 104,
|
|
||||||
"y": 140,
|
|
||||||
"label": "$webdisplays.gui.screencfg.others",
|
|
||||||
"width": 150,
|
|
||||||
"height": 80,
|
|
||||||
"childs": [
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxOSetUrl",
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"label": "$webdisplays.gui.screencfg.seturl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxOClick",
|
|
||||||
"x": 0,
|
|
||||||
"y": 16,
|
|
||||||
"label": "$webdisplays.gui.screencfg.click"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxOUpgrades",
|
|
||||||
"x": 0,
|
|
||||||
"y": 32,
|
|
||||||
"label": "$webdisplays.gui.screencfg.mupgrades"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "CheckBox",
|
|
||||||
"name": "boxOResolution",
|
|
||||||
"x": 0,
|
|
||||||
"y": 48,
|
|
||||||
"label": "$webdisplays.gui.screencfg.mres"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Label",
|
|
||||||
"x": 258,
|
|
||||||
"y": 12,
|
|
||||||
"label": "$webdisplays.gui.screencfg.upgrades"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "UpgradeGroup",
|
|
||||||
"name": "ugUpgrades",
|
|
||||||
"x": 258,
|
|
||||||
"y": 23
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Label",
|
|
||||||
"x": 258,
|
|
||||||
"y": 42,
|
|
||||||
"label": "$webdisplays.gui.screencfg.resolution"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TextField",
|
|
||||||
"name": "tfResX",
|
|
||||||
"x": 260,
|
|
||||||
"y": 54,
|
|
||||||
"width": 40,
|
|
||||||
"maxLength": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "TextField",
|
|
||||||
"name": "tfResY",
|
|
||||||
"x": 304,
|
|
||||||
"y": 54,
|
|
||||||
"width": 40,
|
|
||||||
"maxLength": 4
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "btnSetRes",
|
|
||||||
"x": 260,
|
|
||||||
"y": 78,
|
|
||||||
"width": 84,
|
|
||||||
"label": "$webdisplays.gui.screencfg.setres",
|
|
||||||
"disabled": true
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
|
},
|
||||||
"center": true
|
{
|
||||||
|
"type": "ControlGroup",
|
||||||
|
"name": "grpOthers",
|
||||||
|
"x": 104,
|
||||||
|
"y": 140,
|
||||||
|
"label": "$webdisplays.gui.screencfg.others",
|
||||||
|
"width": 150,
|
||||||
|
"height": 80,
|
||||||
|
"childs": [
|
||||||
|
{
|
||||||
|
"type": "CheckBox",
|
||||||
|
"name": "boxOSetUrl",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"label": "$webdisplays.gui.screencfg.seturl"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CheckBox",
|
||||||
|
"name": "boxOClick",
|
||||||
|
"x": 0,
|
||||||
|
"y": 16,
|
||||||
|
"label": "$webdisplays.gui.screencfg.click"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CheckBox",
|
||||||
|
"name": "boxOUpgrades",
|
||||||
|
"x": 0,
|
||||||
|
"y": 32,
|
||||||
|
"label": "$webdisplays.gui.screencfg.mupgrades"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CheckBox",
|
||||||
|
"name": "boxOResolution",
|
||||||
|
"x": 0,
|
||||||
|
"y": 48,
|
||||||
|
"label": "$webdisplays.gui.screencfg.mres"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"x": 258,
|
||||||
|
"y": 12,
|
||||||
|
"label": "$webdisplays.gui.screencfg.upgrades"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "UpgradeGroup",
|
||||||
|
"name": "ugUpgrades",
|
||||||
|
"x": 258,
|
||||||
|
"y": 23
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"x": 258,
|
||||||
|
"y": 42,
|
||||||
|
"label": "$webdisplays.gui.screencfg.resolution"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextField",
|
||||||
|
"name": "tfResX",
|
||||||
|
"x": 260,
|
||||||
|
"y": 54,
|
||||||
|
"width": 40,
|
||||||
|
"maxLength": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "TextField",
|
||||||
|
"name": "tfResY",
|
||||||
|
"x": 304,
|
||||||
|
"y": 54,
|
||||||
|
"width": 40,
|
||||||
|
"maxLength": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "btnSetRes",
|
||||||
|
"x": 260,
|
||||||
|
"y": 78,
|
||||||
|
"width": 84,
|
||||||
|
"label": "$webdisplays.gui.screencfg.setres",
|
||||||
|
"disabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Label",
|
||||||
|
"x": 258,
|
||||||
|
"y": 105,
|
||||||
|
"label": "$webdisplays.gui.screencfg.rotation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Button",
|
||||||
|
"name": "btnChangeRot",
|
||||||
|
"x": 260,
|
||||||
|
"y": 117,
|
||||||
|
"width": 84
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"center": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,24 @@ function wdIsOwner(callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wdGetRotation(callback) {
|
||||||
|
//Rotation: 0 is 0deg, 1 is 90deg, 2 is 180deg, and 3 is 270deg
|
||||||
|
//Rotations are counter-clockwise (trigonometric direction)
|
||||||
|
|
||||||
|
wdExecRequest("GetRotation", function(resp) {
|
||||||
|
callback(resp.rotation);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function wdGetSide(callback) {
|
||||||
|
//Side: 0 is Bottom, 1 is Top, 2 is North, 3 is South, 4 is West and 5 is East
|
||||||
|
//FYI: North is Z-, South Z+, West is X- and East X+
|
||||||
|
|
||||||
|
wdExecRequest("GetSide", function(resp) {
|
||||||
|
callback(resp.side);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//Requires upgrade: webdisplays:redinput
|
//Requires upgrade: webdisplays:redinput
|
||||||
function wdGetRedstoneAt(x, y, callback) {
|
function wdGetRedstoneAt(x, y, callback) {
|
||||||
wdExecRequest("GetRedstoneAt(" + x + "," + y + ")", function(resp) {
|
wdExecRequest("GetRedstoneAt(" + x + "," + y + ")", function(resp) {
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,11 @@ webdisplays.gui.screencfg.others=Others
|
||||||
webdisplays.gui.screencfg.upgrades=Upgrades:
|
webdisplays.gui.screencfg.upgrades=Upgrades:
|
||||||
webdisplays.gui.screencfg.resolution=Resolution:
|
webdisplays.gui.screencfg.resolution=Resolution:
|
||||||
webdisplays.gui.screencfg.setres=Set Resolution
|
webdisplays.gui.screencfg.setres=Set Resolution
|
||||||
|
webdisplays.gui.screencfg.rotation=Rotation
|
||||||
|
webdisplays.gui.screencfg.rot0=0°
|
||||||
|
webdisplays.gui.screencfg.rot90=90°
|
||||||
|
webdisplays.gui.screencfg.rot180=180°
|
||||||
|
webdisplays.gui.screencfg.rot270=270°
|
||||||
webdisplays.linker.selectScreen=Right click on a screen
|
webdisplays.linker.selectScreen=Right click on a screen
|
||||||
webdisplays.linker.selectPeripheral=Right click on a peripheral
|
webdisplays.linker.selectPeripheral=Right click on a peripheral
|
||||||
webdisplays.linker.posInfo=Screen pos: %d %d %d
|
webdisplays.linker.posInfo=Screen pos: %d %d %d
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user