forked from Jorbon/cool_elytra
-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
99 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- Removed dependency on Forgified Fabric API. | ||
- Its a secret. | ||
- I sure hope this works on fabric tho. |
52 changes: 0 additions & 52 deletions
52
common/src/main/java/nl/enjarai/doabarrelroll/compat/CompatMixinPlugin.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ic/src/main/java/nl/enjarai/doabarrelroll/compat/cameraoverhaul/CameraOverhaulPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
fabric/src/main/java/nl/enjarai/doabarrelroll/compat/controlify/ControlifyPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/ModMenuPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package nl.enjarai.doabarrelroll.compat.modmenu; | ||
|
||
import nl.enjarai.cicada.api.compat.CompatMixinPlugin; | ||
|
||
import java.util.Set; | ||
|
||
public class ModMenuPlugin implements CompatMixinPlugin { | ||
@Override | ||
public Set<String> getRequiredMods() { | ||
return Set.of("modmenu"); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
fabric/src/main/java/nl/enjarai/doabarrelroll/compat/modmenu/mixin/ModsScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package nl.enjarai.doabarrelroll.compat.modmenu.mixin; | ||
|
||
import com.terraformersmc.modmenu.gui.ModsScreen; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.client.gui.screen.Screen; | ||
import net.minecraft.client.util.GlfwUtil; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.math.RotationAxis; | ||
import nl.enjarai.doabarrelroll.config.ModConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.Locale; | ||
|
||
@Mixin(ModsScreen.class) | ||
public abstract class ModsScreenMixin extends Screen { | ||
@Unique | ||
private double lastTime; | ||
@Unique | ||
private double rollSecs; | ||
|
||
protected ModsScreenMixin(Text title) { | ||
super(title); | ||
} | ||
|
||
@Inject( | ||
method = "lambda$init$0", | ||
at = @At("HEAD"), | ||
remap = false | ||
) | ||
private void onUpdateSearch(String string, CallbackInfo ci) { | ||
if (ModConfig.INSTANCE.getEnableEasterEggs() && string.toLowerCase(Locale.ROOT).equals("do a barrel roll")) { | ||
rollSecs += 1; | ||
} | ||
} | ||
|
||
@Inject( | ||
method = "render", | ||
at = @At("HEAD"), | ||
remap = false | ||
) | ||
private void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
double time = GlfwUtil.getTime(); | ||
double secsDelta = time - lastTime; | ||
lastTime = time; | ||
|
||
if (rollSecs > 0) { | ||
// Draw a nice background to prevent previous frames pixels from peeking through | ||
context.fill(0, 0, width, height, 0xff000000); | ||
|
||
var matrices = context.getMatrices(); | ||
rollSecs -= Math.max(0, secsDelta); | ||
float roll = (float) (rollSecs * Math.PI * 2); | ||
|
||
// Rotate around center ofc | ||
matrices.translate(width / 2f, height / 2f, 0); | ||
matrices.multiply(RotationAxis.POSITIVE_Z.rotation(roll)); | ||
matrices.translate(-width / 2f, -height / 2f, 0); | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
fabric/src/main/resources/do_a_barrel_roll.compat.modmenu.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "nl.enjarai.doabarrelroll.compat.modmenu.mixin", | ||
"plugin": "nl.enjarai.doabarrelroll.compat.modmenu.ModMenuPlugin", | ||
"refmap": "${mod_id}.refmap.json", | ||
"compatibilityLevel": "JAVA_17", | ||
"client": [ | ||
"ModsScreenMixin" | ||
], | ||
"mixins": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters