-
Notifications
You must be signed in to change notification settings - Fork 4
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
119 changed files
with
2,753 additions
and
3,264 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
Binary file not shown.
Binary file not shown.
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
32 changes: 0 additions & 32 deletions
32
src/main/java/me/cephetir/skyskipped/mixins/IMixinSugarCaneMacro.java
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
src/main/java/me/cephetir/skyskipped/mixins/MixinBlockCarpet.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,47 @@ | ||
/* | ||
* | ||
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
* Version 2, December 2004 | ||
* | ||
* Copyright (C) 2022 Cephetir | ||
* | ||
* Everyone is permitted to copy and distribute verbatim or modified | ||
* copies of this license document, and changing it is allowed as long | ||
* as the name is changed. | ||
* | ||
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
* | ||
* 0. You just DO WHAT THE FUCK YOU WANT TO. | ||
*/ | ||
|
||
package me.cephetir.skyskipped.mixins; | ||
|
||
import me.cephetir.skyskipped.config.Config; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockCarpet; | ||
import net.minecraft.block.material.MapColor; | ||
import net.minecraft.block.material.Material; | ||
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(BlockCarpet.class) | ||
public class MixinBlockCarpet extends Block { | ||
|
||
public MixinBlockCarpet(Material p_i46399_1_, MapColor p_i46399_2_) { | ||
super(p_i46399_1_, p_i46399_2_); | ||
} | ||
|
||
public MixinBlockCarpet(Material materialIn) { | ||
super(materialIn); | ||
} | ||
|
||
@Inject(method = "setBlockBoundsFromMeta", at = @At(value = "HEAD"), cancellable = true) | ||
public void setBlockBoundsFromMeta(int meta, CallbackInfo ci) { | ||
if (!Config.Companion.getRemoveCarpets()) return; | ||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f); | ||
ci.cancel(); | ||
} | ||
} |
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
88 changes: 88 additions & 0 deletions
88
src/main/java/me/cephetir/skyskipped/mixins/MixinEquipmentOverlay.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,88 @@ | ||
/* | ||
* | ||
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
* Version 2, December 2004 | ||
* | ||
* Copyright (C) 2022 Cephetir | ||
* | ||
* Everyone is permitted to copy and distribute verbatim or modified | ||
* copies of this license document, and changing it is allowed as long | ||
* as the name is changed. | ||
* | ||
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
* | ||
* 0. You just DO WHAT THE FUCK YOU WANT TO. | ||
*/ | ||
|
||
package me.cephetir.skyskipped.mixins; | ||
|
||
import me.cephetir.skyskipped.config.Config; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import org.spongepowered.asm.mixin.Dynamic; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
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.lang.reflect.Field; | ||
|
||
@Pseudo | ||
@Mixin(targets = "io.github.moulberry.notenoughupdates.overlays.EquipmentOverlay", remap = false) | ||
public class MixinEquipmentOverlay { | ||
@Unique | ||
private Class<?> petOverlayClass = null; | ||
@Unique | ||
private Object petOverlayInstance = null; | ||
@Unique | ||
private Class<?> customArmourClass = null; | ||
@Unique | ||
private Object customArmourInstance = null; | ||
|
||
@Dynamic | ||
@Inject(method = "updateGuiInfo", at = @At("HEAD"), cancellable = true) | ||
private void updateGuiInfo(GuiScreen screen, CallbackInfo ci) { | ||
if (!Config.Companion.getNeuOptimize()) return; | ||
try { | ||
if (petOverlayInstance == null || customArmourInstance == null) { | ||
Class<?> neu = Class.forName("io.github.moulberry.notenoughupdates.NotEnoughUpdates"); | ||
Field neuInstanceField = getField(neu, "INSTANCE"); | ||
Object neuInstance = neuInstanceField.get(null); | ||
|
||
Field configField = getField(neu, "config"); | ||
Class<?> config = configField.getType(); | ||
Object configInstance = configField.get(neuInstance); | ||
|
||
Field petOverlayField = getField(config, "petOverlay"); | ||
petOverlayClass = petOverlayField.getType(); | ||
petOverlayInstance = petOverlayField.get(configInstance); | ||
|
||
Field customArmourField = getField(config, "customArmour"); | ||
customArmourClass = customArmourField.getType(); | ||
customArmourInstance = customArmourField.get(configInstance); | ||
} | ||
|
||
Field petInvDisplayField = getField(petOverlayClass, "petInvDisplay"); | ||
boolean petInvDisplay = petInvDisplayField.getBoolean(petOverlayInstance); | ||
|
||
Field enableArmourHudField = getField(customArmourClass, "enableArmourHud"); | ||
boolean enableArmourHud = enableArmourHudField.getBoolean(customArmourInstance); | ||
|
||
if (!petInvDisplay && !enableArmourHud) | ||
ci.cancel(); | ||
} catch (ClassNotFoundException | IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Unique | ||
private Field getField(Class<?> clazz, String name) { | ||
Field[] fields = clazz.getDeclaredFields(); | ||
for (Field field : fields) | ||
if (field.getName().equals(name)) | ||
return field; | ||
return null; | ||
} | ||
} |
Oops, something went wrong.