Minecraft + ComputerCraftEdu – Installation

A little different post topic for me… This one is about a Minecraft mod.

Now, plenty of folks play with a variety of mods. I’ve been a bit of a stickler though and haven’t installed any for my kids. Partially because I’m a bit of a purist. Partly because I didn’t want the additional hassle of supporting them and don’t want to wait to update Minecraft itself when updates roll out. (There are usually some gaps in time between when a new game version rolls out and when mods are rolled out that support the new game version) Besides, my kids are already having a blast with the basic Minecraft game and are accepting of these limitations. Smile with tongue out 

Aside from Minecraft, I’m always looking for kid-friendly ways to introduce and encourage basic coding skills, computational though processes, etc. I’m not trying to steer them towards a career, per se, but I want to at least introduce to concepts because I believe they’ll be invaluable as they grow up in this crazy world of ours. 

So, with that background, when I heard about this mod my interest was peaked (as was theirs): http://www.computercraftedu.com/ 

(Incidentally, I got about this from a facebook post by Code.org – another wonderful resource)

Enough of my rambling. On to the steps and notes.

So far, we have it installed so they can experiment with it locally. I’d like to get it running on a server as well to see what craziness happens. These are the steps we used to install it locally. Hopefully this can help some folks get it running faster than I did initially. Smile with tongue out It was my first experience getting some of these things running.

Pre-install notes:

  • First of all, the ComputerCraftEdu site does a good job of getting you started – start there.
  • This particular mod only works with an older version of Minecraft. As of July 23, 2015 ComputerCraftEdu is version 1.7.10 while the current version of Minecraft is 1.8.7
    No need to worry, we can work with this just fine. There are some warnings about the potential for breaking or corrupting a world (file) by opening it with the mismatched version – there are ways to help prevent this – described in the steps below.  
  • Minecraft Forge – it’s a program used to manage and load mods. ComputerCraftEdu requires it to load their mod.
  • WARNING: When visiting and downloading Forge BEWARE OF AD LINKS. When you click on the download links you’ll see a full page add that you’ll be tempted to click and you’ll get some unknown, untrusted software. STAY AWAY. Look at the header and click the SKIP button to get the download you want. (image below)

Steps:

    1. Download the ComputerCraftEdu mod (I’m not going to link directly to the file – go to their page and make sure you’re getting the latest version).
      Note: You might get a “hey, this file could be dangerous” message. This is because of the type of file it is. If you’re getting it from the computercraftedu.com site you should be fine.
    2. Go to the Minecraft Forge installer page HERE (v 10.13.4.1448 – for Minecraft 1.7.10). SEE THE WARNING ABOVE – and image below.
    3. Click the ‘Installer-win’ link. SEE THE WARNING ABOVE.
      forgedownloadwarning
    4. Click the SKIP button – the file you want should be downloaded into the directory you choose or the default location. It should look something like: “forge-1.7.10-10.13.4.1448-1.7.10-installer-win.exe” (numbers may be different for newer versions)
    5. Go to the downloaded file location.
    6. Right-click on the file name and “Run as administrator”. If you are on your child’s machine and it has parental controls in place you may need to enter your credentials at this time.
    7. “Do you want to allow the following program… make changes to this computer” If it is for the “forge-lots of numbers.exe” file, Click ‘Yes.
    8. If the machine has Minecraft installed, the Forge installer will find one of the locations Minecraft files are being stored.
      forgeinstaller
    9. Before we go ahead with the installation, we’re going to create a new folder that we’ll use later. Click the ‘…’ button to see where the files are stored.
      Note: I created the folder this way because I was already at the folder/directory location. You’ll need to note the location for later…
    10. Create a new folder – I called mine “.minecraftCCEdu”
    11. Once the folder is created – Click ‘Cancel’. Yep. ‘Cancel’ to get back to the install screen.
    12. The install folder should still show the original “.minecraft” (as shown above). Click ‘OK’
    13. It should download files, unpack stuff, and successfully install Forge.
    14. Click ‘OK’
    15. Open Minecraft launcher
    16. In the lower-left corner of the launcher, there is a Profile drop-down control and some buttons. Note the name of the default profile (probably the name of the Minecraft user) and click ‘New Profile’.
    17. The Profile Name is probably something like “Copy of [username]”. I changed this to “[Username]CCEdu”
    18. Check the “Game Directory” box, and change the folder path to your new folder – “.minecraftCCEdu”
    19. for the “Use version” option, click the drop-down and select ‘release 1.7.10-Forge…..’
      It’ll be the last (or close) in the list.
    20. Click ‘Save Profile’
    21. Select the new profile from the drop-down.
    22. Click ‘Play’ – There should be some Forge loading bars that are new…
    23. (files and folders get created in your new directory)
    24. Quit Game
    25. Copy the ComputerCraftEdu .jar file from its download directory into your new .minecraftCCedu\mods\ directory.
    26. Open Minecraft launcher
    27. Make sure your new profile is selected
    28. Click ‘Play’
    29. Click ‘Create New World’
    30. Name it, select ‘Game Mode Creative’, Click ‘Create New World’
    31. To verify the mod is loaded, open your inventory. There should be a second page of options now showing ‘ComputerCraft’ and ‘ComputerCraftEdu’ icons.
      mincraftCCEduPanel
    32. Congrats! Have fun experimenting!

