mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-26 07:03:02 +00:00
fix starminer rotation & optimize starminer rotateCorpseByGravity (#2005)
* fix starminer rotation & optimize starminer rotateCorpseByGravity fixes #487 * remove Object[] allocation * add shared helper, fix NPEs, fallbacks
This commit is contained in:
1 parent
b17bb42c49
commit
6af401c834
5 files changed
+100
-37
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package com.gtnewhorizons.angelica.helpers;
|
||||
|
||||
import static com.gtnewhorizons.angelica.client.font.ColorCodeUtils.FORMATTING_CHAR;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public final class RendererLivingEntityHelper {
|
||||
|
||||
private RendererLivingEntityHelper() {}
|
||||
|
||||
public static String getUpsideDownName(EntityLivingBase entity) {
|
||||
if (entity instanceof EntityLiving living) {
|
||||
return living.hasCustomNameTag() ? entity.getCommandSenderName() : "";
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer player) {
|
||||
return player.getHideCape() ? "" : entity.getCommandSenderName();
|
||||
}
|
||||
|
||||
return entity.getCommandSenderName();
|
||||
}
|
||||
|
||||
public static String stripFormattingCodes(String entityName) {
|
||||
if (entityName == null || entityName.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return entityName.indexOf(FORMATTING_CHAR) < 0
|
||||
? entityName
|
||||
: EnumChatFormatting.getTextWithoutFormattingCodes(entityName);
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,12 @@ public enum Mixins implements IMixins {
|
||||
)
|
||||
),
|
||||
|
||||
STARMINER_RENDERER_LIVING_ENTITY_OPTIMIZATION(new MixinBuilder()
|
||||
.setPhase(Phase.LATE)
|
||||
.addRequiredMod(TargetedMod.STARMINER)
|
||||
.addClientMixins("client.starminer.MixinTransformClientHelper")
|
||||
),
|
||||
|
||||
ANGELICA_ENTITY_OVERLAYS(new MixinBuilder()
|
||||
.setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.entityOverlayFixes)
|
||||
|
||||
@@ -24,6 +24,7 @@ public enum TargetedMod implements ITargetMod {
|
||||
IC2("ic2.core.coremod.IC2core", "IC2"),
|
||||
NATURA(null, "Natura"),
|
||||
SECURITYCRAFT(null, "securitycraft"),
|
||||
STARMINER("jp.mc.ancientred.starminer.core.SMPlugin", "modJ_StarMiner"),
|
||||
SUPERNOVA("com.mitchej123.supernova.core.SupernovaCore", "supernova"),
|
||||
THAUMCRAFT(null, "Thaumcraft"),
|
||||
TINKERS_CONSTRUCT(null, "TConstruct"),
|
||||
|
||||
Reference in new issue
Block a user