bump MCEF version, fix a typo in the lang file, fix some bugs with page opening

This commit is contained in:
GiantLuigi4 2023-06-04 00:03:06 -04:00
parent e2f6ac39a5
commit e1ae67c7a2
6 changed files with 24 additions and 21 deletions

View File

@ -75,7 +75,7 @@ dependencies {
minecraft 'net.minecraftforge:forge:1.19.2-43.2.10'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
implementation fg.deobf("com.github.Mysticpasta1:mcef-forge:b874b3aa35")
implementation fg.deobf("com.github.Mysticpasta1:mcef-forge:f0c7e2e361")
// implementation fg.deobf("curse.maven:cloth_config_forge-348521:3972423")
implementation fg.deobf("curse.maven:SU-370704:4485052")
implementation fg.deobf("curse.maven:spark-361579:4381167")

View File

@ -86,7 +86,7 @@ public class GuiSetURL2 extends WDScreen {
protected UUID getUUID() {
if (stack == null || !(stack.getItem() instanceof ItemMinePad2))
throw new RuntimeException("Get UUID is being called for a non-minepad UI");
if (!stack.hasTag())
if (!stack.hasTag() || !stack.getTag().contains("PadID"))
stack.getOrCreateTag().putUUID("PadID", UUID.randomUUID());
return stack.getTag().getUUID("PadID");
@ -100,12 +100,11 @@ public class GuiSetURL2 extends WDScreen {
validate(tfURL.getText());
else if (ev.getSource() == btnShutDown) {
if (isPad) {
stack.getTag().remove("PadURL");
stack.getTag().remove("PadID");
WDNetworkRegistry.INSTANCE.sendToServer(new C2SMinepadUrl(
getUUID(),
""
));
stack.getTag().remove("PadID");
}
minecraft.setScreen(null);

View File

@ -12,6 +12,7 @@ import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -42,10 +43,27 @@ public final class MinePadRenderer implements IItemRenderer {
sinSwingProg1 = (float) Math.sin(swingProgress * PI);
sinSwingProg2 = (float) Math.sin(swingProgress * swingProgress * PI);
float relSide = handSideSign;
if (Minecraft.getInstance().player.getMainArm() == HumanoidArm.LEFT) relSide *= -1;
// by default, the player holds the device off to the side
// if they are crouching, they hold it infront of them
// however, if they are holding two at once, then it once again should just be held off to the side
boolean sideHold = Minecraft.getInstance().player.isShiftKeyDown() != ClientConfig.sidePad;
if (
(relSide < 0 && Minecraft.getInstance().player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ItemMinePad2) ||
(relSide > 0 && Minecraft.getInstance().player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ItemMinePad2)
) sideHold = true;
//Render arm
stack.pushPose();
renderArmFirstPerson(stack, multiBufferSource, packedLight, equipProgress, handSideSign);
stack.popPose();
// if (!sideHold && handSideSign == 1 && mc.player.getItemInHand(InteractionHand.OFF_HAND).isEmpty()) {
// stack.pushPose();
// renderArmFirstPerson(stack, multiBufferSource, packedLight, 0, -handSideSign);
// stack.popPose();
// }
//Prepare minePad transform
stack.pushPose();
@ -56,15 +74,6 @@ public final class MinePadRenderer implements IItemRenderer {
stack.mulPose(Vector3f.XP.rotationDegrees(sinSqrtSwingProg1 * -80.0f));
stack.mulPose(Vector3f.YP.rotationDegrees(handSideSign * -45.0f));
// by default, the player holds the device off to the side
// if they are crouching, they hold it infront of them
// however, if they are holding two at once, then it once again should just be held off to the side
boolean sideHold = Minecraft.getInstance().player.isShiftKeyDown() != ClientConfig.sidePad;
if (
(handSideSign < 0 && Minecraft.getInstance().player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof ItemMinePad2) ||
(handSideSign > 0 && Minecraft.getInstance().player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof ItemMinePad2)
) sideHold = true;
if (sideHold) {
stack.translate(0.0f, 0.0f, -0.2f);
stack.mulPose(Vector3f.YP.rotationDegrees(20.0f * -handSideSign));

View File

@ -63,10 +63,9 @@ public class ItemMinePad2 extends Item implements WDItem {
ok = true;
} else {
UUID uuid = UUID.randomUUID();
String url = CommonConfig.Browser.homepage;
String url = getURL(is);
WDNetworkRegistry.INSTANCE.sendToServer(new C2SMinepadUrl(uuid, url));
is.getOrCreateTag().putUUID("PadID", uuid);
is.getTag().putString("PadURL", url);
ok = true;
}

View File

@ -33,7 +33,6 @@ public class C2SMinepadUrl extends Packet {
protected void merge(ItemStack stack) {
if (url.equals("")) {
stack.getOrCreateTag().remove("PadID");
stack.getOrCreateTag().remove("PadURL");
} else {
stack.getOrCreateTag().putUUID("PadID", id);
stack.getOrCreateTag().putString("PadURL", url);
@ -58,10 +57,7 @@ public class C2SMinepadUrl extends Packet {
// if the player is not holding the requested minePad, update the first one that does not already have an ID
for (InteractionHand value : InteractionHand.values()) {
ItemStack stack = ctx.getSender().getItemInHand(value);
if (stack.getItem() instanceof ItemMinePad2 && stack.getOrCreateTag().contains("PadID")) {
if (stack.getOrCreateTag().contains("PadID"))
continue;
if (stack.getItem() instanceof ItemMinePad2 && !stack.getOrCreateTag().contains("PadID")) {
merge(stack);
return;
}

View File

@ -110,7 +110,7 @@
"advancements.webdisplays.linkperipheral.title": "It's wireless!",
"advancements.webdisplays.linkperipheral.description": "Link a peripheral to a screen",
"advancements.webdisplays.keyboardcat.title": "DAMN CATS",
"advancements.webdisplays.keyboardcat.description": "Have an ocelot walk on y,our keyboard",
"advancements.webdisplays.keyboardcat.description": "Have an ocelot walk on your keyboard",
"advancements.webdisplays.upgrade.title": "More than a screen",
"advancements.webdisplays.upgrade.description": "Install your first upgrade",
"advancements.webdisplays.laser.title": "Don't aim the eyes",