try syncing it

This commit is contained in:
Mysticpasta1 2023-03-06 21:50:17 -06:00
parent cf70556ce8
commit a4f9fdca7a
9 changed files with 246 additions and 182 deletions

View File

@ -132,12 +132,12 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
@SubscribeEvent @SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) { public static void onClientSetup(FMLClientSetupEvent event) {
BlockEntityRenderers.register(TileInit.SCREEN_BLOCK_ENTITY.get(), new ScreenRenderer.ScreenRendererProvider()); BlockEntityRenderers.register(TileInit.SCREEN_BLOCK_ENTITY.get(), new ScreenRenderer.ScreenRendererProvider());
registerBlockRenderLayers(RenderType.cutout(), BlockInit.blockKeyBoard.get(), BlockInit.blockKbRight.get());
} }
@SubscribeEvent @SubscribeEvent
public static void onModelRegistryEvent(ModelEvent.RegisterGeometryLoaders event) { public static void onModelRegistryEvent(ModelEvent.RegisterGeometryLoaders event) {
event.register(ScreenModelLoader.SCREEN_LOADER.getPath(), new ScreenModelLoader()); event.register(ScreenModelLoader.SCREEN_LOADER.getPath(), new ScreenModelLoader());
registerBlockRenderLayers(RenderType.cutout(), BlockInit.blockKeyBoard.get(), BlockInit.blockKbRight.get());
} }
private static void registerBlockRenderLayers(RenderType layer, Block... blocks) { private static void registerBlockRenderLayers(RenderType layer, Block... blocks) {

View File

@ -25,6 +25,7 @@ import net.montoyo.wd.utilities.BlockSide;
import net.montoyo.wd.utilities.Util; import net.montoyo.wd.utilities.Util;
import net.montoyo.wd.utilities.Vector3i; import net.montoyo.wd.utilities.Vector3i;
import java.io.IOException;
import java.util.Map; import java.util.Map;
@Mod.EventBusSubscriber(Dist.CLIENT) @Mod.EventBusSubscriber(Dist.CLIENT)
@ -101,6 +102,13 @@ public class GuiSetURL2 extends WDScreen {
private void validate(String url) { private void validate(String url) {
if(!url.isEmpty()) { if(!url.isEmpty()) {
try {
TileEntityScreen.url(url);
} catch (IOException e) {
throw new RuntimeException(e);
}
url = Util.addProtocol(url); url = Util.addProtocol(url);
url = ((ClientProxy) WebDisplays.PROXY).getMCEF().punycode(url); url = ((ClientProxy) WebDisplays.PROXY).getMCEF().punycode(url);

View File

@ -20,6 +20,8 @@ import net.montoyo.wd.utilities.Vector3f;
import net.montoyo.wd.utilities.Vector3i; import net.montoyo.wd.utilities.Vector3i;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.IOException;
import static com.mojang.math.Vector3f.*; import static com.mojang.math.Vector3f.*;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;

View File

@ -17,6 +17,7 @@ import net.montoyo.wd.net.client.CMessageScreenUpdate;
import net.montoyo.wd.utilities.*; import net.montoyo.wd.utilities.*;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.io.IOException;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
@ -336,7 +337,11 @@ public abstract class TileEntityInterfaceBase extends TileEntityPeripheralBase {
else if((scr.getScreen(screenSide).rightsFor(owner.uuid) & ScreenRights.CHANGE_URL) == 0) else if((scr.getScreen(screenSide).rightsFor(owner.uuid) & ScreenRights.CHANGE_URL) == 0)
return err("restrictions"); return err("restrictions");
else { else {
scr.setScreenURL(screenSide, url); try {
scr.setScreenURL(screenSide, url);
} catch (IOException e) {
throw new RuntimeException(e);
}
return TRUE; return TRUE;
} }
} }

View File

@ -22,6 +22,7 @@ import net.montoyo.wd.utilities.BlockSide;
import net.montoyo.wd.utilities.Util; import net.montoyo.wd.utilities.Util;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.io.IOException;
public class TileEntityRedCtrl extends TileEntityPeripheralBase { public class TileEntityRedCtrl extends TileEntityPeripheralBase {
@ -115,8 +116,12 @@ public class TileEntityRedCtrl extends TileEntityPeripheralBase {
if(isScreenChunkLoaded()) { if(isScreenChunkLoaded()) {
TileEntityScreen tes = getConnectedScreen(); TileEntityScreen tes = getConnectedScreen();
if(tes != null) if (tes != null)
tes.setScreenURL(screenSide, url); try {
tes.setScreenURL(screenSide, url);
} catch (IOException e) {
throw new RuntimeException(e);
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ import net.montoyo.wd.WebDisplays;
import net.montoyo.wd.entity.TileEntityScreen; import net.montoyo.wd.entity.TileEntityScreen;
import net.montoyo.wd.utilities.*; import net.montoyo.wd.utilities.*;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -104,12 +105,20 @@ public class CMessageAddScreen {
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.rotation = entry.rotation;
scr.url = entry.url; String webUrl;
try {
webUrl = TileEntityScreen.url(entry.url);
} catch (IOException e) {
throw new RuntimeException(e);
}
scr.url = webUrl;
scr.owner = entry.owner; scr.owner = entry.owner;
scr.upgrades = entry.upgrades; scr.upgrades = entry.upgrades;
if (scr.browser != null) if (scr.browser != null)
scr.browser.loadURL(entry.url); scr.browser.loadURL(webUrl);
} }
}); });

View File

@ -17,6 +17,7 @@ import net.montoyo.wd.init.BlockInit;
import net.montoyo.wd.utilities.*; import net.montoyo.wd.utilities.*;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -252,7 +253,13 @@ public class CMessageScreenUpdate {
TileEntityScreen tes = (TileEntityScreen) te; TileEntityScreen tes = (TileEntityScreen) te;
switch (action) { switch (action) {
case UPDATE_URL -> tes.setScreenURL(side, string); case UPDATE_URL -> {
try {
tes.setScreenURL(side, string);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
case UPDATE_MOUSE -> tes.handleMouseEvent(side, mouseEvent, vec2i); case UPDATE_MOUSE -> tes.handleMouseEvent(side, mouseEvent, vec2i);
case UPDATE_DELETE -> tes.removeScreen(side); case UPDATE_DELETE -> tes.removeScreen(side);
case UPDATE_RESOLUTION -> tes.setResolution(side, vec2i); case UPDATE_RESOLUTION -> tes.setResolution(side, vec2i);

View File

@ -24,6 +24,7 @@ import net.montoyo.wd.init.BlockInit;
import net.montoyo.wd.init.ItemInit; import net.montoyo.wd.init.ItemInit;
import net.montoyo.wd.utilities.*; import net.montoyo.wd.utilities.*;
import java.io.IOException;
import java.util.function.Supplier; import java.util.function.Supplier;
public class SMessageScreenCtrl implements Runnable { public class SMessageScreenCtrl implements Runnable {
@ -309,7 +310,11 @@ public class SMessageScreenCtrl implements Runnable {
if(ctrl == CTRL_SET_URL || ctrl == CTRL_SET_URL_REMOTE) { if(ctrl == CTRL_SET_URL || ctrl == CTRL_SET_URL_REMOTE) {
checkPermission(tes, ScreenRights.CHANGE_URL); checkPermission(tes, ScreenRights.CHANGE_URL);
tes.setScreenURL(side, url); try {
tes.setScreenURL(side, url);
} catch (IOException e) {
throw new RuntimeException(e);
}
} else if(ctrl == CTRL_SHUT_DOWN) { } else if(ctrl == CTRL_SHUT_DOWN) {
//TODO //TODO
//checkPermission(tes, ScreenRights.CHANGE_URL); //checkPermission(tes, ScreenRights.CHANGE_URL);