Skip to content

Commit

Permalink
Added config option for changing default skin to Darkosto skin variant
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Dec 3, 2021
1 parent 16dc21d commit bb4b729
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.girafi.waddles.client.ClientHandler;
import com.girafi.waddles.client.model.PenguinModel;
import com.girafi.waddles.entity.AdeliePenguinEntity;
import com.girafi.waddles.utils.ConfigurationHandler;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.resources.ResourceLocation;
Expand All @@ -23,11 +24,15 @@ public PenguinRenderer(EntityRendererProvider.Context context) {
@Nonnull
public ResourceLocation getTextureLocation(@Nonnull AdeliePenguinEntity penguin) {
String name = penguin.getName().getString().toLowerCase().trim();
if (name.equals("joshie") || name.equals("joshiejack")) {
return this.getPenguinTexture("joshie");
} else if (name.equals("darkosto")) {
return this.getPenguinTexture("darkosto");
}
return switch (name) {
case "joshie", "joshiejack" -> this.getPenguinTexture("joshie");
case "darkosto" -> this.getPenguinTexture("darkosto");
case "waddles", "adelie", "girafi", "wiiv" -> getDefault(penguin);
default -> ConfigurationHandler.GENERAL.darkostoDefault.get() ? this.getPenguinTexture("darkosto") : getDefault(penguin);
};
}

private ResourceLocation getDefault(@Nonnull AdeliePenguinEntity penguin) {
return penguin.isBaby() ? this.getPenguinTexture("adelie_child") : this.getPenguinTexture("adelie");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class ConfigurationHandler {
public static class General {
public final ForgeConfigSpec.BooleanValue dropFish;
public final ForgeConfigSpec.BooleanValue dropExp;
public final ForgeConfigSpec.BooleanValue darkostoDefault;
public final ForgeConfigSpec.ConfigValue<List<? extends String>> spawnBlocks;

General(ForgeConfigSpec.Builder builder) {
Expand All @@ -32,7 +33,12 @@ public static class General {
.comment("Penguins should drop experience?")
.translation("waddles.configgui.dropExp")
.define("dropExp", true);
darkostoDefault = builder
.comment("Use the Darkosto skin variant by default?")
.translation("waddles.configgui.darkosto")
.define("darkostoDefault", false);
spawnBlocks = builder.defineList("spawn blocks", Collections.singletonList(Blocks.GRASS_BLOCK.getRegistryName().toString()), o -> o instanceof String && ForgeRegistries.BLOCKS.getKeys().contains(new ResourceLocation(o.toString())));

builder.pop();
}
}
Expand Down

0 comments on commit bb4b729

Please sign in to comment.