use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class SkinCacheLocalFile method doSkinLoading.
public void doSkinLoading() {
synchronized (cacheMapLock) {
synchronized (skinLoadQueueLock) {
if (skinLoadQueue.size() > 0) {
SkinRequestMessage requestMessage = skinLoadQueue.get(0);
Skin skin = load(requestMessage.getSkinIdentifier());
if (skin != null) {
CommonSkinCache.INSTANCE.onSkinLoaded(skin, requestMessage);
}
skinLoadQueue.remove(0);
}
}
}
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class RenderBlockHologramProjector method renderTileEntityAt.
public void renderTileEntityAt(TileEntityHologramProjector tileEntity, double x, double y, double z, float partialTickTime) {
if (tileEntity.getPowerMode() != PowerMode.IGNORED) {
if (tileEntity.getPowerMode() == PowerMode.HIGH) {
if (!tileEntity.isPowered()) {
return;
}
} else {
if (tileEntity.isPowered()) {
return;
}
}
}
ItemStack itemStack = tileEntity.getStackInSlot(0);
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(itemStack);
if (skinPointer == null) {
return;
}
int rot = tileEntity.getBlockMetadata();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glTranslated(x + 0.5F, y + 0.5D, z + 0.5F);
GL11.glRotatef(180, 0, 0, 1);
if (rot == 1) {
GL11.glRotatef(180, 0, 0, 1);
}
if (rot == 2) {
GL11.glRotatef(90, -1, 0, 0);
}
if (rot == 3) {
GL11.glRotatef(90, 1, 0, 0);
}
if (rot == 4) {
GL11.glRotatef(90, 0, 0, -1);
}
if (rot == 5) {
GL11.glRotatef(90, 0, 0, 1);
}
float scale = 0.0625F;
GL11.glTranslated(tileEntity.getOffsetX() * scale, tileEntity.getOffsetY() * scale, tileEntity.getOffsetZ() * scale);
GL11.glScalef(-1, -1, 1);
int speedX = tileEntity.getRotationSpeedX();
int speedY = tileEntity.getRotationSpeedY();
int speedZ = tileEntity.getRotationSpeedZ();
float angleX = 0;
float angleY = 0;
float angleZ = 0;
if (speedX != 0) {
angleX = (System.currentTimeMillis() % speedX);
angleX = angleX / speedX * 360F;
}
if (speedY != 0) {
angleY = (System.currentTimeMillis() % speedY);
angleY = angleY / speedY * 360F;
}
if (speedZ != 0) {
angleZ = (System.currentTimeMillis() % speedZ);
angleZ = angleZ / speedZ * 360F;
}
if (!tileEntity.isGlowing()) {
ForgeDirection dir = ForgeDirection.getOrientation(tileEntity.getBlockMetadata());
float xLight = tileEntity.xCoord;
float yLight = tileEntity.yCoord;
float zLight = tileEntity.zCoord;
float offsetX = tileEntity.getOffsetX();
float offsetY = tileEntity.getOffsetY();
float offsetZ = tileEntity.getOffsetZ();
switch(dir) {
case UP:
xLight += offsetX * scale;
yLight += offsetY * scale;
zLight += offsetZ * scale;
break;
case DOWN:
xLight += -offsetX * scale;
yLight += -offsetY * scale;
zLight += offsetZ * scale;
break;
case EAST:
xLight += offsetY * scale;
yLight += -offsetX * scale;
zLight += offsetZ * scale;
break;
case WEST:
xLight += -offsetY * scale;
yLight += offsetX * scale;
zLight += offsetZ * scale;
break;
case NORTH:
xLight += offsetX * scale;
yLight += -offsetZ * scale;
zLight += -offsetY * scale;
break;
case SOUTH:
xLight += -offsetX * scale;
yLight += offsetY * scale;
zLight += offsetZ * scale;
break;
default:
break;
}
ModRenderHelper.setLightingForBlock(tileEntity.getWorldObj(), (int) (xLight + 0.5F), (int) (yLight + 0.5F), (int) (zLight + 0.5F));
}
GL11.glPushMatrix();
GL11.glTranslated((-tileEntity.getRotationOffsetX() + tileEntity.getRotationOffsetX()) * scale, (-tileEntity.getRotationOffsetY() + tileEntity.getRotationOffsetY()) * scale, (-tileEntity.getRotationOffsetZ() + tileEntity.getRotationOffsetZ()) * scale);
if (tileEntity.getAngleX() != 0) {
GL11.glRotatef(tileEntity.getAngleX(), 1F, 0F, 0F);
}
if (tileEntity.getAngleY() != 0) {
GL11.glRotatef(tileEntity.getAngleY(), 0F, 1F, 0F);
}
if (tileEntity.getAngleZ() != 0) {
GL11.glRotatef(tileEntity.getAngleZ(), 0F, 0F, 1F);
}
if (angleX != 0) {
GL11.glRotatef((float) angleX, 1, 0, 0);
}
if (angleY != 0) {
GL11.glRotatef((float) angleY, 0, 1, 0);
}
if (angleZ != 0) {
GL11.glRotatef((float) angleZ, 0, 0, 1);
}
GL11.glTranslated(tileEntity.getRotationOffsetX() * scale, tileEntity.getRotationOffsetY() * scale, tileEntity.getRotationOffsetZ() * scale);
if (tileEntity.isGlowing()) {
ModRenderHelper.disableLighting();
}
ModRenderHelper.enableAlphaBlend();
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
ItemStackRenderHelper.renderSkinWithHelper(skin, skinPointer, true, false);
GL11.glPopMatrix();
if (tileEntity.isShowRotationPoint()) {
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, scale, scale, scale);
renderBox(aabb, 1F, 0F, 1F);
}
ModRenderHelper.disableAlphaBlend();
if (tileEntity.isGlowing()) {
ModRenderHelper.enableLighting();
}
GL11.glDisable(GL11.GL_NORMALIZE);
GL11.glPopMatrix();
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class RenderBlockMannequin method hasCustomHead.
private boolean hasCustomHead(IInventory inventory) {
ItemStack stack = getStackInMannequinSlot(inventory, MannequinSlotType.HEAD);
if (stack != null) {
if (stack.getItem() instanceof ItemBlock) {
return true;
}
}
if (isHalloweenSeason) {
return true;
}
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
if (skinPointer != null) {
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer, false);
if (skin != null) {
return SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(skin.getProperties());
}
}
return false;
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class SkinItemRenderHelper method renderSkinWithoutHelper.
public static void renderSkinWithoutHelper(ISkinPointer skinPointer, boolean doLodLoading) {
Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
if (skin == null) {
return;
}
float scale = 1F / 16F;
for (int i = 0; i < skin.getParts().size(); i++) {
GL11.glPushMatrix();
SkinPart skinPart = skin.getParts().get(i);
IPoint3D offset = skinPart.getPartType().getOffset();
GL11.glTranslated(offset.getX() * scale, (offset.getY() + 1) * scale, offset.getZ() * scale);
SkinPartRenderer.INSTANCE.renderPart(skinPart, 0.0625F, skinPointer.getSkinDye(), null, doLodLoading);
GL11.glPopMatrix();
}
}
use of riskyken.armourersWorkshop.common.skin.data.Skin in project Armourers-Workshop by RiskyKen.
the class SkinModelRenderer method renderEquipmentPartFromStack.
public boolean renderEquipmentPartFromStack(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(null, modelBiped, data, skinPointer.getSkinDye(), extraColours, distance, doLodLoading);
}
Aggregations