use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.
the class EquipmentWardrobeHandler method setEquipmentWardrobeData.
public void setEquipmentWardrobeData(PlayerPointer playerPointer, EquipmentWardrobeData ewd) {
synchronized (threadLock) {
if (equipmentWardrobeMap.containsKey(playerPointer)) {
equipmentWardrobeMap.remove(playerPointer);
}
equipmentWardrobeMap.put(playerPointer, ewd);
}
EntityPlayer localPlayer = Minecraft.getMinecraft().thePlayer;
PlayerPointer localPointer = new PlayerPointer(localPlayer);
if (playerPointer.equals(localPointer)) {
ExPropsPlayerSkinData.get(localPlayer).setSkinInfo(ewd, false);
}
}
use of riskyken.armourersWorkshop.common.data.PlayerPointer 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.data.PlayerPointer 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();
}
use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.
the class EntityEquipmentDataManager method onStopTracking.
@SubscribeEvent
public void onStopTracking(PlayerEvent.StopTracking event) {
if (event.target instanceof EntityPlayerMP) {
EntityPlayerMP target = (EntityPlayerMP) event.target;
MessageServerPlayerLeftTrackingRange message = new MessageServerPlayerLeftTrackingRange(new PlayerPointer(target));
PacketHandler.networkWrapper.sendTo(message, (EntityPlayerMP) event.entityPlayer);
}
}
use of riskyken.armourersWorkshop.common.data.PlayerPointer in project Armourers-Workshop by RiskyKen.
the class ExPropsPlayerSkinData method checkAndSendCustomArmourDataTo.
private void checkAndSendCustomArmourDataTo(EntityPlayerMP targetPlayer) {
PlayerPointer playerPointer = new PlayerPointer(player);
PacketHandler.networkWrapper.sendTo(new MessageServerSkinInfoUpdate(playerPointer, equipmentData), targetPlayer);
}
Aggregations