Post-install notes:

  • Some great Help links to get you rolling once you’re installed and configured.
  • Also: Introduction to ComputerCraftEdu
  • The separate Minecraft profiles you created should keep your ‘normal’ worlds separated from your ComputerCraftEdu worlds – if you’re anything like my kids you have a bunch of worlds in your profile, so this is a nice feature.

Using jQuery for CSR

There are a few useful CSR utility solutions that require jQuery to be available to the CSR script. If you are an IW / Power User you don’t necessarily need to know how to use jQuery explicitly, but there are some easy templates that only work by using it.

If jQuery isn’t already enabled for your site, you need to add the jQuery file and a link to it on the page you’re using it on.

  1. Download the latest version of the file from HERE. Get the ‘…compressed, production…’ version.
  2. Copy the file to your Scripts library (just to be consistent with where your other CSR files are).
  3. On the page you are using jQuery dependent CSR, add a Script Editor web part.
  4. In the Editor web part, add the following line – or similar based on where your file is located. This worked for me by having the file in my Scripts library:
    <script language=”javascript” type=”text/javascript” src=”../Scripts/jquery-2.1.3.min.js”></script>”

Note: Take a peek at Marc’s post on jQuery to make sure your file is working properly.

CSR that uses the jQuery library should now function properly.

JSLink – CSR to Override “There are no items to show in this view…”

The default message displayed in a view when that view has no items to display is:

“There are no items to show in this view of the [listname] list”.

In most cases this is just fine. When users are working directly in a list this message is consistent with the user experience.

If for whatever reason this text needs to be overridden there isn’t an obvious or simple approach to do this through the UI.

The default text is set within each list behind the scenes. If you were to change the property of the list directly using some custom approaches it would change the message for the list and be seen in all views. Using CSR, we’re going to change what is displayed without changing the core data. This give a few advantages:

  1. We generally don’t want to make permanent customizations if we don’t have to.
  2. Using CSR we can update the message for *each* view as necessary – which might be more appropriate for each use case.  

The bonus here is that it’s REALLY easy using CSR once you’ve figured it out. Smile 

So, here’s how it works:

Note: Normally I don’t add CSR to actual view pages – *especially* the All Items view – but technically you can. I generally use a separate page with a web/app part dropped on the page and apply CSR using JS Link at that point. But for this simple example we use the straight-up view page.

Our view starts out like this:

image

Now, you can take a shortcut by using the Footer override, but this will override both the default message when there are no items in the list *and* be displayed when there are items displayed. Fine if the override is blank, but not useful if you’re actually displaying a message.

overrideCtx.Templates.Footer = “ “;

The more elegant method is to override the default text in the list property SharePoint uses while leaving the logic SharePoint uses to decide when to display the message (No items in the view –> display the text). Within the list schema the property is ‘NoListItem’ and fortunately for us this property is available to us in our CSR JavaScript. In this example we use the OnPreRender override to make the change.

image

Applying this code as JS Link file gives us the following:

image

Pretty slick now that we’ve figured it out.

Thanks again to Raymond Mitchel (@iwkid) for helping with digging through the background details.

JS Link – Using CSR for KPIs

OK. Someone asked me today if CSR and JS Link can be used incorporate KPIs into a list view. The answer of course is ‘yes’. This is a wonderful example of how CSR can be used.  Smile

Background: If you’re wondering what a ‘KPI’ is – it’s a ‘key performance indicator’. You can find more about them here: http://en.wikipedia.org/wiki/Performance_indicator   What we’re talking about specifically in this case is a visual KPI in a SharePoint list view – something that can be used as a quick visual cue as to what the data is showing.

If you’re wondering what CSR and JS Link are referring to, take a peek at my “JS Link – Hello World” article.

With all that settled, here’s a quick example of one way KPIs could be incorporated into a list view using CSR and JS Link:

  • Create a list (yes, you can use an existing list).
  • Add or identify a column that’s going to be used as a value to test.
  • Add or identify a column for where the KPI indicator can be displayed – a graphic will override whatever data might be in this field. The title of the column can be useful to indicate which KPI is being displayed…
  • Identify the locations of graphics to be used as the KPI indicators. I put mine in the Site Assets library for this example, but they could be stored just about anywhere.

