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()];
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,14 +9,12 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraftforge.client.event.ViewportEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.montoyo.wd.client.js.WDRouter;
|
||||
import net.montoyo.wd.entity.ScreenBlockEntity;
|
||||
import net.montoyo.wd.entity.ScreenData;
|
||||
import net.montoyo.wd.entity.TileEntityScreen;
|
||||
import net.montoyo.wd.utilities.BlockSide;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import net.montoyo.wd.utilities.data.BlockSide;
|
||||
|
||||
public class KeyboardCamera {
|
||||
private static TileEntityScreen tes;
|
||||
private static ScreenBlockEntity tes;
|
||||
private static BlockSide side;
|
||||
|
||||
private static double oxCrd = -1;
|
||||
|
|
@ -49,7 +47,7 @@ public class KeyboardCamera {
|
|||
protected static void pollElement() {
|
||||
if (activeTask != null) return;
|
||||
|
||||
TileEntityScreen teTmp = tes;
|
||||
ScreenBlockEntity teTmp = tes;
|
||||
BlockSide sdTmp = side;
|
||||
|
||||
// async nonsense can occur here
|
||||
|
|
@ -92,7 +90,6 @@ public class KeyboardCamera {
|
|||
}
|
||||
""".replace("\n", "")
|
||||
).thenAccept((o1) -> {
|
||||
System.out.println(o1);
|
||||
updateCrd(o1);
|
||||
activeTask = null;
|
||||
});
|
||||
|
|
@ -187,7 +184,7 @@ public class KeyboardCamera {
|
|||
event.setPitch(angle[0]);
|
||||
}
|
||||
|
||||
public static void focus(TileEntityScreen screen, BlockSide side) {
|
||||
public static void focus(ScreenBlockEntity screen, BlockSide side) {
|
||||
KeyboardCamera.tes = screen;
|
||||
KeyboardCamera.side = side;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,12 +63,12 @@ public class ScreenConfigData extends GuiData {
|
|||
return null;
|
||||
|
||||
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());
|
||||
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
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class ScreenBlockEntity extends BlockEntity {
|
|||
return;
|
||||
|
||||
// very important to close these
|
||||
for (Screen screen : screens) {
|
||||
for (ScreenData screen : screens) {
|
||||
if (screen.browser != null) {
|
||||
screen.browser.close(true);
|
||||
screen.browser = null;
|
||||
|
|
@ -234,7 +234,7 @@ public class ScreenBlockEntity extends BlockEntity {
|
|||
|
||||
public void clear() {
|
||||
// very important that these get closed
|
||||
for (Screen screen : screens)
|
||||
for (ScreenData screen : screens)
|
||||
if (screen.browser != null) {
|
||||
screen.browser.close(true);
|
||||
screen.browser = null;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ import net.montoyo.wd.client.ClientProxy;
|
|||
import net.montoyo.wd.config.CommonConfig;
|
||||
import net.montoyo.wd.core.ScreenRights;
|
||||
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 java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class ItemLaserPointer extends Item implements WDItem {
|
|||
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);
|
||||
if (pointedScreen == tes && pointedScreenSide == side) {
|
||||
long t = System.currentTimeMillis();
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class ItemLinker extends Item implements WDItem {
|
|||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
ScreenData scr = ((TileEntityScreen) te).getScreen(side);
|
||||
ScreenData scr = ((ScreenBlockEntity) te).getScreen(side);
|
||||
if(scr == null)
|
||||
Util.toast(context.getPlayer(), "turnOn");
|
||||
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))
|
||||
return InteractionResult.SUCCESS;
|
||||
|
||||
TileEntityScreen tes = (TileEntityScreen) te;
|
||||
ScreenBlockEntity tes = (ScreenBlockEntity) te;
|
||||
ScreenData scr = tes.getScreen(side);
|
||||
if(scr == null)
|
||||
return InteractionResult.SUCCESS;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ItemScreenConfigurator extends Item implements WDItem {
|
|||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
ScreenData scr = ((TileEntityScreen) te).getScreen(side);
|
||||
ScreenData scr = ((ScreenBlockEntity) te).getScreen(side);
|
||||
if(scr == null)
|
||||
Util.toast(context.getPlayer(), "turnOn");
|
||||
else
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class S2CMessageAddScreen extends Packet {
|
|||
screens[i] = tes.getScreen(i);
|
||||
}
|
||||
|
||||
public S2CMessageAddScreen(TileEntityScreen tes, ScreenData... toSend) {
|
||||
public S2CMessageAddScreen(ScreenBlockEntity tes, ScreenData... toSend) {
|
||||
clear = false;
|
||||
pos = new Vector3i(tes.getBlockPos());
|
||||
screens = toSend;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user