mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 22:27:32 +00:00
Skip Tick 0 for Rendering
This commit is contained in:
1 parent
de92d57f13
commit
71dbf77def
9 files changed
+34
No files matched your search
@@ -27,6 +27,9 @@ public class RenderAbilityBeam extends RenderEnergyAbility {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
EntityAbilityBeam beam = (EntityAbilityBeam) entity;
|
||||
|
||||
setupRenderState();
|
||||
|
||||
@@ -17,6 +17,9 @@ public class RenderAbilityDisc extends RenderEnergyAbility {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
EntityAbilityDisc disc = (EntityAbilityDisc) entity;
|
||||
|
||||
setupRenderState();
|
||||
|
||||
@@ -17,6 +17,9 @@ public class RenderAbilityDome extends RenderEnergyBarrier {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
EntityAbilityDome dome = (EntityAbilityDome) entity;
|
||||
float radius = dome.getDomeRadius();
|
||||
float healthPercent = dome.getHealthPercent();
|
||||
|
||||
@@ -23,6 +23,9 @@ public class RenderAbilityLaser extends RenderEnergyAbility {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
EntityAbilityLaser laser = (EntityAbilityLaser) entity;
|
||||
|
||||
setupRenderState();
|
||||
|
||||
@@ -19,6 +19,10 @@ public class RenderAbilityOrb extends RenderEnergyAbility {
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
EntityAbilityOrb orb = (EntityAbilityOrb) entity;
|
||||
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupRenderState();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
@@ -17,6 +17,9 @@ public class RenderAbilityPanel extends RenderEnergyBarrier {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
EntityAbilityPanel panel = (EntityAbilityPanel) entity;
|
||||
|
||||
float width = panel.getPanelData().panelWidth;
|
||||
|
||||
@@ -22,11 +22,22 @@ import org.lwjgl.opengl.GL12;
|
||||
public abstract class RenderEnergyAbility extends Render {
|
||||
|
||||
protected static final ResourceLocation WHITE_TEXTURE = new ResourceLocation("customnpcs", "textures/entity/white.png");
|
||||
protected static final int HIDE_INITIAL_ACTIVE_TICKS = 1;
|
||||
|
||||
public RenderEnergyAbility() {
|
||||
this.shadowSize = 0.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the first active tick to avoid the visible spawn-frame pause at fire time.
|
||||
* Charging previews are never hidden.
|
||||
*/
|
||||
protected boolean shouldSkipInitialActiveRender(Entity entity) {
|
||||
if (!(entity instanceof EntityEnergyAbility)) return false;
|
||||
EntityEnergyAbility ability = (EntityEnergyAbility) entity;
|
||||
return !ability.isPreviewMode() && !ability.isCharging() && ability.ticksExisted <= HIDE_INITIAL_ACTIVE_TICKS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup GL state for translucent, self-illuminated rendering.
|
||||
* Forces full brightness so world lighting does not affect projectiles.
|
||||
|
||||
@@ -20,6 +20,7 @@ public class RenderEnergyExplosion extends RenderEnergyAbility {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) return;
|
||||
if (!(entity instanceof EntityEnergyExplosion)) return;
|
||||
if (ConfigClient.LowResExplosion) return;
|
||||
EntityEnergyExplosion explosion = (EntityEnergyExplosion) entity;
|
||||
|
||||
@@ -17,6 +17,9 @@ public class RenderEnergySlicer extends RenderEnergyAbility {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
if (shouldSkipInitialActiveRender(entity)) {
|
||||
return;
|
||||
}
|
||||
EntityEnergySlicer slicer = (EntityEnergySlicer) entity;
|
||||
|
||||
float width = slicer.getSliceWidth();
|
||||
|
||||
Reference in new issue
Block a user