-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented zoom functionality #721
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -530,7 +530,13 @@ public enum Mixins { | |
.addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap") | ||
), | ||
//End from NotFine | ||
|
||
//SkidZoom | ||
SKIDZOOM(new Builder("zoom zoom") | ||
.setSide(Side.CLIENT).setPhase(Phase.LATE) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it's vanilla it should be Phase.EARLY |
||
.addTargetedMod(TargetedMod.VANILLA) | ||
.addMixinClasses("client.skidzoom.InventoryPlayerMixin") | ||
), | ||
//End SkidZoom | ||
QPR(new Builder("Adds a QuadProvider field to blocks without populating it") | ||
.setSide(Side.CLIENT) | ||
.setPhase(Phase.EARLY) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package net.loudcats.wyatt.skidzoom; | ||
|
||
import cpw.mods.fml.client.registry.ClientRegistry; | ||
import cpw.mods.fml.common.Mod; | ||
import cpw.mods.fml.common.event.FMLInitializationEvent; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraft.client.settings.KeyBinding; | ||
import net.minecraftforge.client.event.FOVUpdateEvent; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import org.lwjgl.input.Keyboard; | ||
import org.lwjgl.input.Mouse; | ||
|
||
@Mod(modid = "skidzoom", name = "SkidZoom", version = "1.0") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please don't create another mod, just hook it up to angelica |
||
public class SkidZoom { | ||
|
||
public KeyBinding zoomKey; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't need to be public |
||
private static boolean zoom; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is one field static and not the 2 others |
||
private int zoomamt = -7; | ||
|
||
@Mod.EventHandler | ||
public void init(FMLInitializationEvent event) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only register stuff on the client |
||
MinecraftForge.EVENT_BUS.register(this); | ||
zoomKey = new KeyBinding("key.skidzoom", Keyboard.KEY_C, "key.categories.misc"); | ||
zoom = false; | ||
ClientRegistry.registerKeyBinding(zoomKey); | ||
} | ||
|
||
@SubscribeEvent | ||
public void ZoomyZoomZoom(FOVUpdateEvent e) { | ||
if (zoomKey.getIsKeyPressed() || zoomKey.isPressed()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't use |
||
zoom = true; | ||
if (zoom) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
// Adjust zoom level with mouse wheel while holding zoom key | ||
int dWheel = Mouse.getDWheel(); | ||
if (dWheel != 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This entire if can be replaced with |
||
if (dWheel > 0) { | ||
zoomamt--; // decrease fov when scrolling up | ||
} else { | ||
zoomamt++; // increase fov when scrolling down | ||
} | ||
} | ||
|
||
// Apply the shit | ||
e.newfov = (float) (e.fov * (1.0 + zoomamt * 0.1)); | ||
} | ||
} else { | ||
zoom = false; | ||
zoomamt = -7; | ||
} | ||
} | ||
|
||
public static boolean isZooming() { | ||
return zoom; | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jfc proper one would be "Przybliżenie" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.gtnewhorizons.angelica.mixins.late.client.skidzoom; | ||
|
||
import net.loudcats.wyatt.skidzoom.SkidZoom; | ||
import net.minecraft.entity.player.InventoryPlayer; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(InventoryPlayer.class) | ||
public abstract class InventoryPlayerMixin { | ||
@Inject(method = "changeCurrentItem", at = @At("HEAD"), cancellable = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer that you wrap the |
||
public void changeCurrentItem(int direction, CallbackInfo ci) { | ||
if(SkidZoom.isZooming()) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove all the word "skid" that you put everywhere, it means "stealing code" and that is not appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry I just seen all these. I'm not super familiar with the way that pull requests work and stuff so I missed all of these my apologies. And as for the word skid, its a copy pasta implementation of a mod I made for myself a while ago that was also called SkidZoom so I apologize for not seeing these messages, that is all. I will turn on notifications for any potential future pull requests.