use of riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer in project Armourers-Workshop by RiskyKen.
the class SkinModelRenderer method getPlayerCustomArmour.
public Skin getPlayerCustomArmour(Entity entity, ISkinType skinType, int slotIndex) {
if (!(entity instanceof AbstractClientPlayer)) {
return null;
}
AbstractClientPlayer player = (AbstractClientPlayer) entity;
EntityEquipmentData equipmentData = playerEquipmentMap.get(new PlayerPointer(player));
// Look for skinned armourer.
if (skinType.getVanillaArmourSlotId() >= 0 && skinType.getVanillaArmourSlotId() < 4 && slotIndex == 0) {
int slot = 3 - skinType.getVanillaArmourSlotId();
ItemStack armourStack = player.getCurrentArmor(slot);
if (SkinNBTHelper.stackHasSkinData(armourStack)) {
SkinPointer sp = SkinNBTHelper.getSkinPointerFromStack(armourStack);
return getCustomArmourItemData(sp);
}
}
// No skinned armour found checking the equipment wardrobe.
if (equipmentData == null) {
return null;
}
if (!equipmentData.haveEquipment(skinType, slotIndex)) {
return null;
}
ISkinPointer skinPointer = equipmentData.getSkinPointer(skinType, slotIndex);
return getCustomArmourItemData(skinPointer);
}
use of riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer 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.api.common.skin.data.ISkinPointer 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.api.common.skin.data.ISkinPointer in project Armourers-Workshop by RiskyKen.
the class BlockHighlightRenderHandler method onDrawBlockHighlightEvent.
@SubscribeEvent
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
EntityPlayer player = event.player;
World world = event.player.worldObj;
MovingObjectPosition target = event.target;
if (target != null && target.typeOfHit != MovingObjectType.BLOCK) {
return;
}
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
int side = target.sideHit;
Block block = world.getBlock(x, y, z);
if (block == ModBlocks.mannequin) {
drawMannequinBlockBounds(world, x, y, z, player, block, event.partialTicks);
event.setCanceled(true);
}
if (event.currentItem != null && event.currentItem.getItem() == ModItems.equipmentSkin) {
ISkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(event.currentItem);
ForgeDirection sideDir = ForgeDirection.getOrientation(side);
if (skinPointer != null && skinPointer.getIdentifier().getSkinType() == SkinTypeRegistry.skinBlock) {
x += sideDir.offsetX;
y += sideDir.offsetY;
z += sideDir.offsetZ;
drawSkinnableBlockHelper(world, x, y, z, side, player, event.partialTicks, skinPointer);
}
}
}
use of riskyken.armourersWorkshop.api.common.skin.data.ISkinPointer in project Armourers-Workshop by RiskyKen.
the class SkinnableEntitySlimeRenderer 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);
}
}
Aggregations