Skip to content
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

Prevents the nightvision on the NanoSuit & QuantumSuit from blinding people when it's bright out #4

Merged
merged 1 commit into from
Jan 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/mitchej123/hodgepodge/Hodgepodge.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Hodgepodge {

public static final Logger log = LogManager.getLogger("Hodgepodge");
public static final String MODID = "hodgepodge";
public static final String VERSION = "1.4.3";
public static final String VERSION = "1.4.4";
public static final String NAME = "A Hodgepodge of Patches";
public static XSTR RNG = new XSTR();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ public enum MixinSets {
IC2_DIRECT_INV_ACCESS("IC2 Direct Inventory Access Fix",
() -> config.fixIc2DirectInventoryAccess,
"fixic2directinventoryaccess.item.MixinItemCropSeed",
"fixic2directinventoryaccess.crop.MixinTileEntityCrop");
"fixic2directinventoryaccess.crop.MixinTileEntityCrop"),
IC2_NIGHT_VISION("IC2 Nightvision adjustment",
() -> config.fixIc2Nightvision,
"fixIc2Nightvision.MixinIc2NanoSuitNightVision",
"fixIc2Nightvision.MixinIc2QuantumSuitNightVision"
);


private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class LoadingConfig {
public boolean fixGrassChunkLoads;
public boolean fixFenceConnections;
public boolean fixIc2DirectInventoryAccess;
public boolean fixIc2Nightvision;
public boolean speedupChunkCoordinatesHashCode;
public static Configuration config;

Expand All @@ -26,6 +27,7 @@ public LoadingConfig(File file) {
fixGrassChunkLoads = config.get("fixes", "fixGrassChunkLoads", true, "Fix grass spreading from loading chunks").getBoolean();
fixFenceConnections = config.get("fixes", "fixFenceConnections", true, "Fix fence connections with other types of fence").getBoolean();
fixIc2DirectInventoryAccess = config.get("fixes", "fixIc2DirectInventoryAccess", true, "Fix IC2's direct inventory access").getBoolean();
fixIc2Nightvision = config.get("fixes", "fixIc2Nightvision", true, "Prevent IC2's nightvision from blinding you").getBoolean();
speedupChunkCoordinatesHashCode = config.get("speedups", "speedupChunkCoordinatesHashCode", true, "Speedup ChunkCoordinates hashCode").getBoolean();

if (config.hasChanged())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mitchej123.hodgepodge.mixins.fixIc2Nightvision;

import ic2.core.item.armor.ItemArmorNanoSuit;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = ItemArmorNanoSuit.class)
public class MixinIc2NanoSuitNightVision {
@Redirect(
method= "onArmorTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/item/ItemStack;)V",
at = @At(
value="INVOKE",
target="Lnet/minecraft/world/World;getBlockLightValue(III)I"
),
remap = false
)
public int getBlockLightValue() {
// Ic2 nightvision will blind anyone if `getBlockLightValue` returns > 8; so always return 1
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mitchej123.hodgepodge.mixins.fixIc2Nightvision;

import ic2.core.item.armor.ItemArmorQuantumSuit;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = ItemArmorQuantumSuit.class)
public class MixinIc2QuantumSuitNightVision {
@Redirect(
method= "onArmorTick(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/item/ItemStack;)V",
at = @At(
value="INVOKE",
target="Lnet/minecraft/world/World;getBlockLightValue(III)I"
),
remap = false
)
public int getBlockLightValue() {
// Ic2 nightvision will blind anyone if `getBlockLightValue` returns > 8; so always return 1
return 1;
}
}