forked from PianoPenguin471/RavenWeave
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept pull 56
- Loading branch information
Showing
9 changed files
with
381 additions
and
5 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/me/pianopenguin471/mixins/BlockGrassMixin.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,29 @@ | ||
package me.pianopenguin471.mixins; | ||
|
||
import ravenweave.client.module.modules.render.Xray; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockGrass; | ||
import net.minecraft.block.material.MapColor; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.util.EnumWorldBlockLayer; | ||
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; | ||
import ravenweave.client.main.Raven; | ||
|
||
@Mixin(priority = 1005, value = BlockGrass.class) | ||
public class BlockGrassMixin extends Block { | ||
|
||
public BlockGrassMixin(Material p_i46399_1_, MapColor p_i46399_2_) { | ||
super(p_i46399_1_, p_i46399_2_); | ||
} | ||
|
||
@Inject(method = "getBlockLayer", at = @At("HEAD"), cancellable = true) | ||
public void getBlockLayer(CallbackInfoReturnable<EnumWorldBlockLayer> cir) { | ||
if(Raven.moduleManager.getModuleByClazz(Xray.class).isEnabled()) { | ||
cir.setReturnValue(super.getBlockLayer()); | ||
} | ||
} | ||
|
||
} |
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,40 @@ | ||
package me.pianopenguin471.mixins; | ||
|
||
import ravenweave.client.module.modules.render.Xray; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.EnumWorldBlockLayer; | ||
import net.minecraft.world.IBlockAccess; | ||
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; | ||
import ravenweave.client.main.Raven; | ||
|
||
@Mixin(value = Block.class, priority = 1005) | ||
public class BlockMixin { | ||
|
||
@Inject(method = "shouldSideBeRendered", at = @At("HEAD"), cancellable = true) | ||
public void shouldSideBeRendered(IBlockAccess p_shouldSideBeRendered_1_, BlockPos p_shouldSideBeRendered_2_, | ||
EnumFacing p_shouldSideBeRendered_3_, CallbackInfoReturnable<Boolean> cir) { | ||
if(Raven.moduleManager.getModuleByClazz(Xray.class).isEnabled() && Xray.hypixel.isToggled()) { | ||
cir.setReturnValue(Xray.isOreBlock((Block) (Object) this)); | ||
} | ||
} | ||
|
||
@Inject(method = "getBlockLayer", at = @At("HEAD"), cancellable = true) | ||
public void getBlockLayer(CallbackInfoReturnable<EnumWorldBlockLayer> cir) { | ||
if(Raven.moduleManager.getModuleByClazz(Xray.class).isEnabled()) { | ||
cir.setReturnValue(Xray.isOreBlock((Block) (Object) this) ? EnumWorldBlockLayer.SOLID : EnumWorldBlockLayer.TRANSLUCENT); | ||
} | ||
} | ||
|
||
@Inject(method = "getAmbientOcclusionLightValue", at = @At("HEAD"), cancellable = true) | ||
public void getAmbientOcclusionLightValue(CallbackInfoReturnable<Float> cir) { | ||
if (Raven.moduleManager.getModuleByClazz(Xray.class).isEnabled()) { | ||
cir.setReturnValue(1F); | ||
} | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/me/pianopenguin471/mixins/BlockModelRendererMixin.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,45 @@ | ||
package me.pianopenguin471.mixins; | ||
|
||
import ravenweave.client.module.modules.render.Xray; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.BlockModelRenderer; | ||
import net.minecraft.client.renderer.WorldRenderer; | ||
import net.minecraft.client.resources.model.IBakedModel; | ||
import net.minecraft.crash.CrashReport; | ||
import net.minecraft.crash.CrashReportCategory; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.util.ReportedException; | ||
import net.minecraft.world.IBlockAccess; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import ravenweave.client.main.Raven; | ||
@Mixin(value = BlockModelRenderer.class, priority = 999) | ||
public abstract class BlockModelRendererMixin { | ||
|
||
@Shadow public abstract boolean renderModelAmbientOcclusion(IBlockAccess p_renderModelAmbientOcclusion_1_, IBakedModel p_renderModelAmbientOcclusion_2_, Block p_renderModelAmbientOcclusion_3_, BlockPos p_renderModelAmbientOcclusion_4_, WorldRenderer p_renderModelAmbientOcclusion_5_, boolean p_renderModelAmbientOcclusion_6_); | ||
|
||
@Shadow public abstract boolean renderModelStandard(IBlockAccess p_renderModelStandard_1_, IBakedModel p_renderModelStandard_2_, Block p_renderModelStandard_3_, BlockPos p_renderModelStandard_4_, WorldRenderer p_renderModelStandard_5_, boolean p_renderModelStandard_6_); | ||
|
||
/** | ||
* @author mc code | ||
* @reason god help me | ||
*/ | ||
@Overwrite | ||
public boolean renderModel(IBlockAccess p_renderModel_1_, IBakedModel p_renderModel_2_, IBlockState p_renderModel_3_, BlockPos p_renderModel_4_, WorldRenderer p_renderModel_5_, boolean p_renderModel_6_) { | ||
boolean flag = Minecraft.isAmbientOcclusionEnabled() && p_renderModel_3_.getBlock().getLightValue() == 0 && p_renderModel_2_.isAmbientOcclusion() || Raven.moduleManager.getModuleByClazz(Xray.class).isEnabled(); | ||
|
||
try { | ||
Block block = p_renderModel_3_.getBlock(); | ||
return flag ? this.renderModelAmbientOcclusion(p_renderModel_1_, p_renderModel_2_, block, p_renderModel_4_, p_renderModel_5_, p_renderModel_6_) : this.renderModelStandard(p_renderModel_1_, p_renderModel_2_, block, p_renderModel_4_, p_renderModel_5_, p_renderModel_6_); | ||
} catch (Throwable var11) { | ||
CrashReport crashreport = CrashReport.makeCrashReport(var11, "Tesselating block model"); | ||
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block model being tesselated"); | ||
CrashReportCategory.addBlockInfo(crashreportcategory, p_renderModel_4_, p_renderModel_3_); | ||
crashreportcategory.addCrashSection("Using AO", flag); | ||
throw new ReportedException(crashreport); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ private String renderStringHook(String s) { | |
return s; | ||
} | ||
} | ||
} | ||
} | ||
|
66 changes: 66 additions & 0 deletions
66
src/main/java/me/pianopenguin471/mixins/WorldRendererMixin.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,66 @@ | ||
package me.pianopenguin471.mixins; | ||
|
||
import ravenweave.client.module.modules.render.Xray; | ||
import net.minecraft.client.renderer.WorldRenderer; | ||
import net.minecraft.util.MathHelper; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Overwrite; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import java.nio.ByteOrder; | ||
import java.nio.IntBuffer; | ||
import ravenweave.client.main.Raven; | ||
|
||
@Mixin(value = WorldRenderer.class, priority = 999) | ||
public abstract class WorldRendererMixin { | ||
|
||
@Shadow public abstract int getColorIndex(int p_getColorIndex_1_); | ||
|
||
@Shadow private boolean noColor; | ||
@Shadow private IntBuffer rawIntBuffer; | ||
|
||
/** | ||
* @author mc code | ||
* @reason aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
*/ | ||
@Overwrite | ||
public void putColorMultiplier(float p_putColorMultiplier_1_, float p_putColorMultiplier_2_, float p_putColorMultiplier_3_, int p_putColorMultiplier_4_) { | ||
int i = this.getColorIndex(p_putColorMultiplier_4_); | ||
int j = -1; | ||
|
||
if (!this.noColor) { | ||
j = this.rawIntBuffer.get(i); | ||
int k; | ||
int l; | ||
int i1; | ||
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) { | ||
k = (int) ((float) (j & 255) * p_putColorMultiplier_1_); | ||
l = (int) ((float) (j >> 8 & 255) * p_putColorMultiplier_2_); | ||
i1 = (int) ((float) (j >> 16 & 255) * p_putColorMultiplier_3_); | ||
j &= -16777216; | ||
j = j | i1 << 16 | l << 8 | k; | ||
} else { | ||
k = (int) ((float) (j >> 24 & 255) * p_putColorMultiplier_1_); | ||
l = (int) ((float) (j >> 16 & 255) * p_putColorMultiplier_2_); | ||
i1 = (int) ((float) (j >> 8 & 255) * p_putColorMultiplier_3_); | ||
j &= 255; | ||
j = j | k << 24 | l << 16 | i1 << 8; | ||
} | ||
|
||
if(Raven.moduleManager.getModuleByClazz(Xray.class).isEnabled()) { | ||
j = getColor(k, l, i1, (int) Xray.opacity.getInput()); | ||
} | ||
} | ||
|
||
this.rawIntBuffer.put(i, j); | ||
} | ||
|
||
public int getColor(int red, int green, int blue, int alpha) { | ||
int color = MathHelper.clamp_int(alpha, 0, 255) << 24; | ||
color |= MathHelper.clamp_int(red, 0, 255) << 16; | ||
color |= MathHelper.clamp_int(green, 0, 255) << 8; | ||
color |= MathHelper.clamp_int(blue, 0, 255); | ||
return color; | ||
} | ||
|
||
} |
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
Oops, something went wrong.