everything done finally
This commit is contained in:
parent
0ed8dba783
commit
3cc7087371
|
|
@ -41,7 +41,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
forge "net.minecraftforge:forge:${project.forge_version}"
|
forge "net.minecraftforge:forge:${project.forge_version}"
|
||||||
|
|
||||||
modImplementation "com.github.Mysticpasta1:mcef-forge:805b7eec8a"
|
modImplementation "com.github.Mysticpasta1:mcef-forge:11826a2d11"
|
||||||
modImplementation "curse.maven:cloth_config_forge-348521:3546623"
|
modImplementation "curse.maven:cloth_config_forge-348521:3546623"
|
||||||
// Uncomment the following line to enable the deprecated Fabric API modules.
|
// Uncomment the following line to enable the deprecated Fabric API modules.
|
||||||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
||||||
|
|
|
||||||
|
|
@ -186,10 +186,11 @@ public class BlockKeyboardLeft extends BlockPeripheral {
|
||||||
if(!world.isEmptyBlock(pos.below()) && BlockKeyboardRight.checkNeighborhood(world, pos, null)) {
|
if(!world.isEmptyBlock(pos.below()) && BlockKeyboardRight.checkNeighborhood(world, pos, null)) {
|
||||||
if(world.isEmptyBlock(right) && !world.isEmptyBlock(right.below()) && BlockKeyboardRight.checkNeighborhood(world, right, pos)) {
|
if(world.isEmptyBlock(right) && !world.isEmptyBlock(right.below()) && BlockKeyboardRight.checkNeighborhood(world, right, pos)) {
|
||||||
world.setBlock(right, BlockInit.blockKbRight.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3);
|
world.setBlock(right, BlockInit.blockKbRight.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3);
|
||||||
|
world.setBlock(pos.offset(f.getNormal()), BlockInit.blockKeyBoard.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3);
|
||||||
return;
|
return;
|
||||||
} else if(world.isEmptyBlock(left) && !world.isEmptyBlock(left.below()) && BlockKeyboardRight.checkNeighborhood(world, left, pos)) {
|
} else if(world.isEmptyBlock(left) && !world.isEmptyBlock(left.below()) && BlockKeyboardRight.checkNeighborhood(world, left, pos)) {
|
||||||
world.setBlock(left, state, 3);
|
world.setBlock(left, state, 3);
|
||||||
world.setBlock(pos, BlockInit.blockKbRight.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3);
|
world.setBlock(pos.offset(f.getNormal()), BlockInit.blockKeyBoard.get().defaultBlockState().setValue(BlockKeyboardRight.facing, f), 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class BlockScreen extends BaseEntityBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderShape getRenderShape(BlockState state) {
|
public RenderShape getRenderShape(BlockState state) {
|
||||||
return RenderShape.INVISIBLE;
|
return RenderShape.MODEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isntScreenBlock(Level world, Vector3i pos) {
|
public static boolean isntScreenBlock(Level world, Vector3i pos) {
|
||||||
|
|
@ -179,7 +179,7 @@ public class BlockScreen extends BaseEntityBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2i tmp = new Vector2i();
|
Vector2i tmp = new Vector2i();
|
||||||
if(hit2pixels(side, hit.getBlockPos(), pos, scr, (float) hit.getBlockPos().getX(), (float) hit.getBlockPos().getY(), (float) hit.getBlockPos().getZ(), tmp))
|
if(hit2pixels(side, hit.getBlockPos(), pos, scr, (float) hit.getLocation().x, (float) hit.getLocation().y, (float) hit.getLocation().z, tmp))
|
||||||
te.click(side, tmp);
|
te.click(side, tmp);
|
||||||
|
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
|
|
@ -244,19 +244,18 @@ public class BlockScreen extends BaseEntityBlock {
|
||||||
if(side.right.z < 0 || side == BlockSide.TOP || side == BlockSide.BOTTOM)
|
if(side.right.z < 0 || side == BlockSide.TOP || side == BlockSide.BOTTOM)
|
||||||
hitZ -= 1.f;
|
hitZ -= 1.f;
|
||||||
|
|
||||||
Vector3f rel = new Vector3f(bpos.getX(), bpos.getY(), bpos.getZ());
|
Vector3f rel = new Vector3f(pos.toBlock().getX(), pos.toBlock().getY(), pos.toBlock().getZ());
|
||||||
rel.sub((float) pos.x, (float) pos.y, (float) pos.z);
|
rel.sub(hitX, hitY, hitZ);
|
||||||
rel.add(hitX, hitY, hitZ);
|
|
||||||
|
|
||||||
float cx = rel.dot(side.right.toFloat()) - 2.f / 16.f;
|
float cx = Math.abs(rel.dot(side.right.toFloat()) - 2.f / 16.f);
|
||||||
float cy = rel.dot(side.up.toFloat()) - 2.f / 16.f;
|
float cy = Math.abs(rel.dot(side.up.toFloat()) - 2.f / 16.f);
|
||||||
float sw = ((float) scr.size.x) - 4.f / 16.f;
|
float sw = ((float) scr.size.x) - 4.f / 16.f;
|
||||||
float sh = ((float) scr.size.y) - 4.f / 16.f;
|
float sh = ((float) scr.size.y) - 4.f / 16.f;
|
||||||
|
|
||||||
cx /= sw;
|
cx /= sw;
|
||||||
cy /= sh;
|
cy /= sh;
|
||||||
|
|
||||||
if(cx >= 0.f && cx <= 1.0 && cy >= 0.f && cy <= 1.f) {
|
if(cx >= -0.1f && cx <= 1.1f && cy >= -0.1f && cy <= 1.1f) {
|
||||||
if(side != BlockSide.BOTTOM)
|
if(side != BlockSide.BOTTOM)
|
||||||
cy = 1.f - cy;
|
cy = 1.f - cy;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
|
||||||
import net.minecraft.client.multiplayer.ClientAdvancements;
|
import net.minecraft.client.multiplayer.ClientAdvancements;
|
||||||
|
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||||
|
|
@ -85,6 +87,7 @@ import java.lang.reflect.Field;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid = "webdisplays", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = "webdisplays", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQueryHandler, ResourceManagerReloadListener {
|
public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQueryHandler, ResourceManagerReloadListener {
|
||||||
|
|
@ -141,12 +144,16 @@ 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());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onModelRegistryEvent(ModelRegistryEvent event) {
|
public static void onModelRegistryEvent(ModelRegistryEvent event) {
|
||||||
ModelLoaderRegistry.registerLoader(ScreenModelLoader.SCREEN_LOADER, new ScreenModelLoader());
|
ModelLoaderRegistry.registerLoader(ScreenModelLoader.SCREEN_LOADER, new ScreenModelLoader());
|
||||||
|
registerBlockRenderLayers(RenderType.cutout(), BlockInit.blockKeyBoard.get(), BlockInit.blockKbRight.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerBlockRenderLayers(RenderType layer, Block... blocks) {
|
||||||
|
Stream.of(blocks).forEach(block -> ItemBlockRenderTypes.setRenderLayer(block, layer));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,19 @@
|
||||||
|
|
||||||
package net.montoyo.wd.client.gui;
|
package net.montoyo.wd.client.gui;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
import com.sun.jna.platform.unix.X11;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.client.event.InputEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.loading.FMLPaths;
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
import net.montoyo.wd.WebDisplays;
|
import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.client.gui.controls.Button;
|
import net.montoyo.wd.client.gui.controls.Button;
|
||||||
|
|
@ -22,12 +30,20 @@ import net.montoyo.wd.utilities.BlockSide;
|
||||||
import net.montoyo.wd.utilities.Log;
|
import net.montoyo.wd.utilities.Log;
|
||||||
import net.montoyo.wd.utilities.TypeData;
|
import net.montoyo.wd.utilities.TypeData;
|
||||||
import net.montoyo.wd.utilities.Util;
|
import net.montoyo.wd.utilities.Util;
|
||||||
|
import org.apache.commons.lang3.CharUtils;
|
||||||
|
import org.cef.browser.CefBrowserOsr;
|
||||||
|
import org.jline.utils.Display;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.mojang.blaze3d.platform.InputConstants.*;
|
||||||
|
import static java.awt.event.KeyEvent.*;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class GuiKeyboard extends WDScreen {
|
public class GuiKeyboard extends WDScreen {
|
||||||
|
|
||||||
|
|
@ -98,8 +114,10 @@ public class GuiKeyboard extends WDScreen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
minecraft.setWindowActive(true);
|
if (!minecraft.isWindowActive()) {
|
||||||
minecraft.mouseHandler.grabMouse();
|
minecraft.setWindowActive(true);
|
||||||
|
minecraft.mouseHandler.grabMouse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultBackground = showWarning;
|
defaultBackground = showWarning;
|
||||||
|
|
@ -108,44 +126,54 @@ public class GuiKeyboard extends WDScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
key(keyCode, scanCode, true);
|
key(keyCode, scanCode, true, modifiers);
|
||||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
||||||
key(keyCode, scanCode, false);
|
key(keyCode, scanCode, false, modifiers);
|
||||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void key(int keyCode, int scanCode, boolean pressed) {
|
public void key(int keyCode, int scanCode, boolean pressed, int mod) {
|
||||||
char chr = getChar(keyCode, scanCode);
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
int kc = keyCode;
|
if(quitOnEscape && keyCode == GLFW.GLFW_KEY_ESCAPE) {
|
||||||
|
Minecraft.getInstance().setScreen(null);
|
||||||
|
}
|
||||||
|
|
||||||
evStack.add(new TypeData(TypeData.Action.PRESS, kc, chr));
|
int chr = getChar(keyCode, scanCode);
|
||||||
evStack.add(new TypeData(TypeData.Action.RELEASE, kc, chr));
|
evStack.add(new TypeData(TypeData.Action.PRESS, chr, mod));
|
||||||
|
evStack.add(new TypeData(TypeData.Action.RELEASE, chr, mod));
|
||||||
|
|
||||||
|
if (keyCode != 0)
|
||||||
|
evStack.add(new TypeData(TypeData.Action.TYPE, chr, mod));
|
||||||
|
|
||||||
|
if (!evStack.isEmpty() && !syncRequested())
|
||||||
|
requestSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chr != 0)
|
|
||||||
evStack.add(new TypeData(TypeData.Action.TYPE, 0, chr));
|
|
||||||
|
|
||||||
if (!evStack.isEmpty() && !syncRequested())
|
|
||||||
requestSync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public char getChar(int keyCode, int scanCode) {
|
public int getChar(int keyCode, int scanCode) {
|
||||||
String keystr = GLFW.glfwGetKeyName(keyCode, scanCode);
|
String keystr = GLFW.glfwGetKeyName(keyCode, scanCode);
|
||||||
if(keystr == null){
|
if(keystr == null){
|
||||||
keystr = "\0";
|
keystr = "\0";
|
||||||
}
|
}
|
||||||
if(keyCode == GLFW.GLFW_KEY_ENTER){
|
if(keyCode == GLFW.GLFW_KEY_ENTER){
|
||||||
keystr = "\n";
|
return 13;
|
||||||
|
}
|
||||||
|
if (keyCode == GLFW.GLFW_KEY_SPACE) {
|
||||||
|
return 32;
|
||||||
}
|
}
|
||||||
if(keystr.length() == 0){
|
if(keystr.length() == 0){
|
||||||
return (char) -1;
|
return -1;
|
||||||
|
}
|
||||||
|
if(hasShiftDown()) {
|
||||||
|
keystr = keystr.toUpperCase(Locale.ROOT);
|
||||||
|
return CefBrowserOsr.remapKeycode(keyCode, keystr.charAt(keystr.length() - 1));
|
||||||
|
} else {
|
||||||
|
return CefBrowserOsr.remapKeycode(keyCode, keystr.charAt(keystr.length() - 1));
|
||||||
}
|
}
|
||||||
return keystr.charAt(keystr.length() - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ public class GuiServer extends WDScreen {
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
getChar(keyCode, scanCode).ifPresent(c -> {
|
getChar(keyCode, scanCode).ifPresent(c -> {
|
||||||
try {
|
try {
|
||||||
keyTyped(c, keyCode);
|
keyTyped(c, keyCode, modifiers);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
@ -309,10 +309,11 @@ public class GuiServer extends WDScreen {
|
||||||
@Override
|
@Override
|
||||||
public boolean charTyped(char codePoint, int modifiers) {
|
public boolean charTyped(char codePoint, int modifiers) {
|
||||||
return super.charTyped(codePoint, modifiers);
|
return super.charTyped(codePoint, modifiers);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
protected void keyTyped(char typedChar, int keyCode, int modifier) throws IOException {
|
||||||
// super.keyTyped(typedChar, keyCode);
|
//this.charTyped(typedChar, modifier);
|
||||||
|
|
||||||
if(uploadWizard) {
|
if(uploadWizard) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
|
||||||
|
|
@ -126,11 +126,6 @@ public abstract class WDScreen extends Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean charTyped(char codePoint, int modifiers) {
|
public boolean charTyped(char codePoint, int modifiers) {
|
||||||
if(quitOnEscape && codePoint == GLFW.GLFW_KEY_ESCAPE) {
|
|
||||||
minecraft.setScreen(null);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean typed = false;
|
boolean typed = false;
|
||||||
|
|
||||||
for(Control ctrl: controls)
|
for(Control ctrl: controls)
|
||||||
|
|
@ -213,10 +208,14 @@ public abstract class WDScreen extends Screen {
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
boolean down = false;
|
boolean down = false;
|
||||||
|
|
||||||
for(Control ctrl : controls)
|
for (Control ctrl : controls)
|
||||||
down = down || ctrl.keyDown(keyCode);
|
down = down || ctrl.keyDown(keyCode);
|
||||||
|
|
||||||
return new GuiServer(new Vector3i(), new NameUUIDPair()).keyPressed(keyCode, scanCode, modifiers);
|
if (Minecraft.getInstance().screen instanceof GuiKeyboard) {
|
||||||
|
return down;
|
||||||
|
} else {
|
||||||
|
return new GuiServer(new Vector3i(), new NameUUIDPair()).keyPressed(keyCode, scanCode, modifiers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.*;
|
import com.mojang.blaze3d.vertex.*;
|
||||||
import com.mojang.math.Matrix4f;
|
import com.mojang.math.Matrix4f;
|
||||||
|
import net.minecraft.client.KeyboardHandler;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Font;
|
import net.minecraft.client.gui.Font;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,11 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||||
|
|
||||||
switch(scr.side) {
|
switch(scr.side) {
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
poseStack.mulPose(XP.rotation(90.f));
|
poseStack.mulPose(XP.rotation(90.f + 49.8f));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOP:
|
case TOP:
|
||||||
poseStack.mulPose(XN.rotation(90.f));
|
poseStack.mulPose(XN.rotation(90.f + 49.8f));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NORTH:
|
case NORTH:
|
||||||
|
|
@ -110,8 +110,8 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||||
poseStack.scale(ft, ft, 1.0f);
|
poseStack.scale(ft, ft, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!scr.rotation.isNull)
|
if(!scr.rotation.isNull)
|
||||||
// poseStack.mulPose(YP.rotationDegrees(scr.rotation.angle));
|
poseStack.mulPose(ZP.rotationDegrees(scr.rotation.angle));
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ public abstract class TileEntityInterfaceBase extends TileEntityPeripheralBase {
|
||||||
code = ((Double) oCode).intValue();
|
code = ((Double) oCode).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
data.add(new TypeData(dataAction, code, strChr.charAt(0)));
|
data.add(new TypeData(dataAction, code, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return realType(WebDisplays.GSON.toJson(data));
|
return realType(WebDisplays.GSON.toJson(data));
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
package net.montoyo.wd.entity;
|
package net.montoyo.wd.entity;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
@ -42,9 +43,11 @@ import net.montoyo.wd.net.client.CMessageJSResponse;
|
||||||
import net.montoyo.wd.net.client.CMessageScreenUpdate;
|
import net.montoyo.wd.net.client.CMessageScreenUpdate;
|
||||||
import net.montoyo.wd.net.server.SMessageRequestTEData;
|
import net.montoyo.wd.net.server.SMessageRequestTEData;
|
||||||
import net.montoyo.wd.utilities.*;
|
import net.montoyo.wd.utilities.*;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
@ -789,9 +792,9 @@ public class TileEntityScreen extends BlockEntity{
|
||||||
|
|
||||||
for(TypeData ev : data) {
|
for(TypeData ev : data) {
|
||||||
switch (ev.getAction()) {
|
switch (ev.getAction()) {
|
||||||
case PRESS -> scr.browser.injectKeyPressedByKeyCode(ev.getKeyCode(), ev.getKeyChar(), 0);
|
case PRESS -> scr.browser.injectKeyPressedByKeyCode(ev.getKeyCode(), (char) ev.getKeyCode(), 0);
|
||||||
case RELEASE -> scr.browser.injectKeyReleasedByKeyCode(ev.getKeyCode(), ev.getKeyChar(), 0);
|
case RELEASE -> scr.browser.injectKeyReleasedByKeyCode(ev.getKeyCode(), (char) ev.getKeyCode(), 0);
|
||||||
case TYPE -> scr.browser.injectKeyTyped(ev.getKeyChar(), 0);
|
case TYPE -> scr.browser.injectKeyTyped(ev.getKeyCode(), 0);
|
||||||
default -> throw new RuntimeException("Invalid type action '" + ev.getAction() + '\'');
|
default -> throw new RuntimeException("Invalid type action '" + ev.getAction() + '\'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,7 @@ public class SMessageScreenCtrl implements Runnable {
|
||||||
bs.getBlock() != BlockInit.blockKeyBoard.get() && bs.getBlock() != BlockInit.blockRedControl.get()
|
bs.getBlock() != BlockInit.blockKeyBoard.get() && bs.getBlock() != BlockInit.blockRedControl.get()
|
||||||
&& bs.getValue(BlockPeripheral.type) != DefaultPeripheral.REMOTE_CONTROLLER)
|
&& bs.getValue(BlockPeripheral.type) != DefaultPeripheral.REMOTE_CONTROLLER)
|
||||||
return; //I call it hax...
|
return; //I call it hax...
|
||||||
} else if(player.shouldRenderAtSqrDistance(player.distanceToSqr(bp.getX(), bp.getY(), bp.getZ())))
|
} else if(player.distanceToSqr(bp.getX(), bp.getY(), bp.getZ()) > (128 * 128))
|
||||||
return; //Out of range (range problem)
|
return; //Out of range (range problem)
|
||||||
|
|
||||||
BlockEntity te = world.getBlockEntity(bp);
|
BlockEntity te = world.getBlockEntity(bp);
|
||||||
|
|
|
||||||
|
|
@ -24,30 +24,30 @@ public class TypeData {
|
||||||
|
|
||||||
private Action a;
|
private Action a;
|
||||||
private int k;
|
private int k;
|
||||||
private int c;
|
private int m;
|
||||||
|
|
||||||
public TypeData() {
|
public TypeData() {
|
||||||
a = Action.INVALID;
|
a = Action.INVALID;
|
||||||
k = 0;
|
k = 0;
|
||||||
c = 0;
|
m = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeData(Action action, int code, char chr) {
|
public TypeData(Action action, int code, int modifier) {
|
||||||
a = action;
|
a = action;
|
||||||
k = code;
|
k = code;
|
||||||
c = (int) chr;
|
m = modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action getAction() {
|
public Action getAction() {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char getKeyChar() {
|
|
||||||
return (char) c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getKeyCode() {
|
public int getKeyCode() {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getModifier() {
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user