push it
This commit is contained in:
parent
4849a7be58
commit
d401c65d19
|
|
@ -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:fb295e48d0"
|
modImplementation "com.github.Mysticpasta1:mcef-forge:214395775d"
|
||||||
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.
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.minecraftforge.network.PacketDistributor;
|
import net.minecraftforge.network.PacketDistributor;
|
||||||
import net.montoyo.wd.block.WDBlockContainer;
|
import net.montoyo.wd.block.WDBlockContainer;
|
||||||
import net.montoyo.wd.client.ClientProxy;
|
import net.montoyo.wd.client.ClientProxy;
|
||||||
|
import net.montoyo.wd.client.gui.controls.*;
|
||||||
import net.montoyo.wd.config.ModConfig;
|
import net.montoyo.wd.config.ModConfig;
|
||||||
import net.montoyo.wd.core.*;
|
import net.montoyo.wd.core.*;
|
||||||
import net.montoyo.wd.init.BlockInit;
|
import net.montoyo.wd.init.BlockInit;
|
||||||
|
|
|
||||||
|
|
@ -45,15 +45,19 @@ import net.minecraftforge.client.model.IModelLoader;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
import net.montoyo.mcef.api.*;
|
import net.montoyo.mcef.api.*;
|
||||||
import net.montoyo.wd.SharedProxy;
|
import net.montoyo.wd.SharedProxy;
|
||||||
import net.montoyo.wd.WebDisplays;
|
import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.block.BlockScreen;
|
import net.montoyo.wd.block.BlockScreen;
|
||||||
import net.montoyo.wd.client.gui.*;
|
import net.montoyo.wd.client.gui.*;
|
||||||
|
import net.montoyo.wd.client.gui.controls.*;
|
||||||
|
import net.montoyo.wd.client.gui.controls.List;
|
||||||
import net.montoyo.wd.client.gui.loading.GuiLoader;
|
import net.montoyo.wd.client.gui.loading.GuiLoader;
|
||||||
import net.montoyo.wd.client.renderers.*;
|
import net.montoyo.wd.client.renderers.*;
|
||||||
import net.montoyo.wd.core.DefaultUpgrade;
|
import net.montoyo.wd.core.DefaultUpgrade;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class GuiServer extends WDScreen {
|
||||||
private final Vector3i serverPos;
|
private final Vector3i serverPos;
|
||||||
private final NameUUIDPair owner;
|
private final NameUUIDPair owner;
|
||||||
private final ArrayList<String> lines = new ArrayList<>();
|
private final ArrayList<String> lines = new ArrayList<>();
|
||||||
private String prompt = "";
|
private String prompt = "<";
|
||||||
private String userPrompt;
|
private String userPrompt;
|
||||||
private int blinkTime;
|
private int blinkTime;
|
||||||
private String lastCmd;
|
private String lastCmd;
|
||||||
|
|
@ -77,7 +77,6 @@ public class GuiServer extends WDScreen {
|
||||||
super(Component.nullToEmpty(null));
|
super(Component.nullToEmpty(null));
|
||||||
serverPos = vec;
|
serverPos = vec;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
//userPrompt = owner.name + "@miniserv$ ";
|
|
||||||
userPrompt = "> ";
|
userPrompt = "> ";
|
||||||
|
|
||||||
if(COMMAND_MAP.isEmpty())
|
if(COMMAND_MAP.isEmpty())
|
||||||
|
|
@ -214,8 +213,6 @@ public class GuiServer extends WDScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
Supplier<Boolean> predicate = () -> super.keyPressed(keyCode, scanCode, modifiers);
|
|
||||||
|
|
||||||
getChar(keyCode, scanCode).ifPresent(c -> {
|
getChar(keyCode, scanCode).ifPresent(c -> {
|
||||||
try {
|
try {
|
||||||
keyTyped(c, keyCode);
|
keyTyped(c, keyCode);
|
||||||
|
|
@ -225,7 +222,7 @@ public class GuiServer extends WDScreen {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return handleKeyboardInput(keyCode, true, predicate);
|
return handleKeyboardInput(keyCode, true, () -> true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -349,6 +346,7 @@ public class GuiServer extends WDScreen {
|
||||||
} else
|
} else
|
||||||
writeLine(userPrompt);
|
writeLine(userPrompt);
|
||||||
} else if(prompt.length() + 1 < MAX_LINE_LEN && typedChar >= 32 && typedChar <= 126)
|
} else if(prompt.length() + 1 < MAX_LINE_LEN && typedChar >= 32 && typedChar <= 126)
|
||||||
|
|
||||||
prompt = prompt + typedChar;
|
prompt = prompt + typedChar;
|
||||||
|
|
||||||
blinkTime = 0;
|
blinkTime = 0;
|
||||||
|
|
@ -414,7 +412,7 @@ public class GuiServer extends WDScreen {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
if(accessSound != null)
|
if(accessSound != null)
|
||||||
minecraft.getSoundManager().stop(accessSound);
|
Minecraft.getInstance().getSoundManager().stop(accessSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean queueTask(ClientTask<?> task) {
|
private boolean queueTask(ClientTask<?> task) {
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,13 @@ import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
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.client.gui.controls.Button;
|
import net.montoyo.wd.client.gui.controls.Button;
|
||||||
|
import net.montoyo.wd.client.gui.controls.Event;
|
||||||
import net.montoyo.wd.client.gui.controls.TextField;
|
import net.montoyo.wd.client.gui.controls.TextField;
|
||||||
import net.montoyo.wd.client.gui.loading.FillControl;
|
import net.montoyo.wd.client.gui.loading.FillControl;
|
||||||
import net.montoyo.wd.entity.TileEntityScreen;
|
import net.montoyo.wd.entity.TileEntityScreen;
|
||||||
|
|
@ -25,6 +29,7 @@ import net.montoyo.wd.utilities.Vector3i;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber
|
||||||
public class GuiSetURL2 extends WDScreen {
|
public class GuiSetURL2 extends WDScreen {
|
||||||
|
|
||||||
//Screen data
|
//Screen data
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,7 @@ import net.montoyo.wd.client.gui.loading.GuiLoader;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
import net.montoyo.wd.net.Messages;
|
import net.montoyo.wd.net.Messages;
|
||||||
import net.montoyo.wd.net.server.SMessageACQuery;
|
import net.montoyo.wd.net.server.SMessageACQuery;
|
||||||
import net.montoyo.wd.utilities.BlockSide;
|
import net.montoyo.wd.utilities.*;
|
||||||
import net.montoyo.wd.utilities.Bounds;
|
|
||||||
import net.montoyo.wd.utilities.Log;
|
|
||||||
import net.montoyo.wd.utilities.NameUUIDPair;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
@ -139,7 +136,7 @@ public abstract class WDScreen extends Screen {
|
||||||
for(Control ctrl: controls)
|
for(Control ctrl: controls)
|
||||||
typed = typed || ctrl.keyTyped(codePoint, modifiers);
|
typed = typed || ctrl.keyTyped(codePoint, modifiers);
|
||||||
|
|
||||||
return typed || charTyped(codePoint, modifiers);
|
return typed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -149,7 +146,7 @@ public abstract class WDScreen extends Screen {
|
||||||
for(Control ctrl: controls)
|
for(Control ctrl: controls)
|
||||||
clicked = clicked || ctrl.mouseClicked(mouseX, mouseY, button);
|
clicked = clicked || ctrl.mouseClicked(mouseX, mouseY, button);
|
||||||
|
|
||||||
return clicked || mouseClicked(mouseX, mouseY, button);
|
return clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -169,7 +166,7 @@ public abstract class WDScreen extends Screen {
|
||||||
for(Control ctrl: controls)
|
for(Control ctrl: controls)
|
||||||
dragged = dragged || ctrl.mouseClickMove(mouseX, mouseY, button, dragX, dragX);
|
dragged = dragged || ctrl.mouseClickMove(mouseX, mouseY, button, dragX, dragX);
|
||||||
|
|
||||||
return dragged || mouseDragged(mouseX, mouseY, button, dragX, dragY);
|
return dragged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -188,7 +185,7 @@ public abstract class WDScreen extends Screen {
|
||||||
for(Control ctrl : controls)
|
for(Control ctrl : controls)
|
||||||
ctrl.destroy();
|
ctrl.destroy();
|
||||||
|
|
||||||
minecraft.keyboardHandler.setSendRepeatsToGui(false);
|
Minecraft.getInstance().keyboardHandler.setSendRepeatsToGui(false);
|
||||||
CURRENT_SCREEN = null;
|
CURRENT_SCREEN = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,7 +216,7 @@ public abstract class WDScreen extends Screen {
|
||||||
for(Control ctrl : controls)
|
for(Control ctrl : controls)
|
||||||
down = down || ctrl.keyDown(keyCode);
|
down = down || ctrl.keyDown(keyCode);
|
||||||
|
|
||||||
return down || super.keyPressed(keyCode, scanCode, modifiers);
|
return new GuiServer(new Vector3i(), new NameUUIDPair()).keyPressed(keyCode, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class Button extends Control {
|
||||||
|
|
||||||
private final boolean shiftDown;
|
private final boolean shiftDown;
|
||||||
|
|
||||||
private ClickEvent(Button btn) {
|
public ClickEvent(Button btn) {
|
||||||
source = btn;
|
source = btn;
|
||||||
shiftDown = btn.shiftDown;
|
shiftDown = btn.shiftDown;
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,6 @@ public class Button extends Control {
|
||||||
|
|
||||||
if(!onClick())
|
if(!onClick())
|
||||||
parent.actionPerformed(new ClickEvent(this));
|
parent.actionPerformed(new ClickEvent(this));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,6 +87,10 @@ public class Button extends Control {
|
||||||
btn.setWidth(width);
|
btn.setWidth(width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHeight(int height) {
|
||||||
|
btn.setHeight(height);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
return btn.getWidth();
|
return btn.getWidth();
|
||||||
|
|
@ -95,7 +98,7 @@ public class Button extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
return 20;
|
return btn.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -204,8 +207,9 @@ public class Button extends Control {
|
||||||
btn.x = json.getInt("x", 0);
|
btn.x = json.getInt("x", 0);
|
||||||
btn.y = json.getInt("y", 0);
|
btn.y = json.getInt("y", 0);
|
||||||
btn.setWidth(json.getInt("width", 200));
|
btn.setWidth(json.getInt("width", 200));
|
||||||
|
btn.setHeight(json.getInt("height", 20));
|
||||||
btn.setMessage(Component.nullToEmpty(tr(json.getString("label", btn.getMessage().getContents()))));
|
btn.setMessage(Component.nullToEmpty(tr(json.getString("label", btn.getMessage().getContents()))));
|
||||||
btn.active = !json.getBool("disabled", !btn.active);
|
btn.active = json.getBool("active", btn.active);
|
||||||
btn.visible = json.getBool("visible", btn.visible);
|
btn.visible = json.getBool("visible", btn.visible);
|
||||||
|
|
||||||
originalColor = json.getColor("color", originalColor);
|
originalColor = json.getColor("color", originalColor);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||||
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.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
|
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
@ -26,7 +28,7 @@ public class CheckBox extends BasicControl {
|
||||||
|
|
||||||
private final boolean checked;
|
private final boolean checked;
|
||||||
|
|
||||||
private CheckedEvent(CheckBox cb) {
|
public CheckedEvent(CheckBox cb) {
|
||||||
source = cb;
|
source = cb;
|
||||||
checked = cb.checked;
|
checked = cb.checked;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@ public abstract class Container extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyTyped(char typedChar, int keyCode) {
|
public boolean keyTyped(int keyCode, int modifiers) {
|
||||||
boolean typed = false;
|
boolean typed = false;
|
||||||
|
|
||||||
if(!disabled) {
|
if(!disabled) {
|
||||||
for(Control ctrl : childs)
|
for(Control ctrl : childs)
|
||||||
typed = typed || ctrl.keyTyped(typedChar, keyCode);
|
typed = typed || ctrl.keyTyped(keyCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return typed;
|
return typed;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.montoyo.wd.client.gui.WDScreen;
|
import net.montoyo.wd.client.gui.WDScreen;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
import net.montoyo.wd.utilities.Bounds;
|
import net.montoyo.wd.utilities.Bounds;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
||||||
import static org.lwjgl.opengl.GL11.glEnable;
|
import static org.lwjgl.opengl.GL11.glEnable;
|
||||||
|
|
@ -35,7 +36,7 @@ public abstract class Control {
|
||||||
protected final Font font;
|
protected final Font font;
|
||||||
protected final Tesselator tessellator;
|
protected final Tesselator tessellator;
|
||||||
protected final BufferBuilder vBuffer;
|
protected final BufferBuilder vBuffer;
|
||||||
protected final WDScreen parent;
|
protected static WDScreen parent;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected Object userdata;
|
protected Object userdata;
|
||||||
|
|
||||||
|
|
@ -55,7 +56,7 @@ public abstract class Control {
|
||||||
this.userdata = userdata;
|
this.userdata = userdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean keyTyped(char typedChar, int keyCode) {
|
public boolean keyTyped(int keyCode, int modifier) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,4 @@ public abstract class Event<T extends Control> {
|
||||||
public T getSource() {
|
public T getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.mojang.blaze3d.pipeline.TextureTarget;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -33,7 +34,7 @@ public class List extends BasicControl {
|
||||||
private final int id;
|
private final int id;
|
||||||
private final Entry entry;
|
private final Entry entry;
|
||||||
|
|
||||||
private EntryClick(List lst) {
|
public EntryClick(List lst) {
|
||||||
source = lst;
|
source = lst;
|
||||||
id = lst.selected;
|
id = lst.selected;
|
||||||
entry = lst.content.get(lst.selected);
|
entry = lst.content.get(lst.selected);
|
||||||
|
|
@ -69,6 +70,8 @@ public class List extends BasicControl {
|
||||||
private double scrollGrab;
|
private double scrollGrab;
|
||||||
|
|
||||||
public List() {
|
public List() {
|
||||||
|
content.add(new Entry("", null));
|
||||||
|
selected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List(int x, int y, int w, int h) {
|
public List(int x, int y, int w, int h) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public class TextField extends Control {
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|
||||||
private EnterPressedEvent(TextField field) {
|
public EnterPressedEvent(TextField field) {
|
||||||
source = field;
|
source = field;
|
||||||
text = field.field.getValue();
|
text = field.field.getValue();
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ public class TextField extends Control {
|
||||||
|
|
||||||
private final String beginning;
|
private final String beginning;
|
||||||
|
|
||||||
private TabPressedEvent(TextField field) {
|
public TabPressedEvent(TextField field) {
|
||||||
source = field;
|
source = field;
|
||||||
|
|
||||||
String text = field.field.getValue();
|
String text = field.field.getValue();
|
||||||
|
|
@ -61,7 +61,7 @@ public class TextField extends Control {
|
||||||
private final String oldContent;
|
private final String oldContent;
|
||||||
private final String newContent;
|
private final String newContent;
|
||||||
|
|
||||||
private TextChangedEvent(TextField tf, String old) {
|
public TextChangedEvent(TextField tf, String old) {
|
||||||
source = tf;
|
source = tf;
|
||||||
oldContent = old;
|
oldContent = old;
|
||||||
newContent = tf.field.getValue();
|
newContent = tf.field.getValue();
|
||||||
|
|
@ -106,7 +106,29 @@ public class TextField extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyTyped(char typedChar, int keyCode) {
|
public boolean keyDown(int key) {
|
||||||
|
if(key == GLFW.GLFW_KEY_BACKSPACE) {
|
||||||
|
String old;
|
||||||
|
if(enabled && field.isFocused())
|
||||||
|
old = field.getValue();
|
||||||
|
else
|
||||||
|
old = null;
|
||||||
|
|
||||||
|
field.charTyped((char) key, 0);
|
||||||
|
|
||||||
|
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
||||||
|
for(TextChangeListener tcl : listeners)
|
||||||
|
tcl.onTextChange(this, old, field.getValue());
|
||||||
|
|
||||||
|
parent.actionPerformed(new TextChangedEvent(this, old));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyTyped(int keyCode, int modifier) {
|
||||||
if(keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER)
|
if(keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER)
|
||||||
parent.actionPerformed(new EnterPressedEvent(this));
|
parent.actionPerformed(new EnterPressedEvent(this));
|
||||||
else if(keyCode == GLFW.GLFW_KEY_TAB)
|
else if(keyCode == GLFW.GLFW_KEY_TAB)
|
||||||
|
|
@ -118,7 +140,7 @@ public class TextField extends Control {
|
||||||
else
|
else
|
||||||
old = null;
|
old = null;
|
||||||
|
|
||||||
field.charTyped(typedChar, keyCode);
|
field.charTyped((char) keyCode, modifier);
|
||||||
|
|
||||||
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
if(enabled && field.isFocused() && !field.getValue().equals(old)) {
|
||||||
for(TextChangeListener tcl : listeners)
|
for(TextChangeListener tcl : listeners)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -132,7 +133,7 @@ public class UpgradeGroup extends BasicControl {
|
||||||
|
|
||||||
private final ItemStack clickStack;
|
private final ItemStack clickStack;
|
||||||
|
|
||||||
private ClickEvent(UpgradeGroup src) {
|
public ClickEvent(UpgradeGroup src) {
|
||||||
source = src;
|
source = src;
|
||||||
clickStack = src.clickStack;
|
clickStack = src.clickStack;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,6 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||||
|
|
||||||
Tesselator tesselator = Tesselator.getInstance();
|
Tesselator tesselator = Tesselator.getInstance();
|
||||||
BufferBuilder builder = tesselator.getBuilder();
|
BufferBuilder builder = tesselator.getBuilder();
|
||||||
VertexBuffer vb = new VertexBuffer();
|
|
||||||
//TODO: Use tesselator
|
//TODO: Use tesselator
|
||||||
RenderSystem.setShaderTexture(0, scr.browser.getTextureID());
|
RenderSystem.setShaderTexture(0, scr.browser.getTextureID());
|
||||||
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX);
|
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX);
|
||||||
|
|
@ -131,7 +130,6 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||||
builder.vertex(poseStack.last().pose(), sw, -sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 1.f).endVertex();
|
builder.vertex(poseStack.last().pose(), sw, -sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 1.f).endVertex();
|
||||||
builder.vertex(poseStack.last().pose(), sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 0.f).endVertex();
|
builder.vertex(poseStack.last().pose(), sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(1.f, 0.f).endVertex();
|
||||||
builder.vertex(poseStack.last().pose(),-sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(0.f, 0.f).endVertex();
|
builder.vertex(poseStack.last().pose(),-sw, sh, 0.505f).color(1.f, 1.f, 1.f, 1.f).uv(0.f, 0.f).endVertex();
|
||||||
vb.draw();
|
|
||||||
tesselator.end();//Minecraft does shit with mah texture otherwise...
|
tesselator.end();//Minecraft does shit with mah texture otherwise...
|
||||||
RenderSystem.bindTexture(0);
|
RenderSystem.bindTexture(0);
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
@ -139,10 +137,10 @@ public class ScreenRenderer implements BlockEntityRenderer<TileEntityScreen> {
|
||||||
|
|
||||||
|
|
||||||
//Bounding box debugging
|
//Bounding box debugging
|
||||||
poseStack.pushPose();
|
/*poseStack.pushPose();
|
||||||
poseStack.translate(-te.getBlockPos().getX(), -te.getBlockPos().getY(), -te.getBlockPos().getZ());
|
poseStack.translate(-te.getBlockPos().getX(), -te.getBlockPos().getY(), -te.getBlockPos().getZ());
|
||||||
renderAABB(te.getRenderBoundingBox());
|
renderAABB(te.getRenderBoundingBox());
|
||||||
poseStack.popPose();
|
poseStack.popPose();*/
|
||||||
|
|
||||||
//Re-enable lighting
|
//Re-enable lighting
|
||||||
RenderSystem.enableCull();
|
RenderSystem.enableCull();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user