mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:11:31 +01:00
FullBright
This commit is contained in:
parent
99e0858f98
commit
df8e8cc4ec
@ -0,0 +1,19 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.silentclient.client.Client;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Chunk.class)
|
||||
public class ChunkMixin {
|
||||
@Inject(method = {"getLightFor", "getLightSubtracted"}, at = @At("HEAD"), cancellable = true)
|
||||
private void patchFullbright(CallbackInfoReturnable<Integer> cir) {
|
||||
if (Client.getInstance().getModInstances().getFullBrightMod().isEnabled()) {
|
||||
cir.setReturnValue(15);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.impl.EntityJoinLevelEvent;
|
||||
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;
|
||||
@ -11,6 +14,25 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(World.class)
|
||||
public class WorldMixin {
|
||||
@Inject(method = "checkLightFor", at = @At("HEAD"), cancellable = true)
|
||||
private void checkLightFor(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (this.canFullbright()) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = {"getLightFromNeighborsFor", "getLightFromNeighbors", "getRawLight", "getLight(Lnet/minecraft/util/BlockPos;)I", "getLight(Lnet/minecraft/util/BlockPos;Z)I" }, at = @At("HEAD"), cancellable = true)
|
||||
private void getLightFromNeighborsFor(CallbackInfoReturnable<Integer> cir) {
|
||||
if (this.canFullbright()) {
|
||||
cir.setReturnValue(15);
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean canFullbright() {
|
||||
return Minecraft.getMinecraft().isCallingFromMinecraftThread() && Client.getInstance().getModInstances().getFullBrightMod().isEnabled();
|
||||
}
|
||||
|
||||
@Inject(method = "spawnEntityInWorld", at = @At("HEAD"), cancellable = true)
|
||||
public void callEntityJoinLevelEvent1(Entity entityIn, CallbackInfoReturnable<Boolean> cir) {
|
||||
EntityJoinLevelEvent event = new EntityJoinLevelEvent(entityIn);
|
||||
|
13
src/main/java/net/silentclient/client/utils/ClientUtils.java
Normal file
13
src/main/java/net/silentclient/client/utils/ClientUtils.java
Normal file
@ -0,0 +1,13 @@
|
||||
package net.silentclient.client.utils;
|
||||
|
||||
public class ClientUtils {
|
||||
public static boolean isDevelopment() {
|
||||
for(StackTraceElement element : Thread.currentThread().getStackTrace()) {
|
||||
if(element.getClassName().equals("GradleStart")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -42,6 +42,7 @@
|
||||
"mixins.ShaderGroupMixin",
|
||||
"mixins.GuiContainerMixin",
|
||||
"mixins.InventoryEffectRendererMixin",
|
||||
"mixins.TextureManagerMixin"
|
||||
"mixins.TextureManagerMixin",
|
||||
"mixins.ChunkMixin"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user