Here’s the sample JavaScript:

image

Note: You can update the fully qualified links to the image to relative links:  src=”/TeamSite/CSR/…”  (still need the rest of the URL, but dropping the beginning part)

In the example code, we’re checking the value of one field and displaying the image in an override of a second field.

Again, this is an extremely simple example – the logic for the KPI could be much more complicated as needed. There could be one or more KPIs per item. Lots of ways to improve on the concept.

The example ends up looking something like this:

image

NOTE: For this quick and dirty example I created a field in the list that is essentially used only as a field to be overridden with an image. If I want to make the solution cleaner and more UX friendly I could do an Item override which would allow me to skip adding the new ‘container’ field. I could just bake the image into the rendered HTML directly.

Reference to where the images came from: http://commons.wikimedia.org/wiki/Category:Light_icons

Another much more complicated example:
http://www.connectorman.com/jslink-code-kpis-sharepoint-2013-2/

Office 365 Community – Yammer

[This came up in my session at SPFest this morning, so posting the link for folks]

If you’re involved with SharePoint – or really any of a number of Microsoft’s cloud-based service technologies – you need to join the Office 365 Yammer Network to stay up on the latest and greatest community conversations, news, etc.

https://www.yammer.com/itpronetwork/

The URL is a bit confusing as it looks like IT Pro only content, but it’s really much more than that. Don’t let the URL deter you. Smile

Client-Side Rendering (CSR) demystified – Slides

At SPC14 – the SharePoint Conference 2014 – I initially presented a session on Client-Side Rendering in SharePoint 2013 as implemented using JS Link through the web interface. CSR and JS Link using uploaded JavaScript files and the JS Link web part property pointed at the appropriate JavaScript files – to be differentiated from JS Link baked into managed code.

The recording and slides for the SPC session are available here – on Channel9: http://channel9.msdn.com/events/SharePoint-Conference/2014/SPC318

This content has also since been presented (in slight variations of the original) at a few SharePoint Saturday events.

Hiding the Title Field – A little stumble…

Plenty of folks talk about variations on a theme here. I’ve hidden the Title field before, no big deal. The order I happen to use this time was a little confusing though.

I have a list where I know I’m using content types. So right after I’ve created the list, before I do anything else I turn on Advanced Settings –> Allow management of content types and then add my content types to the list. Within those content types, I have the Title field hidden. Within the ‘inherited from’ content types, the Title field is hidden. I figure I’m covered. Now when I open the list in datasheet mode and add a new row of information I get an error. First it was that a required field was not in the view so I needed to add a handful of columns back in. Then, I attempted again to add an item and the Title field gets the red box. What the heck? It’s supposed to be hidden. I tried changing lots of different settings all over the place but nothing worked. Frustrating.

Maybe you’ve seen this, maybe you haven’t – but it stumped me for a while before figuring out the simple solution thanks to Marc Anderson’s post. All I needed to do at this point was turn off the List Settings –> Advanced Settings –> Allow management of content types, then make the Title field not required, then turn Advanced mode back on. Even though I’d done the same thing to all the content types (including Item), I still needed to explicitly change the setting on the field itself. Makes sense once you figure it out, but quite frustrating when you’re in the mix trying to make it work.

JS Link – Highlighting a Row with CSR

One conditional formatting scenario in SharePoint 2010 and SharePoint Designer 2010 was to highlight a row in a list view based on a rule: data within the item/row. SharePoint Designer 2013 unfortunately does not have the same design view available, so we need to use some relatively simple code to get the same results. This article discusses one method to get the same results using SharePoint 2013 with Client-Side Rendering (CSR) and the JS Link web part property.

Referring back to a few of my other posts you can get an idea of the general approach using CSR here:

When creating the JavaScript file this time we aren’t doing any Field or Item overrides, but we are using the PostRender functionality:

image

