mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 15:45:10 +00:00
Glow can be disabled/enabled on skin overlays
This commit is contained in:
1 parent
dbfbab7be2
commit
6f9358c1ca
9 files changed
+91
-20
No files matched your search
@@ -79,8 +79,9 @@ public class NoppesUtil {
|
||||
for (int i = 0; i < skinOverlayList.tagCount(); i++) {
|
||||
int tagID = skinOverlayList.getCompoundTagAt(i).getInteger("SkinOverlayID");
|
||||
String tagString = skinOverlayList.getCompoundTagAt(i).getString("SkinOverlayTexture");
|
||||
boolean glow = skinOverlayList.getCompoundTagAt(i).getBoolean("SkinOverlayGlow");
|
||||
|
||||
skinOverlays.put(tagID,new SkinOverlayData(new ResourceLocation(tagString)));
|
||||
skinOverlays.put(tagID,new SkinOverlayData(new ResourceLocation(tagString),glow));
|
||||
}
|
||||
Client.skinOverlays.put(player.getUniqueID(), skinOverlays);
|
||||
}
|
||||
|
||||
@@ -1,33 +1,34 @@
|
||||
package noppes.npcs.client.renderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class RenderCNPCPlayer extends RenderPlayer {
|
||||
|
||||
public RenderCNPCPlayer() {
|
||||
}
|
||||
|
||||
private boolean preRenderOverlay(EntityPlayer player, ResourceLocation overlayLocation) {
|
||||
private boolean preRenderOverlay(EntityPlayer player, ResourceLocation overlayLocation, boolean glow) {
|
||||
try {
|
||||
this.bindTexture(overlayLocation);
|
||||
} catch (Exception exception) {
|
||||
return false;
|
||||
}
|
||||
// Overlay & Glow
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
if (glow) {
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
|
||||
Minecraft.getMinecraft().entityRenderer.disableLightmap((double)0);
|
||||
}
|
||||
|
||||
GL11.glDepthMask(!player.isInvisible());
|
||||
|
||||
@@ -37,7 +38,7 @@ public class RenderCNPCPlayer extends RenderPlayer {
|
||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
float scale = 1.001f;
|
||||
float scale = 1.005f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
return true;
|
||||
@@ -49,10 +50,12 @@ public class RenderCNPCPlayer extends RenderPlayer {
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
Minecraft.getMinecraft().entityRenderer.enableLightmap((double)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +69,7 @@ public class RenderCNPCPlayer extends RenderPlayer {
|
||||
|
||||
if (Client.skinOverlays.containsKey(player.getUniqueID())) {
|
||||
for (SkinOverlayData overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
|
||||
if (!preRenderOverlay(player, overlayData.location))
|
||||
if (!preRenderOverlay(player, overlayData.location, overlayData.glow))
|
||||
return;
|
||||
this.mainModel.render(p_77036_1_, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, p_77036_7_);
|
||||
postRenderOverlay(player);
|
||||
@@ -105,7 +108,7 @@ public class RenderCNPCPlayer extends RenderPlayer {
|
||||
|
||||
if (Client.skinOverlays.containsKey(player.getUniqueID())) {
|
||||
for (SkinOverlayData overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
|
||||
if (!preRenderOverlay(player, overlayData.location))
|
||||
if (!preRenderOverlay(player, overlayData.location, overlayData.glow))
|
||||
return;
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
this.modelBipedMain.onGround = 0.0F;
|
||||
|
||||
@@ -230,6 +230,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Minecraft.getMinecraft().entityRenderer.disableLightmap((double)0);
|
||||
|
||||
GL11.glDepthMask(!npc.isInvisible());
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, npc.isInvisible() ? 0.2F : 1.0F);
|
||||
@@ -259,6 +260,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
Minecraft.getMinecraft().entityRenderer.enableLightmap((double)0);
|
||||
}
|
||||
|
||||
if (!npc.display.poweredTexture.isEmpty() && !npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
|
||||
@@ -280,6 +282,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
Minecraft.getMinecraft().entityRenderer.disableLightmap((double)0);
|
||||
|
||||
GL11.glDepthMask(!npc.isInvisible());
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, npc.isInvisible() ? 0.2F : 1.0F);
|
||||
@@ -311,6 +314,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, f1);
|
||||
GL11.glDepthFunc(GL11.GL_LEQUAL);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
Minecraft.getMinecraft().entityRenderer.enableLightmap((double)0);
|
||||
|
||||
npc.renderTicksPowered++;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SkinOverlayData {
|
||||
public ResourceLocation location;
|
||||
public boolean glow;
|
||||
|
||||
public SkinOverlayData(ResourceLocation location) {
|
||||
public SkinOverlayData(ResourceLocation location, boolean glow) {
|
||||
this.location = location;
|
||||
this.glow = glow;
|
||||
}
|
||||
}
|
||||
@@ -316,16 +316,14 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
return MinecraftServer.getServer().getTickCounter();
|
||||
}
|
||||
|
||||
public ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame) {
|
||||
return new ScriptGui(id, width, height, pauseGame);
|
||||
}
|
||||
|
||||
public boolean arePlayerScriptsEnabled() {
|
||||
return CustomNpcs.GlobalPlayerScripts;
|
||||
}
|
||||
|
||||
public boolean areForgeScriptsEnabled() {
|
||||
return CustomNpcs.GlobalForgeScripts;
|
||||
}
|
||||
|
||||
public boolean areGlobalNPCScriptsEnabled() {
|
||||
return CustomNpcs.GlobalNPCScripts;
|
||||
}
|
||||
@@ -333,14 +331,24 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
public void enablePlayerScripts(boolean enable) {
|
||||
CustomNpcs.GlobalPlayerScripts = enable;
|
||||
}
|
||||
|
||||
public void enableForgeScripts(boolean enable) {
|
||||
CustomNpcs.GlobalForgeScripts = enable;
|
||||
}
|
||||
|
||||
public void enableGlobalNPCScripts(boolean enable) {
|
||||
CustomNpcs.GlobalNPCScripts = enable;
|
||||
}
|
||||
|
||||
public ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame) {
|
||||
return new ScriptGui(id, width, height, pauseGame);
|
||||
}
|
||||
|
||||
public ICustomOverlay createCustomOverlay(int id) {
|
||||
return new ScriptOverlay(id);
|
||||
}
|
||||
|
||||
public ISkinOverlay createSkinOverlay(String texture) {
|
||||
return new ScriptSkinOverlay(texture);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.ISkinOverlay;
|
||||
|
||||
public class ScriptSkinOverlay implements ISkinOverlay {
|
||||
public String texture;
|
||||
public boolean glow;
|
||||
|
||||
public ScriptSkinOverlay(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public void setTexture(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
public String getTexture() {
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setGlow(boolean glow) {
|
||||
this.glow = glow;
|
||||
}
|
||||
public boolean getGlow() {
|
||||
return glow;
|
||||
}
|
||||
}
|
||||
@@ -527,13 +527,14 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.OVERLAY_CLOSE, id, new NBTTagCompound());
|
||||
}
|
||||
|
||||
public void addSkinOverlay(int id, String overlayString) {
|
||||
if (overlayString != null) {
|
||||
public void setSkinOverlay(int id, ScriptSkinOverlay overlay) {
|
||||
if (overlay != null) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
compound.setString("SkinOverlayTexture", overlayString);
|
||||
compound.setInteger("SkinOverlayID", id);
|
||||
compound.setString("SkinOverlayTexture", overlay.getTexture());
|
||||
compound.setBoolean("SkinOverlayGlow", overlay.getGlow());
|
||||
|
||||
if (!player.getEntityData().hasKey("SkinOverlayData")) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.scripted.gui.ScriptGui;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
@@ -122,7 +123,21 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract int getServerTime();
|
||||
|
||||
public abstract boolean arePlayerScriptsEnabled();
|
||||
|
||||
public abstract boolean areForgeScriptsEnabled();
|
||||
|
||||
public abstract boolean areGlobalNPCScriptsEnabled();
|
||||
|
||||
public abstract void enablePlayerScripts(boolean enable);
|
||||
|
||||
public abstract void enableForgeScripts(boolean enable);
|
||||
|
||||
public abstract void enableGlobalNPCScripts(boolean enable);
|
||||
|
||||
public abstract ICustomGui createCustomGui(int id, int width, int height, boolean pauseGame);
|
||||
|
||||
public abstract ICustomOverlay createCustomOverlay(int id);
|
||||
|
||||
public abstract ISkinOverlay createSkinOverlay(String texture);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
public interface ISkinOverlay {
|
||||
void setTexture(String texture);
|
||||
|
||||
String getTexture();
|
||||
|
||||
void setGlow(boolean glow);
|
||||
|
||||
boolean getGlow();
|
||||
}
|
||||
Reference in new issue
Block a user