-
Notifications
You must be signed in to change notification settings - Fork 14
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
1 parent
e54f8d6
commit 4618c6b
Showing
6 changed files
with
128 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ classes | |
# gradle | ||
build | ||
.gradle | ||
libs | ||
|
||
#Netbeans | ||
.nb-gradle | ||
|
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
66 changes: 66 additions & 0 deletions
66
src/main/java/org/polyfrost/hytils/mixin/RenderingLivingEntityMixin_HideNametags.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 @@ | ||
/* | ||
* Hytils Reborn - Hypixel focused Quality of Life mod. | ||
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.polyfrost.hytils.mixin; | ||
|
||
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils; | ||
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo; | ||
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.entity.Render; | ||
import net.minecraft.client.renderer.entity.RenderManager; | ||
import net.minecraft.client.renderer.entity.RendererLivingEntity; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.util.ResourceLocation; | ||
import org.polyfrost.hytils.config.HytilsConfig; | ||
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; | ||
|
||
import static org.polyfrost.hytils.handlers.game.pit.PitLagReducer.pitSpawnPos; | ||
|
||
@Mixin(RendererLivingEntity.class) | ||
public class RenderingLivingEntityMixin_HideNametags<T extends EntityLivingBase> extends Render<T> { | ||
protected RenderingLivingEntityMixin_HideNametags(RenderManager renderManager) { | ||
super(renderManager); | ||
} | ||
|
||
protected ResourceLocation getEntityTexture(T entity) { | ||
return null; | ||
} | ||
|
||
@Inject(method = "renderName(Lnet/minecraft/entity/EntityLivingBase;DDD)V", at = @At("HEAD"), cancellable = true) | ||
private void hideNametag(T entity, double x, double y, double z, CallbackInfo ci) { | ||
if (!HypixelUtils.INSTANCE.isHypixel()) { | ||
return; | ||
} | ||
|
||
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); | ||
if (locraw == null || locraw.getGameType() != LocrawInfo.GameType.PIT) { | ||
return; | ||
} | ||
|
||
if (HytilsConfig.pitLagReducer) { | ||
// If the entity being rendered is at spawn, and you are below spawn, cancel the rendering. | ||
if (entity.posY > pitSpawnPos && Minecraft.getMinecraft().thePlayer.posY < pitSpawnPos) { | ||
ci.cancel(); | ||
} | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...ain/java/org/polyfrost/hytils/mixin/compat/AboveHeadRendererMixin_RemoveLevelheadPit.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,58 @@ | ||
/* | ||
* Hytils Reborn - Hypixel focused Quality of Life mod. | ||
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.polyfrost.hytils.mixin.compat; | ||
|
||
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils; | ||
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo; | ||
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil; | ||
import club.sk1er.mods.levelhead.render.AboveHeadRender; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraftforge.client.event.RenderLivingEvent; | ||
import org.polyfrost.hytils.config.HytilsConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import static org.polyfrost.hytils.handlers.game.pit.PitLagReducer.pitSpawnPos; | ||
|
||
@Pseudo | ||
@Mixin(value = AboveHeadRender.class, remap = false) | ||
public class AboveHeadRendererMixin_RemoveLevelheadPit { | ||
@Inject(method = "render(Lnet/minecraftforge/client/event/RenderLivingEvent$Specials$Post;)V", at = @At("HEAD"), cancellable = true) | ||
private void removeLevelhead(RenderLivingEvent.Specials.Post<EntityLivingBase> event, CallbackInfo ci) { | ||
if (!HypixelUtils.INSTANCE.isHypixel()) { | ||
return; | ||
} | ||
|
||
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo(); | ||
if (locraw == null || locraw.getGameType() != LocrawInfo.GameType.PIT) { | ||
return; | ||
} | ||
|
||
if (HytilsConfig.pitLagReducer) { | ||
// If the entity being rendered is at spawn, and you are below spawn, cancel the rendering. | ||
if (event.entity.posY > pitSpawnPos && Minecraft.getMinecraft().thePlayer.posY < pitSpawnPos) { | ||
ci.cancel(); | ||
} | ||
} | ||
} | ||
} |
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