mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Add config options for portal rendering
This commit is contained in:
parent
80500a74c8
commit
e385eb5640
3 changed files with 16 additions and 5 deletions
|
@ -45,6 +45,16 @@ public class Config extends com.minelittlepony.common.util.settings.Config {
|
||||||
.addComment("Removes butterflies from spawning in your world")
|
.addComment("Removes butterflies from spawning in your world")
|
||||||
.addComment("Turn this ON if you have another mod that adds butterflies.");
|
.addComment("Turn this ON if you have another mod that adds butterflies.");
|
||||||
|
|
||||||
|
public final Setting<Boolean> simplifiedPortals = value("compatibility", "simplifiedPortals", false)
|
||||||
|
.addComment("Disables dynamic portal rendering");
|
||||||
|
|
||||||
|
public final Setting<Long> fancyPortalRefreshRate = value("client", "fancyPortalRefreshRate", -1L)
|
||||||
|
.addComment("Sets the refresh rate of portals when using fancy portal rendering")
|
||||||
|
.addComment("Set to -1 (default) for unlimited");
|
||||||
|
|
||||||
|
public final Setting<Integer> maxPortalRecursion = value("client", "maxPortalRecursion", 2)
|
||||||
|
.addComment("Sets the maximum depth to reach when rendering portals through portals");
|
||||||
|
|
||||||
public Config() {
|
public Config() {
|
||||||
super(new HeirarchicalJsonConfigAdapter(new GsonBuilder()
|
super(new HeirarchicalJsonConfigAdapter(new GsonBuilder()
|
||||||
.registerTypeAdapter(Race.class, RegistryTypeAdapter.of(Race.REGISTRY))
|
.registerTypeAdapter(Race.class, RegistryTypeAdapter.of(Race.REGISTRY))
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.joml.Matrix4f;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.PortalSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.PortalSpell;
|
||||||
import com.minelittlepony.unicopia.client.render.RenderLayers;
|
import com.minelittlepony.unicopia.client.render.RenderLayers;
|
||||||
|
@ -115,11 +116,12 @@ class PortalFrameBuffer implements AutoCloseable {
|
||||||
|
|
||||||
public void build(PortalSpell spell, Caster<?> caster, EntityReference.EntityValues<Entity> target) {
|
public void build(PortalSpell spell, Caster<?> caster, EntityReference.EntityValues<Entity> target) {
|
||||||
|
|
||||||
if (framebuffer != null && System.currentTimeMillis() % 1 != 0) {
|
long refreshRate = Unicopia.getConfig().fancyPortalRefreshRate.get();
|
||||||
|
if (refreshRate > 0 && framebuffer != null && System.currentTimeMillis() % refreshRate != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pendingDraw && recursionCount > 2) {
|
if (pendingDraw && recursionCount > Math.max(0, Unicopia.getConfig().maxPortalRecursion.get())) {
|
||||||
innerBuild(spell, caster, target);
|
innerBuild(spell, caster, target);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.client.render.spell;
|
package com.minelittlepony.unicopia.client.render.spell;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.effect.PortalSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.effect.PortalSpell;
|
||||||
import com.minelittlepony.unicopia.client.render.RenderLayers;
|
import com.minelittlepony.unicopia.client.render.RenderLayers;
|
||||||
|
@ -14,8 +15,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.math.RotationAxis;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
|
|
||||||
public class PortalSpellRenderer extends SpellRenderer<PortalSpell> {
|
public class PortalSpellRenderer extends SpellRenderer<PortalSpell> {
|
||||||
static boolean FANCY_PORTAlS = true;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRenderEffectPass(int pass) {
|
public boolean shouldRenderEffectPass(int pass) {
|
||||||
return pass == 0;
|
return pass == 0;
|
||||||
|
@ -32,7 +31,7 @@ public class PortalSpellRenderer extends SpellRenderer<PortalSpell> {
|
||||||
SphereModel.DISK.render(matrices, buff, light, 0, 2F * strength, 1, 1, 1, 1);
|
SphereModel.DISK.render(matrices, buff, light, 0, 2F * strength, 1, 1, 1, 1);
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
|
|
||||||
if (!FANCY_PORTAlS || !spell.isLinked()) {
|
if (Unicopia.getConfig().simplifiedPortals.get() || !spell.isLinked()) {
|
||||||
matrices.push();
|
matrices.push();
|
||||||
matrices.translate(0, -0.02, 0);
|
matrices.translate(0, -0.02, 0);
|
||||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180));
|
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180));
|
||||||
|
|
Loading…
Reference in a new issue