Skip to content

Commit

Permalink
Allow Skull blocks to have their skin set correctly
Browse files Browse the repository at this point in the history
Oops, forgot this bit somehow
  • Loading branch information
Morphan1 committed Feb 14, 2015
1 parent 7e7d515 commit 4442131
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -3,6 +3,7 @@
import com.google.common.collect.Iterables;
import com.mojang.authlib.GameProfile;
import net.aufdemrand.denizen.Settings;
import net.aufdemrand.denizen.objects.properties.item.ItemSkullskin;
import net.aufdemrand.denizen.utilities.entity.DenizenEntityType;
import net.aufdemrand.denizencore.objects.*;
import net.aufdemrand.denizencore.objects.notable.Notable;
Expand Down Expand Up @@ -1608,10 +1609,22 @@ && getBlock().getState() instanceof CreatureSpawner) {
// <l@location.skull_skin>
// -->
if (mechanism.matches("skull_skin") && getBlock().getState() instanceof Skull) {
Skull state = ((Skull)getBlock().getState());
if (!state.setOwner(value.asString()))
dB.echoError("Failed to set skull_skin!");
state.update(true);
dList list = mechanism.getValue().asType(dList.class);
String idString = list.get(0);
GameProfile profile;
if (idString.contains("-")) {
UUID uuid = UUID.fromString(idString);
profile = new GameProfile(uuid, null);
}
else {
profile = new GameProfile(null, idString);
}
profile = ItemSkullskin.fillGameProfile(profile);
if (list.size() > 1) {
profile.getProperties().put("textures", new com.mojang.authlib.properties.Property("value", list.get(1)));
}
((TileEntitySkull) ((CraftWorld) getWorld()).getTileEntityAt(getBlockX(), getBlockY(), getBlockZ()))
.setGameProfile(profile);
}

// <--[mechanism]
Expand Down
Expand Up @@ -162,7 +162,7 @@ public void adjust(Mechanism mechanism) {

}

private static GameProfile fillGameProfile(GameProfile gameProfile) {
public static GameProfile fillGameProfile(GameProfile gameProfile) {
if(gameProfile != null) {
GameProfile gameProfile1 = null;
if (gameProfile.getName() != null) {
Expand Down

0 comments on commit 4442131

Please sign in to comment.