mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 12:42:19 +00:00
Create Barrier Abilities + Heavy Refactoring
This commit is contained in:
1 parent
d1f2c9695c
commit
c07e9e7006
53 files changed
+1890
-1460
No files matched your search
@@ -2,7 +2,6 @@ package kamkeel.npcs.client.renderer;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.client.renderer.lightning.AttachedLightningRenderer;
|
||||
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -14,7 +13,7 @@ import org.lwjgl.opengl.GL11;
|
||||
* Design inspired by LouisXIV's energy rendering system.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderAbilityDisc extends RenderAbilityProjectile {
|
||||
public class RenderAbilityDisc extends RenderEnergyAbility {
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTicks) {
|
||||
@@ -37,7 +36,7 @@ public class RenderAbilityDisc extends RenderAbilityProjectile {
|
||||
|
||||
// Render lightning BEFORE rotation so it crackles in all directions
|
||||
if (disc.hasLightningEffect()) {
|
||||
renderAttachedLightning(disc, radius * scale);
|
||||
renderAttachedLightning(disc, 0.6f * 0.5f, radius * scale);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -76,34 +75,6 @@ public class RenderAbilityDisc extends RenderAbilityProjectile {
|
||||
restoreRenderState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render fading lightning arcs attached to the disc (in local space).
|
||||
*/
|
||||
private void renderAttachedLightning(EntityAbilityDisc disc, float discSize) {
|
||||
AttachedLightningRenderer.LightningState state = getLightningState(disc);
|
||||
|
||||
float density = disc.getLightningDensity();
|
||||
// Lightning radius extends outward from inner surface (innerScale = 0.6)
|
||||
float innerRadius = 0.6f * discSize * 0.5f;
|
||||
float radius = innerRadius + disc.getLightningRadius() * discSize;
|
||||
int outerColor = disc.getOuterColor();
|
||||
int innerColor = disc.getInnerColor();
|
||||
int fadeTime = disc.getLightningFadeTime();
|
||||
|
||||
state.update(density, radius, outerColor, innerColor, fadeTime);
|
||||
state.render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create the lightning state for an entity.
|
||||
*/
|
||||
private AttachedLightningRenderer.LightningState getLightningState(EntityAbilityDisc disc) {
|
||||
if (disc.lightningState == null) {
|
||||
disc.lightningState = new AttachedLightningRenderer.LightningState();
|
||||
}
|
||||
return (AttachedLightningRenderer.LightningState) disc.lightningState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a flat square (thin cube) centered at origin.
|
||||
* The square lies flat on the XZ plane with thin Y height.
|
||||
|
||||
Reference in new issue
Block a user