creative no clip

This commit is contained in:
gnembon committed 2020-05-04 19:46:28 -03:00
1 parent ad43784ad6
commit 440dc6e2f4
5 files changed
+117 -2

No files matched your search

@@ -0,0 +1,19 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(WorldRenderer.class)
public class WorldRenderer_creativeNoClipMixin
{
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isSpectator()Z"))
private boolean canSeeWorld(ClientPlayerEntity clientPlayerEntity)
{
return clientPlayerEntity.isSpectator() || (CarpetSettings.creativeNoClip && clientPlayerEntity.isCreative());
}
}