I believe I have messed up...
This commit is contained in:
parent
ec904c199e
commit
fe81c18b5b
|
|
@ -167,7 +167,7 @@ public class ClientProxy extends SharedProxy implements CefDisplayHandler/*, IJS
|
||||||
BlockSide side = BlockSide.values()[result.getDirection().ordinal()];
|
BlockSide side = BlockSide.values()[result.getDirection().ordinal()];
|
||||||
|
|
||||||
Multiblock.findOrigin(mc.level, pos, side, null);
|
Multiblock.findOrigin(mc.level, pos, side, null);
|
||||||
TileEntityScreen te = (TileEntityScreen) mc.level.getBlockEntity(pos.toBlock());
|
ScreenBlockEntity te = (ScreenBlockEntity) mc.level.getBlockEntity(pos.toBlock());
|
||||||
|
|
||||||
ScreenData sc = te.getScreen(side);
|
ScreenData sc = te.getScreen(side);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,12 @@ import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.client.event.ViewportEvent;
|
import net.minecraftforge.client.event.ViewportEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.montoyo.wd.client.js.WDRouter;
|
import net.montoyo.wd.client.js.WDRouter;
|
||||||
|
import net.montoyo.wd.entity.ScreenBlockEntity;
|
||||||
import net.montoyo.wd.entity.ScreenData;
|
import net.montoyo.wd.entity.ScreenData;
|
||||||
import net.montoyo.wd.entity.TileEntityScreen;
|
import net.montoyo.wd.utilities.data.BlockSide;
|
||||||
import net.montoyo.wd.utilities.BlockSide;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
|
||||||
public class KeyboardCamera {
|
public class KeyboardCamera {
|
||||||
private static TileEntityScreen tes;
|
private static ScreenBlockEntity tes;
|
||||||
private static BlockSide side;
|
private static BlockSide side;
|
||||||
|
|
||||||
private static double oxCrd = -1;
|
private static double oxCrd = -1;
|
||||||
|
|
@ -49,7 +47,7 @@ public class KeyboardCamera {
|
||||||
protected static void pollElement() {
|
protected static void pollElement() {
|
||||||
if (activeTask != null) return;
|
if (activeTask != null) return;
|
||||||
|
|
||||||
TileEntityScreen teTmp = tes;
|
ScreenBlockEntity teTmp = tes;
|
||||||
BlockSide sdTmp = side;
|
BlockSide sdTmp = side;
|
||||||
|
|
||||||
// async nonsense can occur here
|
// async nonsense can occur here
|
||||||
|
|
@ -92,7 +90,6 @@ public class KeyboardCamera {
|
||||||
}
|
}
|
||||||
""".replace("\n", "")
|
""".replace("\n", "")
|
||||||
).thenAccept((o1) -> {
|
).thenAccept((o1) -> {
|
||||||
System.out.println(o1);
|
|
||||||
updateCrd(o1);
|
updateCrd(o1);
|
||||||
activeTask = null;
|
activeTask = null;
|
||||||
});
|
});
|
||||||
|
|
@ -187,7 +184,7 @@ public class KeyboardCamera {
|
||||||
event.setPitch(angle[0]);
|
event.setPitch(angle[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void focus(TileEntityScreen screen, BlockSide side) {
|
public static void focus(ScreenBlockEntity screen, BlockSide side) {
|
||||||
KeyboardCamera.tes = screen;
|
KeyboardCamera.tes = screen;
|
||||||
KeyboardCamera.side = side;
|
KeyboardCamera.side = side;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,12 @@ public class ScreenConfigData extends GuiData {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
BlockEntity te = world.getBlockEntity(pos.toBlock());
|
BlockEntity te = world.getBlockEntity(pos.toBlock());
|
||||||
if (te == null || !(te instanceof TileEntityScreen)) {
|
if (te == null || !(te instanceof ScreenBlockEntity)) {
|
||||||
Log.error("TileEntity at %s is not a screen; can't open gui!", pos.toString());
|
Log.error("TileEntity at %s is not a screen; can't open gui!", pos.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new GuiScreenConfig(Component.nullToEmpty(""), (TileEntityScreen) te, side, friends, friendRights, otherRights);
|
return new GuiScreenConfig(Component.nullToEmpty(""), (ScreenBlockEntity) te, side, friends, friendRights, otherRights);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ public class ScreenBlockEntity extends BlockEntity {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// very important to close these
|
// very important to close these
|
||||||
for (Screen screen : screens) {
|
for (ScreenData screen : screens) {
|
||||||
if (screen.browser != null) {
|
if (screen.browser != null) {
|
||||||
screen.browser.close(true);
|
screen.browser.close(true);
|
||||||
screen.browser = null;
|
screen.browser = null;
|
||||||
|
|
@ -234,7 +234,7 @@ public class ScreenBlockEntity extends BlockEntity {
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
// very important that these get closed
|
// very important that these get closed
|
||||||
for (Screen screen : screens)
|
for (ScreenData screen : screens)
|
||||||
if (screen.browser != null) {
|
if (screen.browser != null) {
|
||||||
screen.browser.close(true);
|
screen.browser.close(true);
|
||||||
screen.browser = null;
|
screen.browser = null;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ import net.montoyo.wd.client.ClientProxy;
|
||||||
import net.montoyo.wd.config.CommonConfig;
|
import net.montoyo.wd.config.CommonConfig;
|
||||||
import net.montoyo.wd.core.ScreenRights;
|
import net.montoyo.wd.core.ScreenRights;
|
||||||
import net.montoyo.wd.utilities.*;
|
import net.montoyo.wd.utilities.*;
|
||||||
|
import net.montoyo.wd.utilities.data.BlockSide;
|
||||||
|
import net.montoyo.wd.utilities.data.Rotation;
|
||||||
|
import net.montoyo.wd.utilities.math.Vector2i;
|
||||||
|
import net.montoyo.wd.utilities.serialization.NameUUIDPair;
|
||||||
import org.cef.browser.CefBrowser;
|
import org.cef.browser.CefBrowser;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class ItemLaserPointer extends Item implements WDItem {
|
||||||
deselectScreen();
|
deselectScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void laserClick(TileEntityScreen tes, BlockSide side, ScreenData scr, Vector2i hit) {
|
private static void laserClick(ScreenBlockEntity tes, BlockSide side, ScreenData scr, Vector2i hit) {
|
||||||
tes.handleMouseEvent(side, ClickControl.ControlType.MOVE, hit, -1);
|
tes.handleMouseEvent(side, ClickControl.ControlType.MOVE, hit, -1);
|
||||||
if (pointedScreen == tes && pointedScreenSide == side) {
|
if (pointedScreen == tes && pointedScreenSide == side) {
|
||||||
long t = System.currentTimeMillis();
|
long t = System.currentTimeMillis();
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ public class ItemLinker extends Item implements WDItem {
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenData scr = ((TileEntityScreen) te).getScreen(side);
|
ScreenData scr = ((ScreenBlockEntity) te).getScreen(side);
|
||||||
if(scr == null)
|
if(scr == null)
|
||||||
Util.toast(context.getPlayer(), "turnOn");
|
Util.toast(context.getPlayer(), "turnOn");
|
||||||
else if ((scr.rightsFor(context.getPlayer()) & ScreenRights.MANAGE_UPGRADES) == 0)
|
else if ((scr.rightsFor(context.getPlayer()) & ScreenRights.MANAGE_UPGRADES) == 0)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class ItemOwnershipThief extends Item implements WDItem {
|
||||||
if (te == null || !(te instanceof ScreenBlockEntity))
|
if (te == null || !(te instanceof ScreenBlockEntity))
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
|
|
||||||
TileEntityScreen tes = (TileEntityScreen) te;
|
ScreenBlockEntity tes = (ScreenBlockEntity) te;
|
||||||
ScreenData scr = tes.getScreen(side);
|
ScreenData scr = tes.getScreen(side);
|
||||||
if(scr == null)
|
if(scr == null)
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class ItemScreenConfigurator extends Item implements WDItem {
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenData scr = ((TileEntityScreen) te).getScreen(side);
|
ScreenData scr = ((ScreenBlockEntity) te).getScreen(side);
|
||||||
if(scr == null)
|
if(scr == null)
|
||||||
Util.toast(context.getPlayer(), "turnOn");
|
Util.toast(context.getPlayer(), "turnOn");
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class S2CMessageAddScreen extends Packet {
|
||||||
screens[i] = tes.getScreen(i);
|
screens[i] = tes.getScreen(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public S2CMessageAddScreen(TileEntityScreen tes, ScreenData... toSend) {
|
public S2CMessageAddScreen(ScreenBlockEntity tes, ScreenData... toSend) {
|
||||||
clear = false;
|
clear = false;
|
||||||
pos = new Vector3i(tes.getBlockPos());
|
pos = new Vector3i(tes.getBlockPos());
|
||||||
screens = toSend;
|
screens = toSend;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user