cursors
This commit is contained in:
parent
e1ae67c7a2
commit
de2bc44a8e
|
|
@ -21,7 +21,7 @@ minecraft {
|
||||||
properties 'mixin.env.remapRefMap': 'true'
|
properties 'mixin.env.remapRefMap': 'true'
|
||||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
arg "-mixin.config=forgecef.mixins.json"
|
arg "-mixin.config=webdisplays.mixins.json"
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
mods {
|
mods {
|
||||||
|
|
@ -35,7 +35,7 @@ minecraft {
|
||||||
properties 'mixin.env.remapRefMap': 'true'
|
properties 'mixin.env.remapRefMap': 'true'
|
||||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||||
workingDirectory project.file('run')
|
workingDirectory project.file('run')
|
||||||
arg "-mixin.config=forgecef.mixins.json"
|
arg "-mixin.config=webdisplays.mixins.json"
|
||||||
|
|
||||||
|
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
|
|
@ -52,7 +52,7 @@ minecraft {
|
||||||
properties 'mixin.env.remapRefMap': 'true'
|
properties 'mixin.env.remapRefMap': 'true'
|
||||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||||
property 'forge.logging.console.level', 'debug'
|
property 'forge.logging.console.level', 'debug'
|
||||||
args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0]
|
args '--mod', 'webdisplays', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0]
|
||||||
mods {
|
mods {
|
||||||
webdisplays {
|
webdisplays {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
|
|
@ -98,7 +98,7 @@ jar {
|
||||||
"Implementation-Version": "${version}",
|
"Implementation-Version": "${version}",
|
||||||
"Implementation-Vendor" :"webdisplays",
|
"Implementation-Vendor" :"webdisplays",
|
||||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||||
"MixinConfigs": "forgecef.mixins.json"
|
"MixinConfigs": "webdisplays.mixins.json"
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
cursors.piskel
Normal file
1
cursors.piskel
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -51,6 +51,7 @@ import net.montoyo.wd.net.client_bound.S2CMessageServerInfo;
|
||||||
import net.montoyo.wd.utilities.DistSafety;
|
import net.montoyo.wd.utilities.DistSafety;
|
||||||
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 org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
|
@ -64,7 +65,14 @@ public class WebDisplays {
|
||||||
public static WebDisplays INSTANCE;
|
public static WebDisplays INSTANCE;
|
||||||
|
|
||||||
public static SharedProxy PROXY = null;
|
public static SharedProxy PROXY = null;
|
||||||
|
|
||||||
|
public static final boolean cursorSupport;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ArtifactVersion ver = ModList.get().getModFileById("forgecef").getMods().get(0).getVersion();
|
||||||
|
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";
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,15 @@
|
||||||
package net.montoyo.wd.client;
|
package net.montoyo.wd.client;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import net.minecraft.advancements.Advancement;
|
import net.minecraft.advancements.Advancement;
|
||||||
import net.minecraft.advancements.AdvancementProgress;
|
import net.minecraft.advancements.AdvancementProgress;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.Options;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
|
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
|
||||||
import net.minecraft.client.multiplayer.ClientAdvancements;
|
import net.minecraft.client.multiplayer.ClientAdvancements;
|
||||||
|
|
@ -67,6 +72,8 @@ import net.montoyo.wd.entity.TileEntityScreen;
|
||||||
import net.montoyo.wd.init.BlockInit;
|
import net.montoyo.wd.init.BlockInit;
|
||||||
import net.montoyo.wd.init.ItemInit;
|
import net.montoyo.wd.init.ItemInit;
|
||||||
import net.montoyo.wd.init.TileInit;
|
import net.montoyo.wd.init.TileInit;
|
||||||
|
import net.montoyo.wd.item.ItemLaserPointer;
|
||||||
|
import net.montoyo.wd.item.ItemMinePad2;
|
||||||
import net.montoyo.wd.item.WDItem;
|
import net.montoyo.wd.item.WDItem;
|
||||||
import net.montoyo.wd.miniserv.client.Client;
|
import net.montoyo.wd.miniserv.client.Client;
|
||||||
import net.montoyo.wd.net.WDNetworkRegistry;
|
import net.montoyo.wd.net.WDNetworkRegistry;
|
||||||
|
|
@ -75,6 +82,7 @@ import net.montoyo.wd.net.server_bound.C2SMessageScreenCtrl;
|
||||||
import net.montoyo.wd.net.server_bound.C2SMinepadUrl;
|
import net.montoyo.wd.net.server_bound.C2SMinepadUrl;
|
||||||
import net.montoyo.wd.utilities.*;
|
import net.montoyo.wd.utilities.*;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -87,6 +95,93 @@ import java.util.stream.Stream;
|
||||||
@Mod.EventBusSubscriber(modid = "webdisplays", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = "webdisplays", value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQueryHandler, ResourceManagerReloadListener {
|
public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQueryHandler, ResourceManagerReloadListener {
|
||||||
|
|
||||||
|
private static ClientProxy INSTANCE;
|
||||||
|
|
||||||
|
public ClientProxy() {
|
||||||
|
INSTANCE = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void blit(PoseStack p_93229_, int p_93230_, int p_93231_, int p_93232_, int p_93233_, int p_93234_, int p_93235_, int offset) {
|
||||||
|
Gui.blit(p_93229_, p_93230_, p_93231_, offset, (float)p_93232_, (float)p_93233_, p_93234_, p_93235_, 256, 256);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void renderCrosshair(Options options, int screenWidth, int screenHeight, int offset, PoseStack poseStack, CallbackInfo ci) {
|
||||||
|
ItemStack stack = Minecraft.getInstance().player.getItemInHand(InteractionHand.MAIN_HAND);
|
||||||
|
ItemStack stack1 = Minecraft.getInstance().player.getItemInHand(InteractionHand.OFF_HAND);
|
||||||
|
|
||||||
|
if (stack.getItem() instanceof ItemMinePad2) {
|
||||||
|
float sign = 1;
|
||||||
|
if (Minecraft.getInstance().player.getMainArm() == HumanoidArm.LEFT) sign = -1;
|
||||||
|
if (!MinePadRenderer.renderAtSide(sign)) {
|
||||||
|
ci.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (stack1.getItem() instanceof ItemMinePad2) {
|
||||||
|
float sign = -1;
|
||||||
|
if (Minecraft.getInstance().player.getMainArm() == HumanoidArm.LEFT) sign = 1;
|
||||||
|
if (!MinePadRenderer.renderAtSide(sign)) {
|
||||||
|
ci.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(stack.getItem() instanceof ItemLaserPointer ||
|
||||||
|
stack1.getItem() instanceof ItemLaserPointer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!INSTANCE.laserPointerRenderer.isOn) {
|
||||||
|
RenderSystem.setShaderTexture(0, new ResourceLocation(
|
||||||
|
"webdisplays:textures/gui/cursors.png"
|
||||||
|
));
|
||||||
|
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
|
|
||||||
|
blit(poseStack, (screenWidth - 15) / 2, (screenHeight - 15) / 2, 240, 240, 15, 15, offset);
|
||||||
|
ci.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
||||||
|
if (
|
||||||
|
mc.player != null && mc.level != null && ItemInit.itemLaserPointer.isPresent() && mc.player.getItemInHand(InteractionHand.MAIN_HAND).getItem().equals(ItemInit.itemLaserPointer.get()) &&
|
||||||
|
mc.options.keyUse.isDown() &&
|
||||||
|
(mc.hitResult == null || mc.hitResult.getType() == HitResult.Type.BLOCK || mc.hitResult.getType() == HitResult.Type.MISS)
|
||||||
|
) {
|
||||||
|
BlockHitResult result = raycast(64.0); //TODO: Make that distance configurable
|
||||||
|
|
||||||
|
BlockPos bpos = result.getBlockPos();
|
||||||
|
|
||||||
|
if (result.getType() != HitResult.Type.BLOCK || mc.level.getBlockState(bpos).getBlock() != BlockInit.blockScreen.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector3i pos = new Vector3i(result.getBlockPos());
|
||||||
|
BlockSide side = BlockSide.values()[result.getDirection().ordinal()];
|
||||||
|
|
||||||
|
Multiblock.findOrigin(mc.level, pos, side, null);
|
||||||
|
TileEntityScreen te = (TileEntityScreen) mc.level.getBlockEntity(pos.toBlock());
|
||||||
|
|
||||||
|
TileEntityScreen.Screen sc = te.getScreen(side);
|
||||||
|
|
||||||
|
if (sc == null) return;
|
||||||
|
// if (sc.mouseType == 1) return;
|
||||||
|
|
||||||
|
int coordX = sc.mouseType * 15;
|
||||||
|
int coordY = coordX / 256;
|
||||||
|
coordX -= coordY * 256;
|
||||||
|
|
||||||
|
RenderSystem.setShaderTexture(0, new ResourceLocation(
|
||||||
|
"webdisplays:textures/gui/cursors.png"
|
||||||
|
));
|
||||||
|
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE_MINUS_DST_COLOR, GlStateManager.DestFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
|
|
||||||
|
blit(poseStack, (screenWidth - 15) / 2, (screenHeight - 15) / 2, coordX, coordY, 15, 15, offset);
|
||||||
|
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class PadData {
|
public class PadData {
|
||||||
|
|
||||||
public IBrowser view;
|
public IBrowser view;
|
||||||
|
|
@ -632,12 +727,13 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
||||||
if(mc.player != null && mc.level != null && ItemInit.itemLaserPointer.isPresent() && mc.player.getItemInHand(InteractionHand.MAIN_HAND).getItem().equals(ItemInit.itemLaserPointer.get())
|
if(mc.player != null && mc.level != null && ItemInit.itemLaserPointer.isPresent() && mc.player.getItemInHand(InteractionHand.MAIN_HAND).getItem().equals(ItemInit.itemLaserPointer.get())
|
||||||
&& mc.options.keyUse.isDown()
|
&& mc.options.keyUse.isDown()
|
||||||
&& (mc.hitResult == null || mc.hitResult.getType() == HitResult.Type.BLOCK || mc.hitResult.getType() == HitResult.Type.MISS)) {
|
&& (mc.hitResult == null || mc.hitResult.getType() == HitResult.Type.BLOCK || mc.hitResult.getType() == HitResult.Type.MISS)) {
|
||||||
laserPointerRenderer.isOn = true;
|
|
||||||
BlockHitResult result = raycast(64.0); //TODO: Make that distance configurable
|
BlockHitResult result = raycast(64.0); //TODO: Make that distance configurable
|
||||||
|
|
||||||
BlockPos bpos = result.getBlockPos();
|
BlockPos bpos = result.getBlockPos();
|
||||||
|
|
||||||
if(result.getType() == HitResult.Type.BLOCK && mc.level.getBlockState(bpos).getBlock() == BlockInit.blockScreen.get()) {
|
if(result.getType() == HitResult.Type.BLOCK && mc.level.getBlockState(bpos).getBlock() == BlockInit.blockScreen.get()) {
|
||||||
|
laserPointerRenderer.isOn = true;
|
||||||
|
|
||||||
Vector3i pos = new Vector3i(result.getBlockPos());
|
Vector3i pos = new Vector3i(result.getBlockPos());
|
||||||
BlockSide side = BlockSide.values()[result.getDirection().ordinal()];
|
BlockSide side = BlockSide.values()[result.getDirection().ordinal()];
|
||||||
|
|
||||||
|
|
@ -712,6 +808,7 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
||||||
/**************************************** OTHER METHODS ****************************************/
|
/**************************************** OTHER METHODS ****************************************/
|
||||||
|
|
||||||
private void laserClick(TileEntityScreen tes, BlockSide side, TileEntityScreen.Screen scr, Vector2i hit) {
|
private void laserClick(TileEntityScreen tes, BlockSide side, TileEntityScreen.Screen scr, Vector2i hit) {
|
||||||
|
tes.handleMouseEvent(side, S2CMessageScreenUpdate.MOUSE_MOVE, hit);
|
||||||
if(pointedScreen == tes && pointedScreenSide == side) {
|
if(pointedScreen == tes && pointedScreenSide == side) {
|
||||||
long t = System.currentTimeMillis();
|
long t = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
@ -721,7 +818,6 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
||||||
tes.handleMouseEvent(side, S2CMessageScreenUpdate.MOUSE_CLICK, hit);
|
tes.handleMouseEvent(side, S2CMessageScreenUpdate.MOUSE_CLICK, hit);
|
||||||
WDNetworkRegistry.INSTANCE.sendToServer(C2SMessageScreenCtrl.laserDown(tes, side, hit));
|
WDNetworkRegistry.INSTANCE.sendToServer(C2SMessageScreenCtrl.laserDown(tes, side, hit));
|
||||||
} else {
|
} else {
|
||||||
tes.handleMouseEvent(side, S2CMessageScreenUpdate.MOUSE_MOVE, hit);
|
|
||||||
WDNetworkRegistry.INSTANCE.sendToServer(C2SMessageScreenCtrl.laserMove(tes, side, hit));
|
WDNetworkRegistry.INSTANCE.sendToServer(C2SMessageScreenCtrl.laserMove(tes, side, hit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -741,7 +837,9 @@ public class ClientProxy extends SharedProxy implements IDisplayHandler, IJSQuer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockHitResult raycast(double dist) {
|
private static BlockHitResult raycast(double dist) {
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
|
||||||
Vec3 start = mc.player.getEyePosition(1.0f);
|
Vec3 start = mc.player.getEyePosition(1.0f);
|
||||||
Vec3 lookVec = mc.player.getLookAngle();
|
Vec3 lookVec = mc.player.getLookAngle();
|
||||||
Vec3 end = start.add(lookVec.x * dist, lookVec.y * dist, lookVec.z * dist);
|
Vec3 end = start.add(lookVec.x * dist, lookVec.y * dist, lookVec.z * dist);
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,8 @@ public class GuiMinePad extends WDScreen {
|
||||||
this();
|
this();
|
||||||
this.pad = pad;
|
this.pad = pad;
|
||||||
|
|
||||||
if (pad.view instanceof CefBrowserOsr osr) {
|
if (WebDisplays.cursorSupport)
|
||||||
osr.allowCursorChanges(true);
|
pad.view.allowCursorChanges(true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -230,9 +229,10 @@ public class GuiMinePad extends WDScreen {
|
||||||
@Override
|
@Override
|
||||||
public void onClose() {
|
public void onClose() {
|
||||||
super.onClose();
|
super.onClose();
|
||||||
if (pad.view instanceof CefBrowserOsr osr) {
|
if (WebDisplays.cursorSupport) {
|
||||||
osr.allowCursorChanges(true);
|
pad.view.allowCursorChanges(false);
|
||||||
osr.onCursorChange(null, 0);
|
if (pad.view instanceof CefBrowserOsr osr)
|
||||||
|
osr.onCursorChange(null, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,7 @@ public final class MinePadRenderer implements IItemRenderer {
|
||||||
private float sinSwingProg1;
|
private float sinSwingProg1;
|
||||||
private float sinSwingProg2;
|
private float sinSwingProg2;
|
||||||
|
|
||||||
@Override
|
public static boolean renderAtSide(float handSideSign) {
|
||||||
public final boolean render(PoseStack stack, ItemStack is, float handSideSign, float swingProgress, float equipProgress, MultiBufferSource multiBufferSource, int packedLight) {
|
|
||||||
//Pre-compute values
|
|
||||||
float sqrtSwingProg = (float) Math.sqrt(swingProgress);
|
|
||||||
sinSqrtSwingProg1 = (float) Math.sin(sqrtSwingProg * PI);
|
|
||||||
sinSqrtSwingProg2 = (float) Math.sin(sqrtSwingProg * PI * 2.0f);
|
|
||||||
sinSwingProg1 = (float) Math.sin(swingProgress * PI);
|
|
||||||
sinSwingProg2 = (float) Math.sin(swingProgress * swingProgress * PI);
|
|
||||||
|
|
||||||
float relSide = handSideSign;
|
float relSide = handSideSign;
|
||||||
if (Minecraft.getInstance().player.getMainArm() == HumanoidArm.LEFT) relSide *= -1;
|
if (Minecraft.getInstance().player.getMainArm() == HumanoidArm.LEFT) relSide *= -1;
|
||||||
|
|
||||||
|
|
@ -55,6 +47,20 @@ public final class MinePadRenderer implements IItemRenderer {
|
||||||
(relSide > 0 && Minecraft.getInstance().player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ItemMinePad2)
|
(relSide > 0 && Minecraft.getInstance().player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ItemMinePad2)
|
||||||
) sideHold = true;
|
) sideHold = true;
|
||||||
|
|
||||||
|
return sideHold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final boolean render(PoseStack stack, ItemStack is, float handSideSign, float swingProgress, float equipProgress, MultiBufferSource multiBufferSource, int packedLight) {
|
||||||
|
//Pre-compute values
|
||||||
|
float sqrtSwingProg = (float) Math.sqrt(swingProgress);
|
||||||
|
sinSqrtSwingProg1 = (float) Math.sin(sqrtSwingProg * PI);
|
||||||
|
sinSqrtSwingProg2 = (float) Math.sin(sqrtSwingProg * PI * 2.0f);
|
||||||
|
sinSwingProg1 = (float) Math.sin(swingProgress * PI);
|
||||||
|
sinSwingProg2 = (float) Math.sin(swingProgress * swingProgress * PI);
|
||||||
|
|
||||||
|
boolean sideHold = renderAtSide(handSideSign);
|
||||||
|
|
||||||
//Render arm
|
//Render arm
|
||||||
stack.pushPose();
|
stack.pushPose();
|
||||||
renderArmFirstPerson(stack, multiBufferSource, packedLight, equipProgress, handSideSign);
|
renderArmFirstPerson(stack, multiBufferSource, packedLight, equipProgress, handSideSign);
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ public class TileEntityScreen extends BlockEntity {
|
||||||
public NibbleArray redstoneStatus; //null on client
|
public NibbleArray redstoneStatus; //null on client
|
||||||
public boolean autoVolume = true;
|
public boolean autoVolume = true;
|
||||||
|
|
||||||
|
public int mouseType;
|
||||||
|
|
||||||
public static Screen deserialize(CompoundTag tag) {
|
public static Screen deserialize(CompoundTag tag) {
|
||||||
Screen ret = new Screen();
|
Screen ret = new Screen();
|
||||||
ret.side = BlockSide.values()[tag.getByte("Side")];
|
ret.side = BlockSide.values()[tag.getByte("Side")];
|
||||||
|
|
@ -228,7 +230,10 @@ public class TileEntityScreen extends BlockEntity {
|
||||||
browser.resize(resolution.y, resolution.x);
|
browser.resize(resolution.y, resolution.x);
|
||||||
else
|
else
|
||||||
browser.resize(resolution.x, resolution.y);
|
browser.resize(resolution.x, resolution.y);
|
||||||
|
|
||||||
|
if (WebDisplays.cursorSupport)
|
||||||
|
browser.addCursorChangeListener((type) -> mouseType = type);
|
||||||
|
|
||||||
doTurnOnAnim = doAnim;
|
doTurnOnAnim = doAnim;
|
||||||
turnOnTime = System.currentTimeMillis();
|
turnOnTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
30
src/main/java/net/montoyo/wd/mixins/OverlayMixin.java
Normal file
30
src/main/java/net/montoyo/wd/mixins/OverlayMixin.java
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
package net.montoyo.wd.mixins;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.montoyo.wd.client.ClientProxy;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(Gui.class)
|
||||||
|
public class OverlayMixin {
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
protected Minecraft minecraft;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
protected int screenWidth;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
protected int screenHeight;
|
||||||
|
|
||||||
|
@Inject(at = @At("HEAD"), method = "renderCrosshair", cancellable = true)
|
||||||
|
public void preDrawCrosshair(PoseStack poseStack, CallbackInfo ci) {
|
||||||
|
ClientProxy.renderCrosshair(minecraft.options, screenWidth, screenHeight, ((Gui) (Object) this).getBlitOffset(), poseStack, ci);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -42,6 +42,6 @@ side="BOTH"
|
||||||
[[dependencies.webdisplays]]
|
[[dependencies.webdisplays]]
|
||||||
modId="forgecef"
|
modId="forgecef"
|
||||||
mandatory=true
|
mandatory=true
|
||||||
versionRange="[1.2.4, )"
|
versionRange="[1.2.3, )"
|
||||||
ordering="NONE"
|
ordering="NONE"
|
||||||
side="BOTH"
|
side="BOTH"
|
||||||
|
|
|
||||||
BIN
src/main/resources/assets/webdisplays/textures/gui/cursors.png
Normal file
BIN
src/main/resources/assets/webdisplays/textures/gui/cursors.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
|
|
@ -22,7 +22,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"webdisplays.mixin.json"
|
"webdisplays.mixins.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
"mixins": [
|
"mixins": [
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
|
"OverlayMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
Loading…
Reference in New Issue
Block a user