use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class SkinItemRenderHelper method renderSkinAsItem.
public static void renderSkinAsItem(ItemStack stack, boolean showSkinPaint, int targetWidth, int targetHeight) {
if (SkinNBTHelper.stackHasSkinData(stack)) {
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
renderSkinAsItem(skinPointer, showSkinPaint, false, targetWidth, targetHeight);
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer 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);
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class SkinPreviewHandler method onDrawScreenPre.
@SubscribeEvent
public void onDrawScreenPre(DrawScreenEvent.Post event) {
if (!ConfigHandlerClient.skinPreEnabled) {
return;
}
if (!ConfigHandlerClient.skinPreLocFollowMouse) {
return;
}
SkinPointer skinPointer = lastSkinPointer;
List<String> list = lastList;
lastSkinPointer = null;
lastList = null;
if (skinPointer != null & list != null) {
Minecraft mc = Minecraft.getMinecraft();
float skinPreSize = ConfigHandlerClient.skinPreSize;
int[] toolTipSize = getTooltipSize(list, mc.currentScreen.width, mc.currentScreen.height, event.mouseX + 8, event.mouseY, mc.fontRenderer);
int x = (int) (toolTipSize[0] - skinPreSize - 28);
int y = (int) (toolTipSize[1] - 4);
if (tooltipOnLeft(list, mc.currentScreen.width, mc.currentScreen.height, event.mouseX + 8, event.mouseY, mc.fontRenderer)) {
x = (int) (toolTipSize[0] + toolTipSize[2] + 15);
}
if (y < 0) {
y = 0;
}
if (y + skinPreSize > mc.currentScreen.height) {
y = mc.currentScreen.height - (int) skinPreSize;
}
drawSkinBox(mc, x, y, skinPreSize, skinPointer);
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class ItemSkin method addTooltipToSkinItem.
public static void addTooltipToSkinItem(ItemStack stack, EntityPlayer player, List tooltip, boolean showAdvancedItemTooltips) {
String cRed = EnumChatFormatting.RED.toString();
boolean isEquipmentSkin = stack.getItem() == ModItems.equipmentSkin;
boolean isEquipmentContainer = stack.getItem() instanceof AbstractModItemArmour;
if (SkinNBTHelper.stackHasSkinData(stack)) {
SkinPointer skinData = SkinNBTHelper.getSkinPointerFromStack(stack);
SkinIdentifier identifier = skinData.getIdentifier();
if (!isEquipmentSkin & !skinData.lockSkin & !isEquipmentContainer) {
return;
}
if (!isEquipmentSkin) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.hasSkin"));
}
if (ClientSkinCache.INSTANCE.isSkinInCache(skinData)) {
Skin data = ClientSkinCache.INSTANCE.getSkin(skinData);
if (stack.getItem() != ModItems.equipmentSkin & !data.getCustomName().trim().isEmpty()) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinName", data.getCustomName()));
}
if (!data.getAuthorName().trim().isEmpty()) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinAuthor", data.getAuthorName()));
}
if (skinData.getIdentifier().getSkinType() != null) {
String localSkinName = SkinTypeRegistry.INSTANCE.getLocalizedSkinTypeName(skinData.getIdentifier().getSkinType());
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinType", localSkinName));
}
if (ConfigHandlerClient.showSkinTooltipDebugInfo) {
if (GuiScreen.isShiftKeyDown()) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdentifier"));
if (identifier.hasLocalId()) {
tooltip.add(" " + TranslateUtils.translate("item.armourersworkshop:rollover.skinId", identifier.getSkinLocalId()));
}
if (identifier.hasLibraryFile()) {
tooltip.add(" " + TranslateUtils.translate("item.armourersworkshop:rollover.skinLibraryFile", identifier.getSkinLibraryFile().getFullName()));
}
if (identifier.hasGlobalId()) {
tooltip.add(" " + TranslateUtils.translate("item.armourersworkshop:rollover.skinGlobalId", identifier.getSkinGlobalId()));
}
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinTotalCubes", data.getTotalCubes()));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinNumCubes", data.getTotalOfCubeType(CubeRegistry.INSTANCE.getCubeFormId((byte) 0))));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinNumCubesGlowing", data.getTotalOfCubeType(CubeRegistry.INSTANCE.getCubeFormId((byte) 1))));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinNumCubesGlass", data.getTotalOfCubeType(CubeRegistry.INSTANCE.getCubeFormId((byte) 2))));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinNumCubesGlassGlowing", data.getTotalOfCubeType(CubeRegistry.INSTANCE.getCubeFormId((byte) 3))));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinPaintData", data.hasPaintData()));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinMarkerCount", data.getMarkerCount()));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinDyeCount", skinData.getSkinDye().getNumberOfDyes()));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinProperties"));
ArrayList<String> props = data.getProperties().getPropertiesList();
for (int i = 0; i < props.size(); i++) {
tooltip.add(" " + props.get(i));
}
} else {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinHoldShiftForInfo"));
}
}
if (identifier.hasLocalId()) {
if (identifier.getSkinLocalId() != data.lightHash()) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError1"));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError2"));
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinIdError3", data.requestId, data.lightHash()));
}
}
} else {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skindownloading", identifier.toString()));
if (identifier.hasLocalId()) {
tooltip.add(" " + TranslateUtils.translate("item.armourersworkshop:rollover.skinId", identifier.getSkinLocalId()));
}
if (identifier.hasLibraryFile()) {
tooltip.add(" " + TranslateUtils.translate("item.armourersworkshop:rollover.skinLibraryFile", identifier.getSkinLibraryFile().getFullName()));
}
if (identifier.hasGlobalId()) {
tooltip.add(" " + TranslateUtils.translate("item.armourersworkshop:rollover.skinGlobalId", identifier.getSkinGlobalId()));
}
}
String keyName = Keyboard.getKeyName(Keybindings.openCustomArmourGui.getKeyCode());
if (isEquipmentSkin) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinOpenWardrobe", keyName));
}
} else {
if (SkinNBTHelper.stackHasLegacySkinData(stack)) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinOldType"));
} else {
if (isEquipmentSkin) {
tooltip.add(TranslateUtils.translate("item.armourersworkshop:rollover.skinInvalidItem"));
}
}
}
}
use of riskyken.armourersWorkshop.common.skin.data.SkinPointer in project Armourers-Workshop by RiskyKen.
the class ItemSkin method onItemUse.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
Block block = world.getBlock(x, y, z);
SkinPointer skinPointer = SkinNBTHelper.getSkinPointerFromStack(stack);
if (skinPointer != null && skinPointer.getIdentifier().getSkinType() == SkinTypeRegistry.skinBlock) {
Skin skin = SkinUtils.getSkinDetectSide(skinPointer, false, true);
if (skin != null) {
ForgeDirection dir = ForgeDirection.getOrientation(side);
Block replaceBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if (replaceBlock.isReplaceable(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) {
placeSkinAtLocation(world, player, side, stack, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, skinPointer);
return true;
}
}
}
return false;
}
Aggregations