use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class SkinModelRenderer method onRenderSpecialsPost.
@SubscribeEvent
public void onRenderSpecialsPost(RenderPlayerEvent.Specials.Post event) {
if (ClientProxy.getSkinRenderType() != SkinRenderType.RENDER_EVENT) {
return;
}
EntityPlayer player = event.entityPlayer;
RenderPlayer render = event.renderer;
if (player.getGameProfile() == null) {
return;
}
PlayerPointer playerPointer = new PlayerPointer(player);
if (!playerEquipmentMap.containsKey(playerPointer)) {
return;
}
double distance = Minecraft.getMinecraft().thePlayer.getDistance(player.posX, player.posY, player.posZ);
if (distance > ConfigHandlerClient.maxSkinRenderDistance) {
return;
}
EquipmentWardrobeData ewd = ClientProxy.equipmentWardrobeHandler.getEquipmentWardrobeData(new PlayerPointer(player));
byte[] extraColours = null;
if (ewd != null) {
Color skinColour = new Color(ewd.skinColour);
Color hairColour = new Color(ewd.hairColour);
extraColours = new byte[] { (byte) skinColour.getRed(), (byte) skinColour.getGreen(), (byte) skinColour.getBlue(), (byte) hairColour.getRed(), (byte) hairColour.getGreen(), (byte) hairColour.getBlue() };
}
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
for (int slot = 0; slot < 4; slot++) {
for (int skinIndex = 0; skinIndex < ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE; skinIndex++) {
if (slot == SkinTypeRegistry.skinHead.getVanillaArmourSlotId()) {
Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinHead, skinIndex);
ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinHead, skinIndex);
if (data != null) {
customHead.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
}
}
if (slot == SkinTypeRegistry.skinChest.getVanillaArmourSlotId()) {
Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinChest, skinIndex);
ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinChest, skinIndex);
if (data != null) {
customChest.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
}
}
if (slot == SkinTypeRegistry.skinLegs.getVanillaArmourSlotId()) {
Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinLegs, skinIndex);
ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinLegs, skinIndex);
if (data != null) {
customLegs.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
}
}
if (slot == SkinTypeRegistry.skinSkirt.getVanillaArmourSlotId()) {
Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinSkirt, skinIndex);
ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinSkirt, skinIndex);
if (data != null) {
customSkirt.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
}
}
if (slot == SkinTypeRegistry.skinFeet.getVanillaArmourSlotId()) {
Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinFeet, skinIndex);
ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinFeet, skinIndex);
if (data != null) {
customFeet.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
}
}
if (slot == 0) {
Skin data = getPlayerCustomArmour(player, SkinTypeRegistry.skinWings, skinIndex);
ISkinDye dye = getPlayerDyeData(player, SkinTypeRegistry.skinWings, skinIndex);
if (data != null) {
customWings.render(player, render.modelBipedMain, data, false, dye, extraColours, false, distance, true);
}
}
}
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class SkinModelRenderer method renderEquipmentPartFromStack.
public boolean renderEquipmentPartFromStack(Entity entity, ItemStack stack, ModelBiped modelBiped, byte[] extraColours, double distance, boolean doLodLoading) {
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
if (skinPointer == null) {
return false;
}
Skin data = getCustomArmourItemData(skinPointer);
return renderEquipmentPart(entity, modelBiped, data, skinPointer.getSkinDye(), extraColours, distance, doLodLoading);
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class RenderSkinnedArrow method doRender.
@Override
public void doRender(EntityArrow entityArrow, double x, double y, double z, float yaw, float partialTickTime) {
if (entityArrow.shootingEntity != null && entityArrow.shootingEntity instanceof EntityClientPlayerMP) {
EntityClientPlayerMP player = (EntityClientPlayerMP) entityArrow.shootingEntity;
IEntityEquipment entityEquipment = equipmentModelRenderer.getPlayerCustomEquipmentData(player);
if (entityEquipment != null && entityEquipment.haveEquipment(SkinTypeRegistry.skinBow, 0)) {
ISkinPointer skinPointer = entityEquipment.getSkinPointer(SkinTypeRegistry.skinBow, 0);
if (ClientSkinCache.INSTANCE.isSkinInCache(skinPointer)) {
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
if (skin != null) {
SkinPart skinPart = skin.getPart("armourers:bow.arrow");
if (skinPart != null) {
ModRenderHelper.enableAlphaBlend();
renderArrowSkin(entityArrow, x, y, z, partialTickTime, skinPart, skinPointer.getSkinDye());
ModRenderHelper.disableAlphaBlend();
return;
}
}
} else {
ClientSkinCache.INSTANCE.requestSkinFromServer(skinPointer);
}
}
}
super.doRender(entityArrow, x, y, z, yaw, partialTickTime);
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class SkinnableEntityChickenRenderer method renderEquipmentType.
private void renderEquipmentType(EntityLivingBase entity, RendererLivingEntity renderer, ISkinType skinType, IEntityEquipment equipmentData) {
if (equipmentData.haveEquipment(skinType, 0)) {
ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, 0);
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
if (skin == null) {
return;
}
GL11.glEnable(GL11.GL_NORMALIZE);
float scale = 1F / 16F;
for (int i = 0; i < skin.getParts().size(); i++) {
SkinPartRenderer.INSTANCE.renderPart(skin.getParts().get(i), scale, skinPointer.getSkinDye(), null, false);
}
GL11.glDisable(GL11.GL_NORMALIZE);
}
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class PlayerTextureHandler method onRender.
@SubscribeEvent(priority = EventPriority.LOW)
public void onRender(RenderPlayerEvent.Pre event) {
useTexturePainting = ClientProxy.useTexturePainting();
if (!useTexturePainting) {
return;
}
if (!(event.entityPlayer instanceof AbstractClientPlayer)) {
return;
}
AbstractClientPlayer player = (AbstractClientPlayer) event.entityPlayer;
if (player instanceof MannequinFakePlayer) {
return;
}
if (player.getGameProfile() == null) {
return;
}
PlayerPointer playerPointer = new PlayerPointer(player);
EquipmentWardrobeData ewd = ClientProxy.equipmentWardrobeHandler.getEquipmentWardrobeData(playerPointer);
if (ewd == null) {
return;
}
profiler.startSection("textureBuild");
if (playerTextureMap.containsKey(playerPointer)) {
EntityTextureInfo textureInfo = playerTextureMap.get(playerPointer);
textureInfo.updateTexture(player.getLocationSkin());
textureInfo.updateHairColour(ewd.hairColour);
textureInfo.updateSkinColour(ewd.skinColour);
Skin[] skins = new Skin[4 * ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE];
for (int skinIndex = 0; skinIndex < ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE; skinIndex++) {
skins[0 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerCustomArmour(player, SkinTypeRegistry.skinHead, skinIndex);
skins[1 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerCustomArmour(player, SkinTypeRegistry.skinChest, skinIndex);
skins[2 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerCustomArmour(player, SkinTypeRegistry.skinLegs, skinIndex);
skins[3 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerCustomArmour(player, SkinTypeRegistry.skinFeet, skinIndex);
}
ISkinDye[] dyes = new ISkinDye[4 * ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE];
for (int skinIndex = 0; skinIndex < ExPropsPlayerSkinData.MAX_SLOTS_PER_SKIN_TYPE; skinIndex++) {
dyes[0 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerDyeData(player, SkinTypeRegistry.skinHead, skinIndex);
dyes[1 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerDyeData(player, SkinTypeRegistry.skinChest, skinIndex);
dyes[2 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerDyeData(player, SkinTypeRegistry.skinLegs, skinIndex);
dyes[3 + skinIndex * 4] = SkinModelRenderer.INSTANCE.getPlayerDyeData(player, SkinTypeRegistry.skinFeet, skinIndex);
}
textureInfo.updateSkins(skins);
textureInfo.updateDyes(dyes);
ResourceLocation replacmentTexture = textureInfo.preRender();
player.func_152121_a(Type.SKIN, replacmentTexture);
}
profiler.endSection();
}
Aggregations