use of net.silentchaos512.utils.Color in project Silent-Gear by SilentChaos512.
the class MaterialBuilder method displayTip.
public MaterialBuilder displayTip(PartTextures texture, int color) {
display(PartType.TIP, GearType.ALL, new MaterialLayer(texture, color));
display(PartType.TIP, GearType.PART, new MaterialLayer(SilentGear.getId("tip_base"), Color.VALUE_WHITE), new MaterialLayer(SilentGear.getId("tip"), color), new MaterialLayer(SilentGear.getId("tip_shine"), Color.VALUE_WHITE));
return this;
}
use of net.silentchaos512.utils.Color in project Silent-Gear by SilentChaos512.
the class ColorUtils method getBlendedColor.
public static int getBlendedColor(ICoreItem item, IPartData part, Collection<? extends IMaterialInstance> materials, int layer) {
int[] componentSums = new int[3];
int maxColorSum = 0;
int colorCount = 0;
int i = 0;
for (IMaterialInstance mat : materials) {
IMaterialDisplay model = mat.getDisplayProperties();
int color = model.getLayerColor(item.getGearType(), part, mat, layer);
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
int colorWeight = (materials.size() - i) * (materials.size() - i);
for (int j = 0; j < colorWeight; ++j) {
maxColorSum += Math.max(r, Math.max(g, b));
componentSums[0] += r;
componentSums[1] += g;
componentSums[2] += b;
++colorCount;
}
++i;
}
return blendColors(componentSums, maxColorSum, colorCount);
}
use of net.silentchaos512.utils.Color in project Silent-Gear by SilentChaos512.
the class ColorUtils method getBlendedColor.
public static int getBlendedColor(CompoundMaterialItem item, Collection<? extends IMaterialInstance> materials, int layer) {
int[] componentSums = new int[3];
int maxColorSum = 0;
int colorCount = 0;
int i = 0;
for (IMaterialInstance mat : materials) {
IMaterialDisplay model = mat.getDisplayProperties();
List<MaterialLayer> layers = model.getLayerList(GearType.ALL, PartType.MAIN, mat).getLayers();
if (layers.size() > layer) {
int color = layers.get(layer).getColor();
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
int colorWeight = item.getColorWeight(i, materials.size());
for (int j = 0; j < colorWeight; ++j) {
maxColorSum += Math.max(r, Math.max(g, b));
componentSums[0] += r;
componentSums[1] += g;
componentSums[2] += b;
++colorCount;
}
++i;
}
}
return blendColors(componentSums, maxColorSum, colorCount);
}
use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.
the class EntityChaosProjectile method readSpawnData.
@Override
public void readSpawnData(ByteBuf data) {
try {
color = new Color(data.readInt());
damage = data.readFloat();
gravity = data.readBoolean();
} catch (Exception ex) {
}
}
use of net.silentchaos512.utils.Color in project SilentGems by SilentChaos512.
the class EntityChaosProjectile method readEntityFromNBT.
@Override
public void readEntityFromNBT(NBTTagCompound tags) {
super.readEntityFromNBT(tags);
setColor(new Color(tags.getInteger(NBT_COLOR)));
damage = tags.getFloat(NBT_DAMAGE);
gravity = tags.getBoolean(NBT_GRAVITY);
if (tags.hasKey(NBT_SHOOTER)) {
shooter = world.getPlayerEntityByName(tags.getString(NBT_SHOOTER));
if (shooter == null) {
setDead();
}
}
}
Aggregations