Added a config option to disable player rendering

Closes #106
This commit is contained in:
Ellpeck 2020-04-27 22:24:02 +02:00
parent 2915ce494d
commit 2d370c44b8
2 changed files with 8 additions and 0 deletions

View file

@ -48,6 +48,7 @@ public final class ModConfig {
public ForgeConfigSpec.ConfigValue<Integer> cacheBarLocation; public ForgeConfigSpec.ConfigValue<Integer> cacheBarLocation;
public ForgeConfigSpec.ConfigValue<Boolean> debugText; public ForgeConfigSpec.ConfigValue<Boolean> debugText;
public ForgeConfigSpec.ConfigValue<Boolean> debugWorld; public ForgeConfigSpec.ConfigValue<Boolean> debugWorld;
public ForgeConfigSpec.ConfigValue<Boolean> renderItemsOnPlayer;
public ModConfig(ForgeConfigSpec.Builder builder) { public ModConfig(ForgeConfigSpec.Builder builder) {
builder.push("general"); builder.push("general");
@ -161,6 +162,10 @@ public final class ModConfig {
.comment("If, when the F3 debug menu is open and the player is in creative mode, every Aura spot should be highlighted in the world for debug purposes") .comment("If, when the F3 debug menu is open and the player is in creative mode, every Aura spot should be highlighted in the world for debug purposes")
.translation("config." + NaturesAura.MOD_ID + ".debugWorld") .translation("config." + NaturesAura.MOD_ID + ".debugWorld")
.define("debugWorld", false); .define("debugWorld", false);
this.renderItemsOnPlayer = builder
.comment("If certain equippable items, like the Environmental Eye, should be rendered on the player")
.translation("config." + NaturesAura.MOD_ID + ".renderItemsOnPlayer")
.define("renderItemsOnPlayer", true);
builder.pop(); builder.pop();
} }

View file

@ -1,6 +1,7 @@
package de.ellpeck.naturesaura.renderers; package de.ellpeck.naturesaura.renderers;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import de.ellpeck.naturesaura.ModConfig;
import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem;
import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType; import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType;
import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.compat.Compat;
@ -35,6 +36,8 @@ public class PlayerLayerTrinkets extends LayerRenderer<AbstractClientPlayerEntit
@Override @Override
public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { public void render(MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, AbstractClientPlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) {
if (!ModConfig.instance.renderItemsOnPlayer.get())
return;
if (player.getActivePotionEffect(Effects.INVISIBILITY) != null) if (player.getActivePotionEffect(Effects.INVISIBILITY) != null)
return; return;
ItemStack main = player.getHeldItemMainhand(); ItemStack main = player.getHeldItemMainhand();