Skip to content

Commit

Permalink
Return null when there is no data to copy, add missing piglin in 1.19…
Browse files Browse the repository at this point in the history
….4 implementation
  • Loading branch information
RappyTV committed Nov 21, 2023
1 parent 4be8395 commit 3fc7ed9
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getTileLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getTileLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down Expand Up @@ -99,7 +101,7 @@ private String getSkullTypeName() {
case PLAYER -> I18n.translate("headowner.types.player");
case CREEPER -> I18n.translate("headowner.types.creeper");
case DRAGON -> I18n.translate("headowner.types.dragon");
default -> null;
case PIGLIN -> I18n.translate("headowner.types.piglin");
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getBlockLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getBlockLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public String getDisplay(HeadOwnerConfig config) {

@Override
public String getCopy(HeadOwnerConfig config) {
return new Skull(Skull.getTileLooking(config.distance())).getCopy();
Skull skull = new Skull(Skull.getTileLooking(config.distance()));
if(skull.getSkullTypeName() == null) return null;
return skull.getCopy();
}

public static class Skull {
Expand Down

0 comments on commit 3fc7ed9

Please sign in to comment.