OverrideCtx.OnPostRender = {

As the name describes, we’re tweaking the page output after the rest of the page has been rendered. Using Field overrides we could alter the formatting of text, but not cells and wouldn’t have access to the row either. Using the Item override we could build the row from scratch and highlight the row, but it would take a lot more work rebuilding the view when we can just use the PostRender method to tweak the existing view.

image

I won’t get into all the JavaScript details but want to highlight what’s important to replicate this functionality on your own. The code essentially steps through each item/row in the table and runs the logic on each item.

There are only a few snippets you need to customize to fit your scenario:

if (listItem.Priority == “(1) High”) {

The code above is your condition / rule. ‘Priority’ is the column you’re checking the value on – remember that ‘Priority’ is the internal name of the column. You can use any column that’s included in the view for your rule criteria.

row.style.backgroundColor = “rgba(255, 0, 0, 0.5)”;  //red

This (above) is setting the row background color. You can set whichever color you need. You can have multiple rules checking different rows and applying various colors if you wish.

OK! Once the JavaScript is written and uploaded to the site (see other posts for details) and the JS Link property is set, if everything is working the list should now show a highlighted row for data that matches the rule:

image

Using the PostRender approach makes highlighting an entire row pretty easy. If you wanted to highlight a specific cell, it would be possible but would take some more code (we’ll show that another time) to get the right column selected. It’s not as easy as just calling out the column/field name. Depending on what you’re trying to accomplish on the cell/field level, that kind of change might be easier using the Field override.

Thanks again to Jon Campbell (MS), Raymond Mitchell and Phil Jirsa for hammering through much of the JavaScript details on this one. Jon clued us into some of these JS Link innerds back when he was on the SharePoint team. :)

JS Link – CSR View Conditional Formatting

This post builds on the JS Link – CSR Simple View Field Formatting post.

If you can format a single field as was done in the previous example, it’s not a big step from there to using conditional formatting.

In SharePoint Designer (pre-2013) one of relatively easy yet powerful features  was conditional formatting – the ability to dynamically change how content was displayed based on rules. In the last post we went over how to do simple formatting, in this post we’ll review how to incorporate some simple rules or conditions.

In the previous example we bolded everything in the Issue Status field.

image

In this example we’ll ‘conditionally’ select which items are bolded based on data values for each item.

image

We’ll start with a couple of individual fields and go from there. For this example and similar to the last post, I created a page in the Site Pages library and added the Office Issues web part to the page. I’ll be setting the JS Link property of the web part here in a few steps.

In this post we’re adding three concepts:

  1. JavaScript – Calling a function.
    If you are a JavaScript developer this concept isn’t really even worth mentioning. If you are not a developer, we’re moving the code around a little bit to keep it organized, easier to read, etc…image‘Status’:{‘View’: ConditionalStatus},
    In this line rather than setting the value of the field outright like we did with simple field formatting, we’re calling a function ‘ConditionalStatus’ where addition work is being done.
  2. Checking for the ‘condition’ or rule.
    imageWithout getting into all the JavaScript details, what we’re doing in the function is checking the value of the ‘Issue Status’ field and either making the contents bold, or leaving them in the default format.if (ctx.CurrentItem.Status == “Active” ) {
  3. Building the HTML for what is displayed or rendered in the web part on the page.In this example we’re just using a the HTML tags necessary to bold the content being displayed. You could use virtually any HTML or CSS you wanted when it comes to formatting the data:ret = “<b>” + ctx.CurrentItem.Status + “</b>”;

    You should also note the way we set up the data. The HTML and field data need to be built into a string – which is different than the way we did it in the previous post.

The full sample code can be found HERE.

The completed file is then uploaded to your chosen location: Master Page Gallery in this case. The web part JS Link property is configured to point to your JavaScript file:

~site/_catalogs/masterpage/[yourFileName].js

Notes:

    • You are not limited to pairing the conditional field with the field that is custom rendered.
      If Issue Status is ‘Active’, bold the Status field…
      You can just as easily define a rule for the Title field to check the value of the Issue Status field.
      If the Issue Status field is ‘Active’, bold the Title field…
      You can also combine rules into more complicated criteria
      If Issue Status is ‘Active’ and Priority is ‘High’, then bold the Title field…
  • Rather than customizing how each field is displayed separately, you can use a different override – the Item override – to customize each field or how the entire item is displayed. This will be covered in a separate post.

SPC14 MySPC, Sessions and Schedule

SPC14 is going to be pretty darn cool. Looking at the sessions and how things are going to be organized is amazing. Microsoft is doing a great job integrating Yammer into the mix for this conference.

If you haven’t already, sign in to MySPC and then link your Yammer account to MySPC. Once you’ve gotten into the SPC 2014 network in Yammer, you’ll be able to search by session numbers to find session presentation information, slide decks, related links and files, etc. The Yammer network integration and ‘second screen’ experience is going to change how you experience the conference – before, during and after the event.

Be sure to check out the sessions you’re interested in on the Yammer network to properly set expectations for what you’re going to see during the presentations.

Here’s information about my session:
#SPC318 – Client-Side Rendering (CSR) demystified
MySPC Link | Yammer Link

It is a developer session and I will be talking about JavaScript code that applies to the web interface, specifically list views but also touching on forms. From a practical viewpoint the content I’ll be covering can be used by what I would call power users, citizen developers, etc. –> folks comfortable tweaking HTML, CSS and a little JavaScript given some guidance.

There’s more information available on the Yammer page. Log on, ask questions, participate in the conversation and I’ll see you on Tuesday!