use of riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData in project Armourers-Workshop by RiskyKen.
the class GuiTabWardrobeColourSettings method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
if (button == selectSkinButton) {
selectingSkinColour = true;
}
if (button == selectHairButton) {
selectingHairColour = true;
}
if (button == autoSkinButton) {
int newSkinColour = equipmentWardrobeData.autoColourSkin((AbstractClientPlayer) this.entityPlayer);
EquipmentWardrobeData ewd = new EquipmentWardrobeData(this.equipmentWardrobeData);
ewd.skinColour = newSkinColour;
PacketHandler.networkWrapper.sendToServer(new MessageClientSkinWardrobeUpdate(ewd));
}
if (button == autoHairButton) {
int newHairColour = equipmentWardrobeData.autoColourHair((AbstractClientPlayer) this.entityPlayer);
EquipmentWardrobeData ewd = new EquipmentWardrobeData(this.equipmentWardrobeData);
ewd.hairColour = newHairColour;
PacketHandler.networkWrapper.sendToServer(new MessageClientSkinWardrobeUpdate(ewd));
}
}
use of riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData in project Armourers-Workshop by RiskyKen.
the class SkinModelRenderer method onRender.
@SubscribeEvent
public void onRender(RenderPlayerEvent.Pre event) {
EntityPlayer player = event.entityPlayer;
targetPlayer = player;
if (ClientProxy.getSkinRenderType() == SkinRenderType.MODEL_ATTACHMENT) {
attachModelsToBiped(event.renderer.modelBipedMain, event.renderer);
}
if (player.getGameProfile() == null) {
return;
}
PlayerPointer playerPointer = new PlayerPointer(player);
// A proper lady should not swing her legs around!
if (isPlayerWearingSkirt(playerPointer)) {
EquipmentWardrobeData ewd = ClientProxy.equipmentWardrobeHandler.getEquipmentWardrobeData(playerPointer);
if (ewd != null && ewd.limitLimbs) {
if (player.limbSwingAmount > 0.25F) {
player.limbSwingAmount = 0.25F;
player.prevLimbSwingAmount = 0.25F;
}
}
}
}
use of riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData 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.EquipmentWardrobeData 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();
}
use of riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData in project Armourers-Workshop by RiskyKen.
the class PlayerTextureHandler method onRender.
@SubscribeEvent(priority = EventPriority.HIGH)
public void onRender(RenderPlayerEvent.Post event) {
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("textureReset");
if (playerTextureMap.containsKey(playerPointer)) {
EntityTextureInfo textureInfo = playerTextureMap.get(playerPointer);
ResourceLocation replacmentTexture = textureInfo.postRender();
player.func_152121_a(Type.SKIN, replacmentTexture);
} else {
playerTextureMap.put(playerPointer, new EntityTextureInfo());
}
profiler.endSection();
}
Aggregations