Skip to content

Commit

Permalink
Fixing console warnings and errors
Browse files Browse the repository at this point in the history
Fix #4
Fix #14
  • Loading branch information
Scribble authored and PancakeTAS committed Dec 16, 2020
1 parent 3a196b0 commit f1a3481
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 58 deletions.
45 changes: 24 additions & 21 deletions src/main/java/de/scribble/lp/tasmod/mixin/MixinEntityRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,27 +196,30 @@ public void injectUpdateCameraAndRenderer(float partialTicks, long nanoTime, Cal
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering screen");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Screen render details");
crashreportcategory.addDetail("Screen name", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName();
}
});
crashreportcategory.addDetail("Mouse location", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", k1, l1, Mouse.getX(), Mouse.getY());
}
});
crashreportcategory.addDetail("Screen size", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, scaledresolution.getScaleFactor());
}
});
// crashreportcategory.addDetail("Screen name", new ICrashReportDetail<String>()
// {
// public String call() throws Exception
// {
// return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName();
// }
// });
Minecraft.LOGGER.fatal(Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName());
// crashreportcategory.addDetail("Mouse location", new ICrashReportDetail<String>()
// {
// public String call() throws Exception
// {
// return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", k1, l1, Mouse.getX(), Mouse.getY());
// }
// });
Minecraft.LOGGER.fatal(Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName());
// crashreportcategory.addDetail("Screen size", new ICrashReportDetail<String>()
// {
// public String call() throws Exception
// {
// return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, scaledresolution.getScaleFactor());
// }
// });
Minecraft.LOGGER.fatal(Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName());
throw new ReportedException(crashreport);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
@Mixin(GameSettings.class)
public class MixinGameSettings {

@Redirect(method = "isKeyDown", at = @At(value= "INVOKE", target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z",ordinal = 0))
@Redirect(method = "isKeyDown", at = @At(value= "INVOKE", target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z",ordinal = 0, remap=false))
private static boolean redirectIsKeyDown1(int i, KeyBinding key) {
return VirtualMouseAndKeyboard.isKeyDown(i+100);
}
@Redirect(method = "isKeyDown", at = @At(value= "INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z",ordinal = 0))
@Redirect(method = "isKeyDown", at = @At(value= "INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z",ordinal = 0, remap=false))
private static boolean redirectIsKeyDown2(int i, KeyBinding key) {
return VirtualMouseAndKeyboard.isKeyDown(i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Mixin(GuiChat.class)
public class MixinGuiChat {
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I"))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I", remap = false))
public int redirectHandleMouseInput4() {
return VirtualMouseAndKeyboard.getEventDWheel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Mixin(GuiClickableScrolledSelectionListProxy.class)
public class MixinGuiClickableScrolledSelectionListProxy {
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventButtonState()Z",ordinal = 0))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventButtonState()Z",ordinal = 0, remap = false))
public boolean redirectHandleMouseInput() {
return VirtualMouseAndKeyboard.getEventMouseButtonState();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

@Mixin(GuiContainer.class)
public class MixinGuiContainer {
@Redirect(method = "mouseClicked",at = @At(value="INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z",ordinal = 0))
@Redirect(method = "mouseClicked",at = @At(value="INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z",ordinal = 0, remap=false))
private boolean redirectIsKeyDown(int i) {
return VirtualMouseAndKeyboard.isKeyDown(i);
}
@Redirect(method = "mouseReleased",at = @At(value="INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z",ordinal = 0))
@Redirect(method = "mouseReleased",at = @At(value="INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z",ordinal = 0, remap=false))
private boolean redirectIsKeyDown2(int i) {
return VirtualMouseAndKeyboard.isKeyDown(i);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

@Mixin(GuiContainerCreative.class)
public class MixinGuiContainerCreative {
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I",ordinal = 0))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I",ordinal = 0, remap=false))
public int redirectHandleMouseInput() {
return VirtualMouseAndKeyboard.getEventDWheel();
}
@Redirect(method = "drawScreen", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z",ordinal = 0))
@Redirect(method = "drawScreen", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z",ordinal = 0, remap=false))
public boolean redirectHandleMouseInput2(int i) {
return VirtualMouseAndKeyboard.isKeyDown(-100);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/scribble/lp/tasmod/mixin/MixinGuiScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public abstract class MixinGuiScreen{
private int eventButton;
@Shadow
private long lastMouseEvent;
@Shadow
@Shadow(remap = false)
private boolean keyHandled;
@Shadow
@Shadow(remap = false)
private boolean mouseHandled;
@Inject(method = "handleInput", at = @At(value = "HEAD"),cancellable = true)
public void redirectHandleInput(CallbackInfo ci) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

@Mixin(GuiScreenAdvancements.class)
public class MixinGuiScreenAdvancements {
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z"))
@Redirect(method = "drawScreen", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z", remap = false))
public boolean redirectIsButtonDown() {
return VirtualMouseAndKeyboard.isKeyDown(-100);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/scribble/lp/tasmod/mixin/MixinGuiSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

@Mixin(GuiSlot.class)
public class MixinGuiSlot {
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventButtonState()Z",ordinal = 0))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventButtonState()Z",ordinal = 0, remap = false))
public boolean redirectHandleMouseInput() {
return VirtualMouseAndKeyboard.getEventMouseButtonState();
}
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventButton()I",ordinal = 0))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventButton()I",ordinal = 0, remap = false))
public int redirectHandleMouseInput2() {
return VirtualMouseAndKeyboard.getEventMouseButton();
}
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z",ordinal = 0))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z",ordinal = 0, remap = false))
public boolean redirectHandleMouseInput3(int i) {
return VirtualMouseAndKeyboard.isKeyDown(-100);
}
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I",ordinal = 0))
@Redirect(method = "handleMouseInput", at = @At(value = "INVOKE",target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I",ordinal = 0, remap = false))
public int redirectHandleMouseInput4() {
return VirtualMouseAndKeyboard.getEventDWheel();
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/de/scribble/lp/tasmod/mixin/MixinGuiStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@

@Mixin(GuiStats.class)
public class MixinGuiStats {
@Redirect(method = "drawListHeader", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;isButtonDown(I)Z"))
public boolean redirectIsButtonDown() {
System.out.println("Test");
@Redirect(method = "net/minecraft/client/gui/achievement/GuiStats/Stats;drawListHeader(I,I,Lnet/minecraft/client/renderer/Tessellator)V", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse/isButtonDown(I)Z",remap = false))
private static boolean redirectIsButtonDown(int i) {
return !VirtualMouseAndKeyboard.isKeyDown(-100);
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package de.scribble.lp.tasmod.mixin;

import javax.swing.text.JTextComponent.KeyBinding;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import de.scribble.lp.tasmod.virtual.VirtualMouseAndKeyboard;
import net.minecraft.client.settings.KeyBinding;

@Mixin(KeyBinding.class)
public class MixinKeyBinding {
@Redirect(method = "updateKeyBindState", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z"))
public boolean redirectIsKeyDown(int i) {
@Redirect(method = "updateKeyBindState", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z", remap = false))
private static boolean redirectIsKeyDown(int i) {
return VirtualMouseAndKeyboard.isKeyDown(i);
}
}
30 changes: 16 additions & 14 deletions src/main/java/de/scribble/lp/tasmod/mixin/MixinMinecraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,14 @@ else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable1, "Updating screen events");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Affected screen");
crashreportcategory.addDetail("Screen name", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName();
}
});
// crashreportcategory.addDetail("Screen name", new ICrashReportDetail<String>()
// {
// public String call() throws Exception
// {
// return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName();
// }
// });
Minecraft.LOGGER.fatal(this.currentScreen.getClass().getCanonicalName());
throw new ReportedException(crashreport);
}

Expand All @@ -495,13 +496,14 @@ public String call() throws Exception
{
CrashReport crashreport1 = CrashReport.makeCrashReport(throwable, "Ticking screen");
CrashReportCategory crashreportcategory1 = crashreport1.makeCategory("Affected screen");
crashreportcategory1.addDetail("Screen name", new ICrashReportDetail<String>()
{
public String call() throws Exception
{
return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName();
}
});
// crashreportcategory1.addDetail("Screen name", new ICrashReportDetail<String>()
// {
// public String call() throws Exception
// {
// return Minecraft.getMinecraft().currentScreen.getClass().getCanonicalName();
// }
// });
Minecraft.LOGGER.fatal(this.currentScreen.getClass().getCanonicalName());
throw new ReportedException(crashreport1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ public class CommandTickSync extends CommandBase{

@Override
public String getName() {
// TODO Auto-generated method stub
return "ticksync";
}

@Override
public String getUsage(ICommandSender sender) {
// TODO Auto-generated method stub
return "/ticksync [reset]";
}

Expand Down

0 comments on commit f1a3481

Please sign in to comment.