Search in sources :

Example 16 with PlayerPointer

use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.

the class PaintingHelper method getLocalPlayersHairColour.

@SideOnly(Side.CLIENT)
public static int getLocalPlayersHairColour() {
    PlayerPointer playerPointer = new PlayerPointer(Minecraft.getMinecraft().thePlayer);
    EquipmentWardrobeData ewd = ClientProxy.equipmentWardrobeHandler.getEquipmentWardrobeData(playerPointer);
    if (ewd != null) {
        return ewd.hairColour;
    }
    return Color.decode("#804020").getRGB();
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) EquipmentWardrobeData(riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 17 with PlayerPointer

use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.

the class SkinModelRenderer method getPlayerExtraColours.

public byte[] getPlayerExtraColours(Entity entity) {
    if (!(entity instanceof AbstractClientPlayer)) {
        return null;
    }
    AbstractClientPlayer player = (AbstractClientPlayer) entity;
    EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
    return null;
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) EntityEquipmentData(riskyken.armourersWorkshop.common.skin.EntityEquipmentData) PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer)

Example 18 with PlayerPointer

use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.

the class EquipmentRenderHandler method isArmourRenderOverridden.

@Override
public boolean isArmourRenderOverridden(EntityPlayer player, int slotId) {
    if (slotId < 4 & slotId >= 0) {
        return false;
    }
    if (player == null) {
        return false;
    }
    EquipmentWardrobeHandler ewh = ClientProxy.equipmentWardrobeHandler;
    EquipmentWardrobeData ewd = ewh.getEquipmentWardrobeData(new PlayerPointer(player));
    if (ewd != null) {
        return ewd.armourOverride.get(slotId);
    }
    return false;
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) EquipmentWardrobeData(riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData)

Example 19 with PlayerPointer

use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.

the class EquipmentWardrobeHandler method onRender.

@SubscribeEvent
public void onRender(RenderPlayerEvent.Post event) {
    EntityPlayer player = event.entityPlayer;
    if (player instanceof MannequinFakePlayer) {
        return;
    }
    if (player.getGameProfile() == null) {
        return;
    }
    if (player instanceof FakePlayer) {
        return;
    }
    // Restore the head overlay.
    PlayerPointer playerPointer = new PlayerPointer(player);
    RenderPlayer renderer = event.renderer;
    if (equipmentWardrobeMap.containsKey(playerPointer)) {
        renderer.modelBipedMain.bipedHeadwear.isHidden = false;
    }
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) EntityPlayer(net.minecraft.entity.player.EntityPlayer) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) FakePlayer(net.minecraftforge.common.util.FakePlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Example 20 with PlayerPointer

use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.

the class EquipmentWardrobeHandler method onRender.

@SubscribeEvent(priority = EventPriority.HIGH)
public void onRender(RenderPlayerEvent.SetArmorModel event) {
    int slot = -event.slot + 3;
    if (slot > 3) {
        return;
    }
    EntityPlayer player = event.entityPlayer;
    if (player instanceof MannequinFakePlayer) {
        return;
    }
    if (player.getGameProfile() == null) {
        return;
    }
    if (player instanceof FakePlayer) {
        return;
    }
    int result = -1;
    // Hide the armour if it had been skinned.
    ItemStack stack = player.getCurrentArmor(event.slot);
    if (SkinNBTHelper.stackHasSkinData(stack)) {
        result = -2;
    }
    // Hide the armour if the player has turned it off.
    PlayerPointer playerPointer = new PlayerPointer(player);
    if (equipmentWardrobeMap.containsKey(playerPointer)) {
        EquipmentWardrobeData ewd = equipmentWardrobeMap.get(playerPointer);
        if (ewd.armourOverride.get(slot)) {
            result = -2;
        }
    }
    event.result = result;
}
Also used : PlayerPointer(riskyken.armourersWorkshop.common.data.PlayerPointer) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) EquipmentWardrobeData(riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) MannequinFakePlayer(riskyken.armourersWorkshop.client.render.MannequinFakePlayer) FakePlayer(net.minecraftforge.common.util.FakePlayer) SubscribeEvent(cpw.mods.fml.common.eventhandler.SubscribeEvent)

Aggregations

PlayerPointer (riskyken.armourersWorkshop.common.data.PlayerPointer)24 EquipmentWardrobeData (riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData)11 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)8 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 MannequinFakePlayer (riskyken.armourersWorkshop.client.render.MannequinFakePlayer)6 ISkinDye (riskyken.armourersWorkshop.api.common.skin.data.ISkinDye)4 EntityEquipmentData (riskyken.armourersWorkshop.common.skin.EntityEquipmentData)4 RenderPlayer (net.minecraft.client.renderer.entity.RenderPlayer)3 ItemStack (net.minecraft.item.ItemStack)3 FakePlayer (net.minecraftforge.common.util.FakePlayer)3 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)3 TargetPoint (cpw.mods.fml.common.network.NetworkRegistry.TargetPoint)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 Color (java.awt.Color)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 ISkinPointer (riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer)2 EntityTextureInfo (riskyken.armourersWorkshop.client.render.EntityTextureInfo)2 MessageServerSkinInfoUpdate (riskyken.armourersWorkshop.common.network.messages.server.MessageServerSkinInfoUpdate)2 MessageServerSkinWardrobeUpdate (riskyken.armourersWorkshop.common.network.messages.server.MessageServerSkinWardrobeUpdate)2