-
Notifications
You must be signed in to change notification settings - Fork 38
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
7 changed files
with
111 additions
and
0 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
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
48 changes: 48 additions & 0 deletions
48
src/main/java/mod/acgaming/universaltweaks/tweaks/world/voidfog/mixin/UTVoidFogMixin.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,48 @@ | ||
package mod.acgaming.universaltweaks.tweaks.world.voidfog.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.EntityRenderer; | ||
import net.minecraft.world.WorldType; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(EntityRenderer.class) | ||
public abstract class UTVoidFogMixin | ||
{ | ||
@Shadow @Final private Minecraft mc; | ||
|
||
@Inject(method = "setupFog", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;setFog(Lnet/minecraft/client/renderer/GlStateManager$FogMode;)V", ordinal = 4)) | ||
public void utVoidFog(int startCoords, float partialTicks, CallbackInfo ci, @Local(ordinal = 2) LocalFloatRef f1) | ||
{ | ||
if (this.mc.world.provider.getDimension() != 0 || this.mc.world.getWorldInfo().getTerrainType() == WorldType.FLAT || this.mc.player.isCreative() || this.mc.player.isSpectator()) return; | ||
|
||
double d0 = (double) ((this.mc.getRenderViewEntity().getBrightnessForRender() & 15728640) >> 20) / 16.0D + (this.mc.getRenderViewEntity().lastTickPosY + (this.mc.getRenderViewEntity().posY - this.mc.getRenderViewEntity().lastTickPosY) * (double) partialTicks + 4.0D) / 32.0D; | ||
|
||
if (d0 < 1.0D) | ||
{ | ||
if (d0 < 0.0D) | ||
{ | ||
d0 = 0.0D; | ||
} | ||
|
||
d0 *= d0; | ||
float f2 = 100.0F * (float) d0; | ||
|
||
if (f2 < 5.0F) | ||
{ | ||
f2 = 5.0F; | ||
} | ||
|
||
if (f1.get() > f2) | ||
{ | ||
f1.set(f2); | ||
} | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...java/mod/acgaming/universaltweaks/tweaks/world/voidfog/mixin/UTVoidFogParticlesMixin.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,48 @@ | ||
package mod.acgaming.universaltweaks.tweaks.world.voidfog.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.multiplayer.WorldClient; | ||
import net.minecraft.profiler.Profiler; | ||
import net.minecraft.util.EnumParticleTypes; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldProvider; | ||
import net.minecraft.world.storage.ISaveHandler; | ||
import net.minecraft.world.storage.WorldInfo; | ||
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(WorldClient.class) | ||
public abstract class UTVoidFogParticlesMixin extends World | ||
{ | ||
protected UTVoidFogParticlesMixin(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client) | ||
{ | ||
super(saveHandlerIn, info, providerIn, profilerIn, client); | ||
} | ||
|
||
@Inject(method = "doVoidFogParticles", at = @At("TAIL")) | ||
public void utVoidFogParticles(int posX, int posY, int posZ, CallbackInfo ci, @Local BlockPos.MutableBlockPos mutableBlockPos) | ||
{ | ||
if (posY > 8) return; | ||
|
||
byte b0 = 16; | ||
|
||
for (int l = 0; l < 1000; ++l) | ||
{ | ||
int i1 = MathHelper.floor(posX) + this.rand.nextInt(b0) - this.rand.nextInt(b0); | ||
int j1 = MathHelper.floor(posY) + this.rand.nextInt(b0) - this.rand.nextInt(b0); | ||
int k1 = MathHelper.floor(posZ) + this.rand.nextInt(b0) - this.rand.nextInt(b0); | ||
IBlockState blockState = this.getBlockState(mutableBlockPos); | ||
|
||
if (blockState.getMaterial() == Material.AIR && this.rand.nextInt(8) > j1) | ||
{ | ||
this.spawnParticle(EnumParticleTypes.SUSPENDED_DEPTH, (float) i1 + this.rand.nextFloat(), (float) j1 + this.rand.nextFloat(), (float) k1 + this.rand.nextFloat(), 0.0D, 0.0D, 0.0D); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.tweaks.world.voidfog.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": ["UTVoidFogMixin", "UTVoidFogParticlesMixin"] | ||
} |