mod compiles, things *really* don't work
This commit is contained in:
parent
f7f92cd19c
commit
0867dd68d7
|
|
@ -3,6 +3,7 @@ plugins {
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
|
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
|
||||||
id 'org.spongepowered.mixin' version '0.7.+'
|
id 'org.spongepowered.mixin' version '0.7.+'
|
||||||
|
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = mod_version
|
version = mod_version
|
||||||
|
|
@ -12,7 +13,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||||
|
|
||||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings channel: 'official', version: '1.20.1'
|
mappings channel: 'parchment', version: '2023.06.26-1.20.1'
|
||||||
|
|
||||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -5,6 +5,7 @@ pluginManagement {
|
||||||
name = 'NeoForged'
|
name = 'NeoForged'
|
||||||
url = 'https://maven.neoforged.net/releases'
|
url = 'https://maven.neoforged.net/releases'
|
||||||
}
|
}
|
||||||
|
maven { url = 'https://maven.parchmentmc.org' } // Add this line
|
||||||
}
|
}
|
||||||
// resolutionStrategy {
|
// resolutionStrategy {
|
||||||
// eachPlugin {
|
// eachPlugin {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.network.NetworkEvent;
|
import net.minecraftforge.network.NetworkEvent;
|
||||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||||
import net.montoyo.mcef.api.CefInitEvent;
|
|
||||||
import net.montoyo.wd.core.HasAdvancement;
|
import net.montoyo.wd.core.HasAdvancement;
|
||||||
import net.montoyo.wd.core.JSServerRequest;
|
import net.montoyo.wd.core.JSServerRequest;
|
||||||
import net.montoyo.wd.data.GuiData;
|
import net.montoyo.wd.data.GuiData;
|
||||||
|
|
@ -31,13 +30,14 @@ public class SharedProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
MinecraftForge.EVENT_BUS.addListener(this::onCefInit);
|
// MinecraftForge.EVENT_BUS.addListener(this::onCefInit);
|
||||||
|
onCefInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postInit() {
|
public void postInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCefInit(CefInitEvent event) {
|
public void onCefInit(/*CefInitEvent event*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true)
|
||||||
|
|
@ -46,7 +46,7 @@ public class SharedProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockGetter getWorld(NetworkEvent.Context context) {
|
public BlockGetter getWorld(NetworkEvent.Context context) {
|
||||||
if (context.getSender() != null) return context.getSender().level;
|
if (context.getSender() != null) return context.getSender().level();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public class WebDisplays {
|
||||||
cursorSupport = (ver.getMajorVersion() >= 1 && ver.getMinorVersion() >= 2 && ver.getIncrementalVersion() >= 4);
|
cursorSupport = (ver.getMajorVersion() >= 1 && ver.getMinorVersion() >= 2 && ver.getIncrementalVersion() >= 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WDCreativeTab CREATIVE_TAB;
|
// public static WDCreativeTab CREATIVE_TAB;
|
||||||
public static final ResourceLocation ADV_PAD_BREAK = new ResourceLocation("webdisplays", "webdisplays/pad_break");
|
public static final ResourceLocation ADV_PAD_BREAK = new ResourceLocation("webdisplays", "webdisplays/pad_break");
|
||||||
public static final String BLACKLIST_URL = "mod://webdisplays/blacklisted.html";
|
public static final String BLACKLIST_URL = "mod://webdisplays/blacklisted.html";
|
||||||
public static final Gson GSON = new Gson();
|
public static final Gson GSON = new Gson();
|
||||||
|
|
@ -127,7 +127,7 @@ public class WebDisplays {
|
||||||
|
|
||||||
CommonConfig.init();
|
CommonConfig.init();
|
||||||
|
|
||||||
CREATIVE_TAB = new WDCreativeTab();
|
// CREATIVE_TAB = new WDCreativeTab();
|
||||||
|
|
||||||
//Criterions
|
//Criterions
|
||||||
criterionPadBreak = new Criterion("pad_break");
|
criterionPadBreak = new Criterion("pad_break");
|
||||||
|
|
@ -259,7 +259,7 @@ public class WebDisplays {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onToss(ItemTossEvent ev) {
|
public void onToss(ItemTossEvent ev) {
|
||||||
if(!ev.getEntity().getLevel().isClientSide) {
|
if(!ev.getEntity().level().isClientSide) {
|
||||||
ItemStack is = ev.getEntity().getItem();
|
ItemStack is = ev.getEntity().getItem();
|
||||||
|
|
||||||
if(is.getItem() == ItemInit.MINEPAD.get()) {
|
if(is.getItem() == ItemInit.MINEPAD.get()) {
|
||||||
|
|
@ -284,8 +284,8 @@ public class WebDisplays {
|
||||||
if((ev.getEntity() instanceof ServerPlayer && !hasPlayerAdvancement((ServerPlayer) ev.getEntity(), ADV_PAD_BREAK)) || PROXY.hasClientPlayerAdvancement(ADV_PAD_BREAK) != HasAdvancement.YES) {
|
if((ev.getEntity() instanceof ServerPlayer && !hasPlayerAdvancement((ServerPlayer) ev.getEntity(), ADV_PAD_BREAK)) || PROXY.hasClientPlayerAdvancement(ADV_PAD_BREAK) != HasAdvancement.YES) {
|
||||||
ev.getCrafting().setDamageValue(CraftComponent.BADEXTCARD.ordinal());
|
ev.getCrafting().setDamageValue(CraftComponent.BADEXTCARD.ordinal());
|
||||||
|
|
||||||
if(!ev.getEntity().getLevel().isClientSide)
|
if(!ev.getEntity().level().isClientSide)
|
||||||
ev.getEntity().getLevel().playSound(null, ev.getEntity().getX(), ev.getEntity().getY(), ev.getEntity().getZ(), SoundEvents.ITEM_BREAK, SoundSource.MASTER, 1.0f, 1.0f);
|
ev.getEntity().level().playSound(null, ev.getEntity().getX(), ev.getEntity().getY(), ev.getEntity().getZ(), SoundEvents.ITEM_BREAK, SoundSource.MASTER, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +297,7 @@ public class WebDisplays {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLogIn(PlayerEvent.PlayerLoggedInEvent ev) {
|
public void onLogIn(PlayerEvent.PlayerLoggedInEvent ev) {
|
||||||
if(!ev.getEntity().getLevel().isClientSide && ev.getEntity() instanceof ServerPlayer) {
|
if(!ev.getEntity().level().isClientSide && ev.getEntity() instanceof ServerPlayer) {
|
||||||
IWDDCapability cap = ev.getEntity().getCapability(WDDCapability.Provider.cap, null).orElseThrow(RuntimeException::new);
|
IWDDCapability cap = ev.getEntity().getCapability(WDDCapability.Provider.cap, null).orElseThrow(RuntimeException::new);
|
||||||
|
|
||||||
if(cap.isFirstRun()) {
|
if(cap.isFirstRun()) {
|
||||||
|
|
@ -320,7 +320,7 @@ public class WebDisplays {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onLogOut(PlayerEvent.PlayerLoggedOutEvent ev) {
|
public void onLogOut(PlayerEvent.PlayerLoggedOutEvent ev) {
|
||||||
if(!ev.getEntity().getLevel().isClientSide)
|
if(!ev.getEntity().level().isClientSide)
|
||||||
Server.getInstance().getClientManager().revokeClientKey(ev.getEntity().getGameProfile().getId());
|
Server.getInstance().getClientManager().revokeClientKey(ev.getEntity().getGameProfile().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,7 +361,7 @@ public class WebDisplays {
|
||||||
|
|
||||||
if(sb.toString().equals("ironic he could save others from death but not himself")) {
|
if(sb.toString().equals("ironic he could save others from death but not himself")) {
|
||||||
Player ply = ev.getPlayer();
|
Player ply = ev.getPlayer();
|
||||||
ply.getLevel().playSound(null, ply.getX(), ply.getY(), ply.getZ(), soundIronic, SoundSource.PLAYERS, 1.0f, 1.0f);
|
ply.level().playSound(null, ply.getX(), ply.getY(), ply.getZ(), soundIronic, SoundSource.PLAYERS, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -388,7 +388,7 @@ public class WebDisplays {
|
||||||
|
|
||||||
private static void registerSound(String resName) {
|
private static void registerSound(String resName) {
|
||||||
ResourceLocation resLoc = new ResourceLocation("webdisplays", resName);
|
ResourceLocation resLoc = new ResourceLocation("webdisplays", resName);
|
||||||
SoundEvent ret = new SoundEvent(resLoc);
|
SoundEvent ret = SoundEvent.createVariableRangeEvent(resLoc);
|
||||||
|
|
||||||
SOUNDS.register(resName, () -> ret);
|
SOUNDS.register(resName, () -> ret);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ public class BlockScreen extends BaseEntityBlock {
|
||||||
if (tes != null && tes.hasUpgrade(side, DefaultUpgrade.REDINPUT)) {
|
if (tes != null && tes.hasUpgrade(side, DefaultUpgrade.REDINPUT)) {
|
||||||
Direction facing = Direction.from2DDataValue(side.reverse().ordinal()); //Opposite face
|
Direction facing = Direction.from2DDataValue(side.reverse().ordinal()); //Opposite face
|
||||||
vec.sub(pos.getX(), pos.getY(), pos.getZ()).neg();
|
vec.sub(pos.getX(), pos.getY(), pos.getZ()).neg();
|
||||||
tes.updateJSRedstone(side, new Vector2i(vec.dot(side.right), vec.dot(side.up)), world.getSignal(pos, facing));
|
// tes.updateJSRedstone(side, new Vector2i(vec.dot(side.right), vec.dot(side.up)), world.getSignal(pos, facing));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,149 +1,149 @@
|
||||||
/*
|
///*
|
||||||
* Copyright (C) 2018 BARBOTIN Nicolas
|
// * Copyright (C) 2018 BARBOTIN Nicolas
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
package net.montoyo.wd.client;
|
//package net.montoyo.wd.client;
|
||||||
|
//
|
||||||
import net.montoyo.mcef.api.IScheme;
|
//import net.montoyo.mcef.api.IScheme;
|
||||||
import net.montoyo.mcef.api.ISchemeResponseData;
|
//import net.montoyo.mcef.api.ISchemeResponseData;
|
||||||
import net.montoyo.mcef.api.ISchemeResponseHeaders;
|
//import net.montoyo.mcef.api.ISchemeResponseHeaders;
|
||||||
import net.montoyo.mcef.api.SchemePreResponse;
|
//import net.montoyo.mcef.api.SchemePreResponse;
|
||||||
import net.montoyo.wd.WebDisplays;
|
//import net.montoyo.wd.WebDisplays;
|
||||||
import net.montoyo.wd.miniserv.Constants;
|
//import net.montoyo.wd.miniserv.Constants;
|
||||||
import net.montoyo.wd.miniserv.client.Client;
|
//import net.montoyo.wd.miniserv.client.Client;
|
||||||
import net.montoyo.wd.miniserv.client.ClientTaskGetFile;
|
//import net.montoyo.wd.miniserv.client.ClientTaskGetFile;
|
||||||
import net.montoyo.wd.utilities.Log;
|
//import net.montoyo.wd.utilities.Log;
|
||||||
import net.montoyo.wd.utilities.Util;
|
//import net.montoyo.wd.utilities.Util;
|
||||||
|
//
|
||||||
import java.io.UnsupportedEncodingException;
|
//import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
//import java.net.URLDecoder;
|
||||||
import java.util.UUID;
|
//import java.util.UUID;
|
||||||
|
//
|
||||||
public class WDScheme implements IScheme {
|
//public class WDScheme implements IScheme {
|
||||||
|
//
|
||||||
private static final String ERROR_PAGE = "<!DOCTYPE html><html><head></head><body><h1>%d %s</h1><hr /><i>Miniserv powered by WebDisplays</i></body></html>";
|
// private static final String ERROR_PAGE = "<!DOCTYPE html><html><head></head><body><h1>%d %s</h1><hr /><i>Miniserv powered by WebDisplays</i></body></html>";
|
||||||
private ClientTaskGetFile task;
|
// private ClientTaskGetFile task;
|
||||||
private boolean isErrorPage;
|
// private boolean isErrorPage;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public SchemePreResponse processRequest(String url) {
|
// public SchemePreResponse processRequest(String url) {
|
||||||
url = url.substring("wd://".length());
|
// url = url.substring("wd://".length());
|
||||||
|
//
|
||||||
int pos = url.indexOf('/');
|
// int pos = url.indexOf('/');
|
||||||
if(pos < 0)
|
// if(pos < 0)
|
||||||
return SchemePreResponse.NOT_HANDLED;
|
// return SchemePreResponse.NOT_HANDLED;
|
||||||
|
//
|
||||||
String uuidStr = url.substring(0, pos);
|
// String uuidStr = url.substring(0, pos);
|
||||||
String fileStr = url.substring(pos + 1);
|
// String fileStr = url.substring(pos + 1);
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
fileStr = URLDecoder.decode(fileStr, "UTF-8");
|
// fileStr = URLDecoder.decode(fileStr, "UTF-8");
|
||||||
} catch(UnsupportedEncodingException ex) {
|
// } catch(UnsupportedEncodingException ex) {
|
||||||
Log.warningEx("UTF-8 isn't supported... yeah... and I'm a billionaire...", ex);
|
// Log.warningEx("UTF-8 isn't supported... yeah... and I'm a billionaire...", ex);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(uuidStr.isEmpty() || Util.isFileNameInvalid(fileStr))
|
// if(uuidStr.isEmpty() || Util.isFileNameInvalid(fileStr))
|
||||||
return SchemePreResponse.NOT_HANDLED;
|
// return SchemePreResponse.NOT_HANDLED;
|
||||||
|
//
|
||||||
UUID uuid;
|
// UUID uuid;
|
||||||
try {
|
// try {
|
||||||
uuid = UUID.fromString(uuidStr);
|
// uuid = UUID.fromString(uuidStr);
|
||||||
} catch(IllegalArgumentException ex) {
|
// } catch(IllegalArgumentException ex) {
|
||||||
return SchemePreResponse.NOT_HANDLED; //Invalid UUID
|
// return SchemePreResponse.NOT_HANDLED; //Invalid UUID
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
task = new ClientTaskGetFile(uuid, fileStr);
|
// task = new ClientTaskGetFile(uuid, fileStr);
|
||||||
return Client.getInstance().addTask(task) ? SchemePreResponse.HANDLED_CONTINUE : SchemePreResponse.NOT_HANDLED;
|
// return Client.getInstance().addTask(task) ? SchemePreResponse.HANDLED_CONTINUE : SchemePreResponse.NOT_HANDLED;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void getResponseHeaders(ISchemeResponseHeaders resp) {
|
// public void getResponseHeaders(ISchemeResponseHeaders resp) {
|
||||||
Log.info("Waiting for response...");
|
// Log.info("Waiting for response...");
|
||||||
int status = task.waitForResponse();
|
// int status = task.waitForResponse();
|
||||||
Log.info("Got response %d", status);
|
// Log.info("Got response %d", status);
|
||||||
|
//
|
||||||
if(status == 0) {
|
// if(status == 0) {
|
||||||
//OK
|
// //OK
|
||||||
int extPos = task.getFileName().lastIndexOf('.');
|
// int extPos = task.getFileName().lastIndexOf('.');
|
||||||
if(extPos >= 0) {
|
// if(extPos >= 0) {
|
||||||
String mime = ((ClientProxy) WebDisplays.PROXY).getMCEF().mimeTypeFromExtension(task.getFileName().substring(extPos + 1));
|
// String mime = ((ClientProxy) WebDisplays.PROXY).getMCEF().mimeTypeFromExtension(task.getFileName().substring(extPos + 1));
|
||||||
|
//
|
||||||
if(mime != null)
|
// if(mime != null)
|
||||||
resp.setMimeType(mime);
|
// resp.setMimeType(mime);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
resp.setStatus(200);
|
// resp.setStatus(200);
|
||||||
resp.setStatusText("OK");
|
// resp.setStatusText("OK");
|
||||||
resp.setResponseLength(-1);
|
// resp.setResponseLength(-1);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
int errCode;
|
// int errCode;
|
||||||
String errStr;
|
// String errStr;
|
||||||
|
//
|
||||||
if(status == Constants.GETF_STATUS_NOT_FOUND) {
|
// if(status == Constants.GETF_STATUS_NOT_FOUND) {
|
||||||
errCode = 404;
|
// errCode = 404;
|
||||||
errStr = "Not Found";
|
// errStr = "Not Found";
|
||||||
} else {
|
// } else {
|
||||||
errCode = 500;
|
// errCode = 500;
|
||||||
errStr = "Internal Server Error";
|
// errStr = "Internal Server Error";
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
resp.setStatus(errCode);
|
// resp.setStatus(errCode);
|
||||||
resp.setStatusText(errStr);
|
// resp.setStatusText(errStr);
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
dataToWrite = String.format(ERROR_PAGE, errCode, errStr).getBytes("UTF-8");
|
// dataToWrite = String.format(ERROR_PAGE, errCode, errStr).getBytes("UTF-8");
|
||||||
dataOffset = 0;
|
// dataOffset = 0;
|
||||||
amountToWrite = dataToWrite.length;
|
// amountToWrite = dataToWrite.length;
|
||||||
isErrorPage = true;
|
// isErrorPage = true;
|
||||||
resp.setResponseLength(amountToWrite);
|
// resp.setResponseLength(amountToWrite);
|
||||||
} catch(UnsupportedEncodingException ex) {
|
// } catch(UnsupportedEncodingException ex) {
|
||||||
resp.setResponseLength(0);
|
// resp.setResponseLength(0);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private byte[] dataToWrite;
|
// private byte[] dataToWrite;
|
||||||
private int dataOffset;
|
// private int dataOffset;
|
||||||
private int amountToWrite;
|
// private int amountToWrite;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public boolean readResponse(ISchemeResponseData data) {
|
// public boolean readResponse(ISchemeResponseData data) {
|
||||||
if(dataToWrite == null) {
|
// if(dataToWrite == null) {
|
||||||
if(isErrorPage) {
|
// if(isErrorPage) {
|
||||||
data.setAmountRead(0);
|
// data.setAmountRead(0);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
dataToWrite = task.waitForData();
|
// dataToWrite = task.waitForData();
|
||||||
dataOffset = 3; //packet ID + size
|
// dataOffset = 3; //packet ID + size
|
||||||
amountToWrite = task.getDataLength();
|
// amountToWrite = task.getDataLength();
|
||||||
|
//
|
||||||
if(amountToWrite <= 0) {
|
// if(amountToWrite <= 0) {
|
||||||
dataToWrite = null;
|
// dataToWrite = null;
|
||||||
data.setAmountRead(0);
|
// data.setAmountRead(0);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
int toWrite = data.getBytesToRead();
|
// int toWrite = data.getBytesToRead();
|
||||||
if(toWrite > amountToWrite)
|
// if(toWrite > amountToWrite)
|
||||||
toWrite = amountToWrite;
|
// toWrite = amountToWrite;
|
||||||
|
//
|
||||||
System.arraycopy(dataToWrite, dataOffset, data.getDataArray(), 0, toWrite);
|
// System.arraycopy(dataToWrite, dataOffset, data.getDataArray(), 0, toWrite);
|
||||||
data.setAmountRead(toWrite);
|
// data.setAmountRead(toWrite);
|
||||||
|
//
|
||||||
dataOffset += toWrite;
|
// dataOffset += toWrite;
|
||||||
amountToWrite -= toWrite;
|
// amountToWrite -= toWrite;
|
||||||
|
//
|
||||||
if(amountToWrite <= 0) {
|
// if(amountToWrite <= 0) {
|
||||||
if(!isErrorPage)
|
// if(!isErrorPage)
|
||||||
task.nextData();
|
// task.nextData();
|
||||||
|
//
|
||||||
dataToWrite = null;
|
// dataToWrite = null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
|
|
@ -136,16 +136,16 @@ public class GuiKeyboard extends WDScreen {
|
||||||
defaultBackground = showWarning;
|
defaultBackground = showWarning;
|
||||||
syncTicks = 5;
|
syncTicks = 5;
|
||||||
|
|
||||||
if (vivecraftPresent)
|
// if (vivecraftPresent)
|
||||||
if (VRPlayer.get() != null)
|
// if (VRPlayer.get() != null)
|
||||||
KeyboardHandler.setOverlayShowing(true);
|
// KeyboardHandler.setOverlayShowing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
if (vivecraftPresent)
|
// if (vivecraftPresent)
|
||||||
if (VRPlayer.get() != null)
|
// if (VRPlayer.get() != null)
|
||||||
KeyboardHandler.setOverlayShowing(false);
|
// KeyboardHandler.setOverlayShowing(false);
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ public class GuiMinePad extends WDScreen {
|
||||||
this();
|
this();
|
||||||
this.pad = pad;
|
this.pad = pad;
|
||||||
|
|
||||||
if (WebDisplays.cursorSupport)
|
// if (WebDisplays.cursorSupport)
|
||||||
pad.view.allowCursorChanges(true);
|
// pad.view.allowCursorChanges(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -61,31 +61,31 @@ public class GuiMinePad extends WDScreen {
|
||||||
bb.vertex(x, y + h, 0.0).color(255, 255, 255, 255).endVertex();
|
bb.vertex(x, y + h, 0.0).color(255, 255, 255, 255).endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
// public void render(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
renderBackground(poseStack);
|
// renderBackground(poseStack);
|
||||||
|
//
|
||||||
RenderSystem.disableTexture();
|
// RenderSystem.disableTexture();
|
||||||
RenderSystem.disableCull();
|
// RenderSystem.disableCull();
|
||||||
RenderSystem.setShaderColor(0.73f, 0.73f, 0.73f, 1.0f);
|
// RenderSystem.setShaderColor(0.73f, 0.73f, 0.73f, 1.0f);
|
||||||
|
//
|
||||||
Tesselator t = Tesselator.getInstance();
|
// Tesselator t = Tesselator.getInstance();
|
||||||
BufferBuilder bb = t.getBuilder();
|
// BufferBuilder bb = t.getBuilder();
|
||||||
bb.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
// bb.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR);
|
||||||
addRect(bb, vx, vy - 16, vw, 16);
|
// addRect(bb, vx, vy - 16, vw, 16);
|
||||||
addRect(bb, vx, vy + vh, vw, 16);
|
// addRect(bb, vx, vy + vh, vw, 16);
|
||||||
addRect(bb, vx - 16, vy, 16, vh);
|
// addRect(bb, vx - 16, vy, 16, vh);
|
||||||
addRect(bb, vx + vw, vy, 16, vh);
|
// addRect(bb, vx + vw, vy, 16, vh);
|
||||||
t.end();
|
// t.end();
|
||||||
|
//
|
||||||
RenderSystem.enableTexture();
|
// RenderSystem.enableTexture();
|
||||||
|
//
|
||||||
if (pad.view != null) {
|
// if (pad.view != null) {
|
||||||
pad.view.draw(poseStack, vx, vy + vh, vx + vw, vy);
|
// pad.view.draw(poseStack, vx, vy + vh, vx + vw, vy);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
RenderSystem.enableCull();
|
// RenderSystem.enableCull();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
|
|
@ -99,12 +99,13 @@ public class GuiMinePad extends WDScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean charTyped(char codePoint, int modifiers) {
|
public boolean charTyped(char codePoint, int modifiers) {
|
||||||
if (pad.view != null) {
|
// if (pad.view != null) {
|
||||||
pad.view.injectKeyTyped((int) codePoint, modifiers);
|
// pad.view.injectKeyTyped((int) codePoint, modifiers);
|
||||||
return true;
|
// return true;
|
||||||
} else {
|
// } else {
|
||||||
return super.charTyped(codePoint, modifiers);
|
// return super.charTyped(codePoint, modifiers);
|
||||||
}
|
// }
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copied from MCEF */
|
/* copied from MCEF */
|
||||||
|
|
@ -128,16 +129,16 @@ public class GuiMinePad extends WDScreen {
|
||||||
key = '\n';
|
key = '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pad.view != null) {
|
// if (pad.view != null) {
|
||||||
if (pressed)
|
// if (pressed)
|
||||||
pad.view.injectKeyPressedByKeyCode(keyCode, key, modifiers);
|
// pad.view.injectKeyPressedByKeyCode(keyCode, key, modifiers);
|
||||||
else
|
// else
|
||||||
pad.view.injectKeyReleasedByKeyCode(keyCode, key, modifiers);
|
// pad.view.injectKeyReleasedByKeyCode(keyCode, key, modifiers);
|
||||||
|
//
|
||||||
if (pressed && key == '\n')
|
// if (pressed && key == '\n')
|
||||||
if (modifiers != 0) pad.view.injectKeyTyped('\r', modifiers);
|
// if (modifiers != 0) pad.view.injectKeyTyped('\r', modifiers);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -176,20 +177,20 @@ public class GuiMinePad extends WDScreen {
|
||||||
double mx = (sx - vx) / vw;
|
double mx = (sx - vx) / vw;
|
||||||
double my = (sy - vy) / vh;
|
double my = (sy - vy) / vh;
|
||||||
|
|
||||||
if (pad.view != null && mx >= 0 && mx <= 1) {
|
// if (pad.view != null && mx >= 0 && mx <= 1) {
|
||||||
int wheel = (int) scrollAmount;
|
// int wheel = (int) scrollAmount;
|
||||||
|
//
|
||||||
//Scale again according to the webview
|
// //Scale again according to the webview
|
||||||
sx = (int) (mx * WebDisplays.INSTANCE.padResX);
|
// sx = (int) (mx * WebDisplays.INSTANCE.padResX);
|
||||||
sy = (int) (my * WebDisplays.INSTANCE.padResY);
|
// sy = (int) (my * WebDisplays.INSTANCE.padResY);
|
||||||
|
//
|
||||||
if (wheel != 0)
|
// if (wheel != 0)
|
||||||
pad.view.injectMouseWheel(sx, sy, (hasControlDown() && ! hasAltDown() && !hasShiftDown()) ? GLFW.GLFW_MOD_CONTROL : 0, wheel, 0);
|
// pad.view.injectMouseWheel(sx, sy, (hasControlDown() && ! hasAltDown() && !hasShiftDown()) ? GLFW.GLFW_MOD_CONTROL : 0, wheel, 0);
|
||||||
if (btn == -1)
|
// if (btn == -1)
|
||||||
pad.view.injectMouseMove(sx, sy, 0, sy < 0);
|
// pad.view.injectMouseMove(sx, sy, 0, sy < 0);
|
||||||
else
|
// else
|
||||||
pad.view.injectMouseButton(sx, sy, 0, btn + 1, pressed, 1);
|
// pad.view.injectMouseButton(sx, sy, 0, btn + 1, pressed, 1);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<Character> getChar(int keyCode, int scanCode) {
|
public static Optional<Character> getChar(int keyCode, int scanCode) {
|
||||||
|
|
@ -222,7 +223,7 @@ public class GuiMinePad extends WDScreen {
|
||||||
public void removed() {
|
public void removed() {
|
||||||
super.removed();
|
super.removed();
|
||||||
if (pad.view instanceof CefBrowserOsr osr) {
|
if (pad.view instanceof CefBrowserOsr osr) {
|
||||||
osr.allowCursorChanges(true);
|
// osr.allowCursorChanges(true);
|
||||||
osr.onCursorChange(null, 0);
|
osr.onCursorChange(null, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -230,10 +231,10 @@ public class GuiMinePad extends WDScreen {
|
||||||
@Override
|
@Override
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
if (WebDisplays.cursorSupport) {
|
// if (WebDisplays.cursorSupport) {
|
||||||
pad.view.allowCursorChanges(false);
|
// pad.view.allowCursorChanges(false);
|
||||||
if (pad.view instanceof CefBrowserOsr osr)
|
// if (pad.view instanceof CefBrowserOsr osr)
|
||||||
osr.onCursorChange(null, 0);
|
// osr.onCursorChange(null, 0);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,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 net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||||
|
|
@ -23,6 +24,8 @@ import net.montoyo.wd.miniserv.client.*;
|
||||||
import net.montoyo.wd.net.WDNetworkRegistry;
|
import net.montoyo.wd.net.WDNetworkRegistry;
|
||||||
import net.montoyo.wd.utilities.*;
|
import net.montoyo.wd.utilities.*;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.lwjgl.opengl.GL;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
|
|
@ -93,48 +96,50 @@ public class GuiServer extends WDScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void render(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
super.render(poseStack, mouseX, mouseY, ptt);
|
super.render(poseStack, mouseX, mouseY, ptt);
|
||||||
|
|
||||||
int x = (width - 256) / 2;
|
int x = (width - 256) / 2;
|
||||||
int y = (height - 176) / 2;
|
int y = (height - 176) / 2;
|
||||||
|
|
||||||
RenderSystem.enableTexture();
|
// RenderSystem.enableTexture();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
RenderSystem.setShaderTexture(0, BG_IMAGE);
|
RenderSystem.setShaderTexture(0, BG_IMAGE);
|
||||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
blit(poseStack, x, y, 0, 0, 256, 176);
|
// blit(poseStack, x, y, 0, 0, 256, 176);
|
||||||
|
|
||||||
x += 18;
|
x += 18;
|
||||||
y += 18;
|
y += 18;
|
||||||
|
|
||||||
for(int i = 0; i < lines.size(); i++) {
|
for(int i = 0; i < lines.size(); i++) {
|
||||||
if(selectedLine == i) {
|
// if(selectedLine == i) {
|
||||||
drawWhiteQuad(x - 1, y - 2, font.width(lines.get(i)) + 1, 12);
|
// drawWhiteQuad(x - 1, y - 2, font.width(lines.get(i)) + 1, 12);
|
||||||
font.drawShadow(poseStack, lines.get(i), x, y, 0xFF129700, false);
|
// font.drawShadow(poseStack, lines.get(i), x, y, 0xFF129700, false);
|
||||||
} else
|
// } else
|
||||||
font.drawShadow(poseStack, lines.get(i), x, y, 0xFFFFFFFF, false);
|
// font.drawShadow(poseStack, lines.get(i), x, y, 0xFFFFFFFF, false);
|
||||||
|
|
||||||
y += 12;
|
y += 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!promptLocked) {
|
if(!promptLocked) {
|
||||||
if (queue.isEmpty()) {
|
// if (queue.isEmpty()) {
|
||||||
x = font.drawShadow(poseStack, userPrompt, x, y, 0xFFFFFFFF, false);
|
// x = font.drawShadow(poseStack, userPrompt, x, y, 0xFFFFFFFF, false);
|
||||||
x = font.drawShadow(poseStack, prompt, x, y, 0xFFFFFFFF, false);
|
// x = font.drawShadow(poseStack, prompt, x, y, 0xFFFFFFFF, false);
|
||||||
} else {
|
// } else {
|
||||||
x = font.drawShadow(poseStack, tr("press_for_more"), x, y, 0xFFFFFFFF, false);
|
// x = font.drawShadow(poseStack, tr("press_for_more"), x, y, 0xFFFFFFFF, false);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!uploadWizard && blinkTime < 5)
|
if(!uploadWizard && blinkTime < 5)
|
||||||
drawWhiteQuad(x + 1, y, 6, 8);
|
drawWhiteQuad(x + 1, y, 6, 8);
|
||||||
|
|
||||||
RenderSystem.enableTexture();
|
// RenderSystem.enableTexture();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
RenderSystem.setShaderTexture(0, FG_IMAGE);
|
RenderSystem.setShaderTexture(0, FG_IMAGE);
|
||||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
blit(poseStack,(width - 256) / 2, (height - 176) / 2, 0, 0, 256, 176);
|
// blit(poseStack,(width - 256) / 2, (height - 176) / 2, 0, 0, 256, 176);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawWhiteQuad(int x, int y, int w, int h) {
|
private void drawWhiteQuad(int x, int y, int w, int h) {
|
||||||
|
|
@ -144,7 +149,8 @@ public class GuiServer extends WDScreen {
|
||||||
float yd2 = (float) (y + h);
|
float yd2 = (float) (y + h);
|
||||||
float zd = (float) getBlitOffset();
|
float zd = (float) getBlitOffset();
|
||||||
|
|
||||||
RenderSystem.disableTexture();
|
// RenderSystem.disableTexture();
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
Tesselator t = Tesselator.getInstance();
|
Tesselator t = Tesselator.getInstance();
|
||||||
BufferBuilder bb = t.getBuilder();
|
BufferBuilder bb = t.getBuilder();
|
||||||
|
|
@ -154,7 +160,12 @@ public class GuiServer extends WDScreen {
|
||||||
bb.vertex(xd2, yd, zd).endVertex();
|
bb.vertex(xd2, yd, zd).endVertex();
|
||||||
bb.vertex(xd, yd, zd).endVertex();
|
bb.vertex(xd, yd, zd).endVertex();
|
||||||
t.end();
|
t.end();
|
||||||
RenderSystem.enableTexture();
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
// RenderSystem.enableTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getBlitOffset() {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ public class GuiSetURL2 extends WDScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
url = Util.addProtocol(url);
|
url = Util.addProtocol(url);
|
||||||
url = ((ClientProxy) WebDisplays.PROXY).getMCEF().punycode(url);
|
// url = ((ClientProxy) WebDisplays.PROXY).getMCEF().punycode(url);
|
||||||
|
|
||||||
if (isPad) {
|
if (isPad) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ package net.montoyo.wd.client.gui;
|
||||||
import com.mojang.blaze3d.platform.Lighting;
|
import com.mojang.blaze3d.platform.Lighting;
|
||||||
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.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
|
|
@ -79,13 +80,14 @@ public class RenderRecipe extends Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) {
|
public void render(GuiGraphics context, int mouseX, int mouseY, float partialTick) {
|
||||||
renderBackground(poseStack);
|
// renderBackground(poseStack);
|
||||||
|
renderBackground(context);
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
RenderSystem.setShaderTexture(0, CRAFTING_TABLE_GUI_TEXTURES);
|
RenderSystem.setShaderTexture(0, CRAFTING_TABLE_GUI_TEXTURES);
|
||||||
blit(poseStack, x, y, 0, 0, SIZE_X, SIZE_Y);
|
// context.blit(x, y, 0, 0, SIZE_X, SIZE_Y);
|
||||||
font.draw(poseStack, I18n.get("container.crafting"), x + 28, y + 6, 0x404040);
|
// font.draw(poseStack, I18n.get("container.crafting"), x + 28, y + 6, 0x404040);
|
||||||
|
|
||||||
Lighting.setupForFlatItems();
|
Lighting.setupForFlatItems();
|
||||||
// RenderSystem.disableLighting(); //TODO: Need this?
|
// RenderSystem.disableLighting(); //TODO: Need this?
|
||||||
|
|
@ -98,15 +100,15 @@ public class RenderRecipe extends Screen {
|
||||||
int x = this.x + 30 + sx * 18;
|
int x = this.x + 30 + sx * 18;
|
||||||
int y = this.y + 17 + sy * 18;
|
int y = this.y + 17 + sy * 18;
|
||||||
|
|
||||||
renderItem.renderAndDecorateItem(minecraft.player, is, x, y, 0);
|
// renderItem.renderAndDecorateItem(minecraft.player, is, x, y, 0);
|
||||||
renderItem.renderGuiItemDecorations(font, is, x, y, null);
|
// renderItem.renderGuiItemDecorations(font, is, x, y, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recipeResult != null) {
|
if(recipeResult != null) {
|
||||||
renderItem.renderAndDecorateItem(minecraft.player, recipeResult, x + 124, y + 35, 0);
|
// renderItem.renderAndDecorateItem(minecraft.player, recipeResult, x + 124, y + 35, 0);
|
||||||
renderItem.renderGuiItemDecorations(font, recipeResult, x + 124, y + 35, null);
|
// renderItem.renderGuiItemDecorations(font, recipeResult, x + 124, y + 35, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// GlStateManager.enableLighting();
|
// GlStateManager.enableLighting();
|
||||||
|
|
@ -127,7 +129,7 @@ public class RenderRecipe extends Screen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeResult = recipe.getResultItem();
|
// recipeResult = recipe.getResultItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void nextRecipe() {
|
private void nextRecipe() {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
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.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
@ -111,15 +112,15 @@ public abstract class WDScreen extends Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void render(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(defaultBackground)
|
if(defaultBackground)
|
||||||
renderBackground(poseStack);
|
renderBackground(poseStack);
|
||||||
|
|
||||||
for(Control ctrl: controls)
|
// for(Control ctrl: controls)
|
||||||
ctrl.draw(poseStack, mouseX, mouseY, ptt);
|
// ctrl.draw(poseStack, mouseX, mouseY, ptt);
|
||||||
|
//
|
||||||
for(Control ctrl: postDrawList)
|
// for(Control ctrl: postDrawList)
|
||||||
ctrl.postDraw(poseStack, mouseX, mouseY, ptt);
|
// ctrl.postDraw(poseStack, mouseX, mouseY, ptt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -167,7 +168,7 @@ public abstract class WDScreen extends Screen {
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
CURRENT_SCREEN = this;
|
CURRENT_SCREEN = this;
|
||||||
minecraft.keyboardHandler.setSendRepeatsToGui(true);
|
// minecraft.keyboardHandler.setSendRepeatsToGui(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -180,7 +181,7 @@ public abstract class WDScreen extends Screen {
|
||||||
for(Control ctrl : controls)
|
for(Control ctrl : controls)
|
||||||
ctrl.destroy();
|
ctrl.destroy();
|
||||||
|
|
||||||
Minecraft.getInstance().keyboardHandler.setSendRepeatsToGui(false);
|
// Minecraft.getInstance().keyboardHandler.setSendRepeatsToGui(false);
|
||||||
CURRENT_SCREEN = null;
|
CURRENT_SCREEN = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,11 +364,11 @@ public abstract class WDScreen extends Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawItemStackTooltip(PoseStack poseStack, ItemStack is, int x, int y) {
|
public void drawItemStackTooltip(PoseStack poseStack, ItemStack is, int x, int y) {
|
||||||
renderTooltip(poseStack, is, x, y); //Since it's protected...
|
// renderTooltip(poseStack, is, x, y); //Since it's protected...
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(PoseStack poseStack, List<String> lines, int x, int y) {
|
public void drawTooltip(PoseStack poseStack, List<String> lines, int x, int y) {
|
||||||
renderTooltip(poseStack, lines.stream().map(a -> FormattedCharSequence.forward(a, Style.EMPTY)).collect(Collectors.toList()), x, y, font); //This is also protected...
|
// renderTooltip(poseStack, lines.stream().map(a -> FormattedCharSequence.forward(a, Style.EMPTY)).collect(Collectors.toList()), x, y, font); //This is also protected...
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requirePostDraw(Control ctrl) {
|
public void requirePostDraw(Control ctrl) {
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,15 @@
|
||||||
package net.montoyo.wd.client.gui.controls;
|
package net.montoyo.wd.client.gui.controls;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.chat.ComponentContents;
|
||||||
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class Button extends Control {
|
public class Button extends Control {
|
||||||
|
|
||||||
protected final net.minecraft.client.gui.components.Button btn;
|
protected final net.minecraft.client.gui.components.Button btn;
|
||||||
|
|
@ -33,15 +38,21 @@ public class Button extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button() {
|
public Button() {
|
||||||
btn = new net.minecraft.client.gui.components.Button(0,0, 0, 0, Component.nullToEmpty(null), a -> {});
|
btn = net.minecraft.client.gui.components.Button.builder(Component.nullToEmpty(""), a -> {})
|
||||||
|
.bounds(0, 0, 0, 0)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button(String text, int x, int y, int width) {
|
public Button(String text, int x, int y, int width) {
|
||||||
btn = new net.minecraft.client.gui.components.Button(x, y, width, 20, Component.nullToEmpty(text), a -> {});
|
btn = net.minecraft.client.gui.components.Button.builder(Component.nullToEmpty(text), a -> {})
|
||||||
|
.bounds(x, y, width, 20)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Button(String text, int x, int y) {
|
public Button(String text, int x, int y) {
|
||||||
btn = new net.minecraft.client.gui.components.Button(0, 0, x, y, Component.nullToEmpty(text), a -> {});
|
btn = net.minecraft.client.gui.components.Button.builder(Component.nullToEmpty(text), a -> {})
|
||||||
|
.bounds(0, 0, x, y)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -71,7 +82,7 @@ public class Button extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
btn.render(poseStack, mouseX, mouseY, ptt);
|
btn.render(poseStack, mouseX, mouseY, ptt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,18 +114,20 @@ public class Button extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPos(int x, int y) {
|
public void setPos(int x, int y) {
|
||||||
btn.x = x;
|
// btn.x = x;
|
||||||
btn.y = y;
|
// btn.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return btn.x;
|
// return btn.x;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return btn.y;
|
// return btn.y;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public net.minecraft.client.gui.components.Button getMcButton() {
|
public net.minecraft.client.gui.components.Button getMcButton() {
|
||||||
|
|
@ -204,8 +217,8 @@ public class Button extends Control {
|
||||||
@Override
|
@Override
|
||||||
public void load(JsonOWrapper json) {
|
public void load(JsonOWrapper json) {
|
||||||
super.load(json);
|
super.load(json);
|
||||||
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.setHeight(json.getInt("height", 20));
|
||||||
btn.setMessage(Component.nullToEmpty(tr(json.getString("label", btn.getMessage().getContents().toString()))));
|
btn.setMessage(Component.nullToEmpty(tr(json.getString("label", btn.getMessage().getContents().toString()))));
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ package net.montoyo.wd.client.gui.controls;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
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.gui.GuiGraphics;
|
||||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.sounds.SoundEvents;
|
import net.minecraft.sounds.SoundEvents;
|
||||||
|
|
@ -75,21 +76,21 @@ public class CheckBox extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(visible) {
|
// if(visible) {
|
||||||
// GlStateManager.disableAlpha();
|
//// GlStateManager.disableAlpha();
|
||||||
poseStack.pushPose();
|
// poseStack.pushPose();
|
||||||
RenderSystem.setShaderTexture(2, checked ? texChecked : texUnchecked);
|
// RenderSystem.setShaderTexture(2, checked ? texChecked : texUnchecked);
|
||||||
RenderSystem.bindTexture(2);
|
// RenderSystem.bindTexture(2);
|
||||||
RenderSystem.enableBlend();
|
// RenderSystem.enableBlend();
|
||||||
fillTexturedRect(poseStack, x, y, WIDTH, HEIGHT, 0.0, 0.0, 1.0, 1.0);
|
// fillTexturedRect(poseStack, x, y, WIDTH, HEIGHT, 0.0, 0.0, 1.0, 1.0);
|
||||||
RenderSystem.disableBlend();
|
// RenderSystem.disableBlend();
|
||||||
RenderSystem.bindTexture(-1);
|
// RenderSystem.bindTexture(-1);
|
||||||
|
//
|
||||||
poseStack.popPose();
|
// poseStack.popPose();
|
||||||
boolean inside = (!disabled && mouseX >= x && mouseX <= x + WIDTH + 2 + labelW && mouseY >= y && mouseY < y + HEIGHT);
|
// boolean inside = (!disabled && mouseX >= x && mouseX <= x + WIDTH + 2 + labelW && mouseY >= y && mouseY < y + HEIGHT);
|
||||||
font.draw(poseStack, label, x + WIDTH + 2, y + 4, inside ? 0xFF0080FF : COLOR_WHITE);
|
//// font.draw(poseStack, label, x + WIDTH + 2, y + 4, inside ? 0xFF0080FF : COLOR_WHITE);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
|
|
@ -134,9 +135,9 @@ public class CheckBox extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postDraw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void postDraw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(tooltip != null && !disabled && mouseX >= x && mouseX <= x + WIDTH + 2 + labelW && mouseY >= y && mouseY < y + HEIGHT)
|
if(tooltip != null && !disabled && mouseX >= x && mouseX <= x + WIDTH + 2 + labelW && mouseY >= y && mouseY < y + HEIGHT)
|
||||||
parent.drawTooltip(poseStack, tooltip, mouseX, mouseY);
|
parent.drawTooltip(poseStack.pose(), tooltip, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
package net.montoyo.wd.client.gui.controls;
|
package net.montoyo.wd.client.gui.controls;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.montoyo.wd.client.gui.loading.GuiLoader;
|
import net.montoyo.wd.client.gui.loading.GuiLoader;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonAWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonAWrapper;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
@ -137,13 +138,13 @@ public abstract class Container extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(visible) {
|
if(visible) {
|
||||||
mouseX -= x + paddingX;
|
mouseX -= x + paddingX;
|
||||||
mouseY -= y + paddingY;
|
mouseY -= y + paddingY;
|
||||||
|
|
||||||
poseStack.pushPose();
|
poseStack.pose().pushPose();
|
||||||
poseStack.translate(x + paddingX, y + paddingY, 0.0);
|
poseStack.pose().translate(x + paddingX, y + paddingY, 0.0);
|
||||||
|
|
||||||
if(disabled) {
|
if(disabled) {
|
||||||
for(Control ctrl : childs)
|
for(Control ctrl : childs)
|
||||||
|
|
@ -153,7 +154,7 @@ public abstract class Container extends BasicControl {
|
||||||
ctrl.draw(poseStack, mouseX, mouseY, ptt);
|
ctrl.draw(poseStack, mouseX, mouseY, ptt);
|
||||||
}
|
}
|
||||||
|
|
||||||
poseStack.popPose();
|
poseStack.pose().popPose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.*;
|
import com.mojang.blaze3d.vertex.*;
|
||||||
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.gui.GuiGraphics;
|
||||||
import net.minecraft.client.resources.language.I18n;
|
import net.minecraft.client.resources.language.I18n;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
@ -89,10 +90,10 @@ public abstract class Control {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postDraw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void postDraw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
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.opengl.GL11;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.*;
|
import static org.lwjgl.opengl.GL11.*;
|
||||||
|
|
||||||
|
|
@ -94,13 +96,14 @@ public class ControlGroup extends Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
super.draw(poseStack, mouseX, mouseY, ptt);
|
super.draw(poseStack, mouseX, mouseY, ptt);
|
||||||
|
|
||||||
if(visible) {
|
if(visible) {
|
||||||
poseStack.pushPose();
|
poseStack.pose().pushPose();
|
||||||
RenderSystem.setShaderColor(0.5f, 0.5f, 0.5f, 1.f);
|
RenderSystem.setShaderColor(0.5f, 0.5f, 0.5f, 1.f);
|
||||||
RenderSystem.disableTexture();
|
// RenderSystem.disableTexture();
|
||||||
|
GL11.glDisable(GL_TEXTURE_2D);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
|
@ -159,11 +162,12 @@ public class ControlGroup extends Container {
|
||||||
tessellator.end();
|
tessellator.end();
|
||||||
|
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.enableTexture();
|
// RenderSystem.enableTexture();
|
||||||
poseStack.popPose();
|
GL11.glEnable(GL_TEXTURE_2D);
|
||||||
|
poseStack.pose().popPose();
|
||||||
|
|
||||||
if(labelW != 0)
|
// if(labelW != 0)
|
||||||
font.drawShadow(poseStack, label, x + 10 + ((int) bp), y, labelColor, labelShadowed);
|
// font.drawShadow(poseStack, label, x + 10 + ((int) bp), y, labelColor, labelShadowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@ package net.montoyo.wd.client.gui.controls;
|
||||||
|
|
||||||
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.gui.GuiGraphics;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
import org.lwjgl.opengl.GL;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class Icon extends BasicControl {
|
public class Icon extends BasicControl {
|
||||||
|
|
@ -44,17 +46,18 @@ public class Icon extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(texture != null) {
|
if(texture != null) {
|
||||||
poseStack.pushPose();
|
poseStack.pose().pushPose();
|
||||||
RenderSystem.enableTexture();
|
// RenderSystem.enableTexture();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
RenderSystem.setShaderTexture(1, texture);
|
RenderSystem.setShaderTexture(1, texture);
|
||||||
RenderSystem.bindTexture(1);
|
RenderSystem.bindTexture(1);
|
||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
fillTexturedRect(poseStack, x, y, width, height, u1, v1, u2, v2);
|
fillTexturedRect(poseStack.pose(), x, y, width, height, u1, v1, u2, v2);
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.bindTexture(-1);
|
RenderSystem.bindTexture(-1);
|
||||||
poseStack.popPose();
|
poseStack.pose().popPose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
package net.montoyo.wd.client.gui.controls;
|
package net.montoyo.wd.client.gui.controls;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
||||||
public class Label extends BasicControl {
|
public class Label extends BasicControl {
|
||||||
|
|
@ -72,9 +73,9 @@ public class Label extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(visible)
|
// if(visible)
|
||||||
font.drawShadow(poseStack, label, x, y, color, shadowed);
|
// font.drawShadow(poseStack, label, x, y, color, shadowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -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.client.gui.GuiGraphics;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -120,7 +121,7 @@ public class List extends BasicControl {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int color = (i == selected) ? selColor : COLOR_WHITE;
|
int color = (i == selected) ? selColor : COLOR_WHITE;
|
||||||
font.draw(poseStack, content.get(i).text, 4, i * 12 + offset, color);
|
// font.draw(poseStack, content.get(i).text, 4, i * 12 + offset, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,7 +312,7 @@ public class List extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(visible) {
|
if(visible) {
|
||||||
if(update) {
|
if(update) {
|
||||||
renderToFBO();
|
renderToFBO();
|
||||||
|
|
@ -320,7 +321,7 @@ public class List extends BasicControl {
|
||||||
|
|
||||||
fbo.bindRead(); //TODO: Make sure is right
|
fbo.bindRead(); //TODO: Make sure is right
|
||||||
RenderSystem.setShaderColor(1.f, 1.f, 1.f, 1.f);
|
RenderSystem.setShaderColor(1.f, 1.f, 1.f, 1.f);
|
||||||
fillTexturedRect(poseStack, x, y, width, height, 0.0, 1.0, 1.0, 0.0);
|
// fillTexturedRect(poseStack, x, y, width, height, 0.0, 1.0, 1.0, 0.0);
|
||||||
fbo.unbindRead();
|
fbo.unbindRead();
|
||||||
|
|
||||||
fillRect(x + width - 5, y + 1 + scrollPos, 4, scrollSize, (scrolling || isInScrollbar(mouseX, mouseY)) ? 0xFF202020 : 0xFF404040);
|
fillRect(x + width - 5, y + 1 + scrollPos, 4, scrollSize, (scrolling || isInScrollbar(mouseX, mouseY)) ? 0xFF202020 : 0xFF404040);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
package net.montoyo.wd.client.gui.controls;
|
package net.montoyo.wd.client.gui.controls;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.minecraft.client.gui.components.EditBox;
|
import net.minecraft.client.gui.components.EditBox;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
@ -190,7 +191,7 @@ public class TextField extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
field.render(poseStack, mouseX, mouseY, ptt);
|
field.render(poseStack, mouseX, mouseY, ptt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -241,23 +242,25 @@ public class TextField extends Control {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPos(int x, int y) {
|
public void setPos(int x, int y) {
|
||||||
field.x = x + 1;
|
// field.x = x + 1;
|
||||||
field.y = y + 1;
|
// field.y = y + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getX() {
|
public int getX() {
|
||||||
return field.x - 1;
|
// return field.x - 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return field.y - 1;
|
// return field.y - 1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisabled(boolean en) {
|
public void setDisabled(boolean en) {
|
||||||
enabled = !en;
|
enabled = !en;
|
||||||
field.setFocus(enabled);
|
// field.setFocus(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDisabled() {
|
public boolean isDisabled() {
|
||||||
|
|
@ -265,12 +268,12 @@ public class TextField extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enable() {
|
public void enable() {
|
||||||
field.setFocus(true);
|
// field.setFocus(true);
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
field.setFocus(false);
|
// field.setFocus(false);
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,7 +294,7 @@ public class TextField extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFocused(boolean val) {
|
public void setFocused(boolean val) {
|
||||||
field.setFocus(val);
|
// field.setFocus(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasFocus() {
|
public boolean hasFocus() {
|
||||||
|
|
@ -299,7 +302,7 @@ public class TextField extends Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void focus() {
|
public void focus() {
|
||||||
field.setFocus(true);
|
// field.setFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextColor(int color) {
|
public void setTextColor(int color) {
|
||||||
|
|
@ -336,8 +339,8 @@ public class TextField extends Control {
|
||||||
@Override
|
@Override
|
||||||
public void load(JsonOWrapper json) {
|
public void load(JsonOWrapper json) {
|
||||||
super.load(json);
|
super.load(json);
|
||||||
field.x = json.getInt("x", 0) + 1;
|
// field.x = json.getInt("x", 0) + 1;
|
||||||
field.y = json.getInt("y", 0) + 1;
|
// field.y = json.getInt("y", 0) + 1;
|
||||||
field.setWidth(json.getInt("width", 200) - 2);
|
field.setWidth(json.getInt("width", 200) - 2);
|
||||||
field.setHeight(json.getInt("height", 22) - 2);
|
field.setHeight(json.getInt("height", 22) - 2);
|
||||||
field.setValue(tr(json.getString("text", "")));
|
field.setValue(tr(json.getString("text", "")));
|
||||||
|
|
@ -350,7 +353,7 @@ public class TextField extends Control {
|
||||||
|
|
||||||
field.setTextColor(textColor);
|
field.setTextColor(textColor);
|
||||||
field.setTextColorUneditable(disabledColor);
|
field.setTextColorUneditable(disabledColor);
|
||||||
field.setFocus(enabled);
|
// field.setFocus(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ package net.montoyo.wd.client.gui.controls;
|
||||||
|
|
||||||
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.client.gui.GuiGraphics;
|
||||||
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.montoyo.wd.client.gui.loading.JsonOWrapper;
|
import net.montoyo.wd.client.gui.loading.JsonOWrapper;
|
||||||
|
|
@ -26,7 +27,7 @@ public class UpgradeGroup extends BasicControl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void draw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(upgrades != null) {
|
if(upgrades != null) {
|
||||||
int x = this.x;
|
int x = this.x;
|
||||||
|
|
||||||
|
|
@ -34,17 +35,17 @@ public class UpgradeGroup extends BasicControl {
|
||||||
if(is == overStack && !disabled)
|
if(is == overStack && !disabled)
|
||||||
fillRect(x, y, 16, 16, 0x80FF0000);
|
fillRect(x, y, 16, 16, 0x80FF0000);
|
||||||
|
|
||||||
renderItem.renderAndDecorateItem(mc.player, is, x, y, 0);
|
// renderItem.renderAndDecorateItem(mc.player, is, x, y, 0);
|
||||||
renderItem.renderAndDecorateItem(is, font.lineHeight, x, y); //TODO is lineHeight right?
|
// renderItem.renderAndDecorateItem(is, font.lineHeight, x, y); //TODO is lineHeight right?
|
||||||
x += 18;
|
x += 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postDraw(PoseStack poseStack, int mouseX, int mouseY, float ptt) {
|
public void postDraw(GuiGraphics poseStack, int mouseX, int mouseY, float ptt) {
|
||||||
if(overStack != null)
|
if(overStack != null)
|
||||||
parent.drawItemStackTooltip(poseStack, overStack, mouseX, mouseY);
|
parent.drawItemStackTooltip(poseStack.pose(), overStack, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -41,14 +41,25 @@ public class ScreenModelLoader implements IGeometryLoader<ScreenModelLoader.Scre
|
||||||
public static class ScreenModelGeometry implements IUnbakedGeometry<ScreenModelGeometry> {
|
public static class ScreenModelGeometry implements IUnbakedGeometry<ScreenModelGeometry> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BakedModel bake(IGeometryBakingContext iGeometryBakingContext, ModelBakery arg, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ItemOverrides itemOverrides, ResourceLocation arg4) {
|
public BakedModel bake(IGeometryBakingContext context, ModelBaker baker, Function<Material, TextureAtlasSprite> spriteGetter, ModelState modelState, ItemOverrides overrides, ResourceLocation modelLocation) {
|
||||||
return new ScreenBaker(modelState, spriteGetter, itemOverrides, iGeometryBakingContext.getTransforms());
|
return new ScreenBaker(modelState, spriteGetter, overrides, context.getTransforms());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public Collection<Material> getMaterials(IGeometryBakingContext iGeometryBakingContext, Function<ResourceLocation, UnbakedModel> function, Set<Pair<String, String>> set) {
|
// public void resolveParents(Function<ResourceLocation, UnbakedModel> modelGetter, IGeometryBakingContext context) {
|
||||||
return Arrays.asList(MATERIALS_SIDES);
|
// IUnbakedGeometry.super.resolveParents(modelGetter, context);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public Set<String> getConfigurableComponentNames() {
|
||||||
|
// return IUnbakedGeometry.super.getConfigurableComponentNames();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// TODO: ?
|
||||||
|
// @Override
|
||||||
|
// public Collection<Material> getMaterials(IGeometryBakingContext iGeometryBakingContext, Function<ResourceLocation, UnbakedModel> function, Set<Pair<String, String>> set) {
|
||||||
|
// return Arrays.asList(MATERIALS_SIDES);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ public class JSRequestControl extends ScreenControl {
|
||||||
@Override
|
@Override
|
||||||
public void handleServer(BlockPos pos, BlockSide side, TileEntityScreen tes, NetworkEvent.Context ctx, Function<Integer, Boolean> permissionChecker) throws MissingPermissionException {
|
public void handleServer(BlockPos pos, BlockSide side, TileEntityScreen tes, NetworkEvent.Context ctx, Function<Integer, Boolean> permissionChecker) throws MissingPermissionException {
|
||||||
ServerPlayer player = ctx.getSender();
|
ServerPlayer player = ctx.getSender();
|
||||||
if (reqType == null || data == null) Log.warning("Caught invalid JS request from player %s (UUID %s)", player.getName(), player.getGameProfile().getId().toString());
|
// if (reqType == null || data == null) Log.warning("Caught invalid JS request from player %s (UUID %s)", player.getName(), player.getGameProfile().getId().toString());
|
||||||
else tes.handleJSRequest(player, side, reqId, reqType, data);
|
// else tes.handleJSRequest(player, side, reqId, reqType, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
/*
|
///*
|
||||||
* Copyright (C) 2018 BARBOTIN Nicolas
|
// * Copyright (C) 2018 BARBOTIN Nicolas
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
package net.montoyo.wd.core;
|
//package net.montoyo.wd.core;
|
||||||
|
//
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
//import net.minecraft.world.item.CreativeModeTab;
|
||||||
import net.minecraft.world.item.ItemStack;
|
//import net.minecraft.world.item.ItemStack;
|
||||||
import net.montoyo.wd.init.BlockInit;
|
//import net.montoyo.wd.init.BlockInit;
|
||||||
|
//
|
||||||
public class WDCreativeTab extends CreativeModeTab {
|
//public class WDCreativeTab extends CreativeModeTab {
|
||||||
|
//
|
||||||
public WDCreativeTab() {
|
// public WDCreativeTab() {
|
||||||
super("webdisplays");
|
// super("webdisplays");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public ItemStack makeIcon() {
|
// public ItemStack makeIcon() {
|
||||||
return new ItemStack(BlockInit.blockScreen.get());
|
// return new ItemStack(BlockInit.blockScreen.get());
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@ 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.evalJS(screenSide, code);
|
// scr.evalJS(screenSide, code);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,12 @@ public class ItemInit{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final RegistryObject<Item> SCREEN = ITEMS.register("screen", () -> new BlockItem(BlockInit.blockScreen.get(), new Item.Properties().tab(WebDisplays.CREATIVE_TAB)));
|
public static final RegistryObject<Item> SCREEN = ITEMS.register("screen", () -> new BlockItem(BlockInit.blockScreen.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||||
|
|
||||||
public static final RegistryObject<Item> KEYBOARD = ITEMS.register("keyboard", () -> new KeyboardItem(BlockInit.blockKeyBoard.get(), new Item.Properties().tab(WebDisplays.CREATIVE_TAB)));
|
public static final RegistryObject<Item> KEYBOARD = ITEMS.register("keyboard", () -> new KeyboardItem(BlockInit.blockKeyBoard.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||||
public static final RegistryObject<Item> REDSTONE_CONTROLLER = ITEMS.register("redctrl", () -> new BlockItem(BlockInit.blockRedControl.get(), new Item.Properties().tab(WebDisplays.CREATIVE_TAB)));
|
public static final RegistryObject<Item> REDSTONE_CONTROLLER = ITEMS.register("redctrl", () -> new BlockItem(BlockInit.blockRedControl.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||||
public static final RegistryObject<Item> REMOTE_CONTROLLER = ITEMS.register("rctrl", () -> new BlockItem(BlockInit.blockRControl.get(), new Item.Properties().tab(WebDisplays.CREATIVE_TAB)));
|
public static final RegistryObject<Item> REMOTE_CONTROLLER = ITEMS.register("rctrl", () -> new BlockItem(BlockInit.blockRControl.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||||
public static final RegistryObject<Item> SERVER = ITEMS.register("server", () -> new BlockItem(BlockInit.blockServer.get(), new Item.Properties().tab(WebDisplays.CREATIVE_TAB)));
|
public static final RegistryObject<Item> SERVER = ITEMS.register("server", () -> new BlockItem(BlockInit.blockServer.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||||
|
|
||||||
public static RegistryObject<Item> getComputerCraftItem(int index) {
|
public static RegistryObject<Item> getComputerCraftItem(int index) {
|
||||||
return COMP_CRAFT_ITEMS[index];
|
return COMP_CRAFT_ITEMS[index];
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ public class ItemCraftComponent extends ItemMulti implements WDItem {
|
||||||
|
|
||||||
public ItemCraftComponent(Properties properties) {
|
public ItemCraftComponent(Properties properties) {
|
||||||
super(CraftComponent.class, properties
|
super(CraftComponent.class, properties
|
||||||
//setRegistryName("craftcomp");
|
// .tab(WebDisplays.CREATIVE_TAB)
|
||||||
.tab(WebDisplays.CREATIVE_TAB));
|
);
|
||||||
|
|
||||||
//Hide the bad extension card from the creative tab
|
//Hide the bad extension card from the creative tab
|
||||||
creativeTabItems.clear(CraftComponent.BADEXTCARD.ordinal());
|
creativeTabItems.clear(CraftComponent.BADEXTCARD.ordinal());
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ public class ItemLaserPointer extends Item implements WDItem {
|
||||||
|
|
||||||
public ItemLaserPointer(Properties properties) {
|
public ItemLaserPointer(Properties properties) {
|
||||||
super(properties
|
super(properties
|
||||||
//setRegistryName("laserpointer")
|
|
||||||
.stacksTo(1)
|
.stacksTo(1)
|
||||||
.tab(WebDisplays.CREATIVE_TAB));
|
// .tab(WebDisplays.CREATIVE_TAB)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Laser pointer
|
//Laser pointer
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ public class ItemLinker extends Item implements WDItem {
|
||||||
|
|
||||||
public ItemLinker(Properties properties) {
|
public ItemLinker(Properties properties) {
|
||||||
super(properties
|
super(properties
|
||||||
//setRegistryName("linker");
|
|
||||||
.stacksTo(1)
|
.stacksTo(1)
|
||||||
.tab(WebDisplays.CREATIVE_TAB));
|
// .tab(WebDisplays.CREATIVE_TAB)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,10 @@ public class ItemMinePad2 extends Item implements WDItem {
|
||||||
|
|
||||||
public ItemMinePad2(Properties properties) {
|
public ItemMinePad2(Properties properties) {
|
||||||
super(properties
|
super(properties
|
||||||
//setRegistryName("minepad");
|
|
||||||
.stacksTo(1)
|
.stacksTo(1)
|
||||||
//TODO what is Full3D();
|
|
||||||
.defaultDurability(0)
|
.defaultDurability(0)
|
||||||
.tab(WebDisplays.CREATIVE_TAB));
|
// .tab(WebDisplays.CREATIVE_TAB)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getURL(ItemStack is) {
|
private static String getURL(ItemStack is) {
|
||||||
|
|
@ -76,7 +75,7 @@ public class ItemMinePad2 extends Item implements WDItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity ent) {
|
public boolean onEntityItemUpdate(ItemStack stack, ItemEntity ent) {
|
||||||
if (ent.isOnGround() && !ent.getLevel().isClientSide) {
|
if (ent.onGround() && !ent.level().isClientSide) {
|
||||||
CompoundTag tag = ent.getItem().getTag();
|
CompoundTag tag = ent.getItem().getTag();
|
||||||
|
|
||||||
if (tag != null && tag.contains("ThrowHeight")) {
|
if (tag != null && tag.contains("ThrowHeight")) {
|
||||||
|
|
@ -95,11 +94,11 @@ public class ItemMinePad2 extends Item implements WDItem {
|
||||||
ent.getItem().setTag(null);
|
ent.getItem().setTag(null);
|
||||||
|
|
||||||
if (thrower != null && height - ent.getBlockY() >= 20.0) {
|
if (thrower != null && height - ent.getBlockY() >= 20.0) {
|
||||||
ent.getLevel().playSound(null, ent.getBlockX(), ent.getBlockY(), ent.getBlockZ(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS, 4.0f, 1.0f);
|
ent.level().playSound(null, ent.getBlockX(), ent.getBlockY(), ent.getBlockZ(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS, 4.0f, 1.0f);
|
||||||
ent.getLevel().addFreshEntity(new ItemEntity(ent.getLevel(), ent.getBlockX(), ent.getBlockY(), ent.getBlockZ(), CraftComponent.EXTCARD.makeItemStack()));
|
ent.level().addFreshEntity(new ItemEntity(ent.level(), ent.getBlockX(), ent.getBlockY(), ent.getBlockZ(), CraftComponent.EXTCARD.makeItemStack()));
|
||||||
ent.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
|
ent.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
|
||||||
|
|
||||||
Player ply = ent.getLevel().getPlayerByUUID(thrower);
|
Player ply = ent.level().getPlayerByUUID(thrower);
|
||||||
if (ply != null && ply instanceof ServerPlayer)
|
if (ply != null && ply instanceof ServerPlayer)
|
||||||
WebDisplays.INSTANCE.criterionPadBreak.trigger(((ServerPlayer) ply).getAdvancements());
|
WebDisplays.INSTANCE.criterionPadBreak.trigger(((ServerPlayer) ply).getAdvancements());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@ public class ItemOwnershipThief extends Item implements WDItem {
|
||||||
|
|
||||||
public ItemOwnershipThief(Properties properties) {
|
public ItemOwnershipThief(Properties properties) {
|
||||||
super(properties
|
super(properties
|
||||||
//setRegistryName("ownerthief");
|
|
||||||
.stacksTo(1)
|
.stacksTo(1)
|
||||||
.tab(WebDisplays.CREATIVE_TAB));
|
// .tab(WebDisplays.CREATIVE_TAB)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ public class ItemScreenConfigurator extends Item implements WDItem {
|
||||||
|
|
||||||
public ItemScreenConfigurator(Properties properties) {
|
public ItemScreenConfigurator(Properties properties) {
|
||||||
super(properties
|
super(properties
|
||||||
//setRegistryName("screencfg");
|
|
||||||
.stacksTo(1)
|
.stacksTo(1)
|
||||||
.tab(WebDisplays.CREATIVE_TAB));
|
// .tab(WebDisplays.CREATIVE_TAB)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class ItemUpgrade extends ItemMulti implements IUpgrade, WDItem {
|
||||||
public final DefaultUpgrade type;
|
public final DefaultUpgrade type;
|
||||||
|
|
||||||
public ItemUpgrade(DefaultUpgrade type) {
|
public ItemUpgrade(DefaultUpgrade type) {
|
||||||
super(DefaultUpgrade.class, new Properties().tab(WebDisplays.CREATIVE_TAB));
|
super(DefaultUpgrade.class, new Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package net.montoyo.wd.mixins;
|
||||||
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.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
import net.montoyo.wd.client.ClientProxy;
|
import net.montoyo.wd.client.ClientProxy;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
|
@ -24,7 +25,8 @@ public class OverlayMixin {
|
||||||
protected int screenHeight;
|
protected int screenHeight;
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "renderCrosshair", cancellable = true)
|
@Inject(at = @At("HEAD"), method = "renderCrosshair", cancellable = true)
|
||||||
public void preDrawCrosshair(PoseStack poseStack, CallbackInfo ci) {
|
public void preDrawCrosshair(GuiGraphics pGuiGraphics, CallbackInfo ci) {
|
||||||
ClientProxy.renderCrosshair(minecraft.options, screenWidth, screenHeight, ((Gui) (Object) this).getBlitOffset(), poseStack, ci);
|
// ClientProxy.renderCrosshair(minecraft.options, screenWidth, screenHeight, ((Gui) (Object) this).getBlitOffset(), poseStack, ci);
|
||||||
|
ClientProxy.renderCrosshair(minecraft.options, screenWidth, screenHeight, 0, pGuiGraphics, ci);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,9 @@ public class C2SMessageRedstoneCtrl extends Packet implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Level world = player.level;
|
Level world = player.level();
|
||||||
BlockPos blockPos = pos.toBlock();
|
BlockPos blockPos = pos.toBlock();
|
||||||
final double maxRange = player.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue();
|
final double maxRange = player.getAttribute(ForgeMod.BLOCK_REACH.get()).getValue();
|
||||||
|
|
||||||
if (player.distanceToSqr(blockPos.getX(), blockPos.getY(), blockPos.getZ()) > maxRange * maxRange)
|
if (player.distanceToSqr(blockPos.getX(), blockPos.getY(), blockPos.getZ()) > maxRange * maxRange)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user