MidnightLib 0.2.6 - Code cleanup & compression
- MidnightHats is now more performant and has new types of special hats - Compress assets - Reduce filesize heavily
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.11.3
|
loader_version=0.11.3
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.2.5
|
mod_version = 0.2.6
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = midnightlib
|
archives_base_name = midnightlib
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ import eu.midnightdust.lib.config.MidnightConfig;
|
|||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityModelLayerRegistry;
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityModelLayerRegistry;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
@SuppressWarnings({"deprecation", "UnstableApiUsage"})
|
@SuppressWarnings({"deprecation", "UnstableApiUsage"})
|
||||||
public class MidnightLibClient implements ClientModInitializer {
|
public class MidnightLibClient implements ClientModInitializer {
|
||||||
|
|
||||||
public static final String MOD_ID = "midnightlib";
|
public static final String MOD_ID = "midnightlib";
|
||||||
|
public static Event EVENT = Event.NONE;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
@@ -24,8 +27,18 @@ public class MidnightLibClient implements ClientModInitializer {
|
|||||||
EntityModelLayerRegistry.registerModelLayer(ChristmasHatFeatureRenderer.CHRISTMAS_HAT_MODEL_LAYER, ChristmasHatFeatureRenderer::getTexturedModelData);
|
EntityModelLayerRegistry.registerModelLayer(ChristmasHatFeatureRenderer.CHRISTMAS_HAT_MODEL_LAYER, ChristmasHatFeatureRenderer::getTexturedModelData);
|
||||||
EntityModelLayerRegistry.registerModelLayer(TinyPotatoFeatureRenderer.TINY_POTATO_MODEL_LAYER, TinyPotatoFeatureRenderer::getTexturedModelData);
|
EntityModelLayerRegistry.registerModelLayer(TinyPotatoFeatureRenderer.TINY_POTATO_MODEL_LAYER, TinyPotatoFeatureRenderer::getTexturedModelData);
|
||||||
EntityModelLayerRegistry.registerModelLayer(WitchHatFeatureRenderer.WITCH_HAT_MODEL_LAYER, WitchHatFeatureRenderer::getTexturedModelData);
|
EntityModelLayerRegistry.registerModelLayer(WitchHatFeatureRenderer.WITCH_HAT_MODEL_LAYER, WitchHatFeatureRenderer::getTexturedModelData);
|
||||||
if (MidnightLibConfig.special_hats) {
|
if (MidnightLibConfig.special_hats) HatLoader.init();
|
||||||
HatLoader.init();
|
if (MidnightLibConfig.event_hats) EVENT = getEvent();
|
||||||
}
|
}
|
||||||
|
private Event getEvent() {
|
||||||
|
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.APRIL && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) <= 4) return Event.EASTER;
|
||||||
|
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.OCTOBER && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) >= 30) return Event.HALLOWEEN;
|
||||||
|
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.DECEMBER && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == 10) return Event.FABRIC;
|
||||||
|
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.DECEMBER && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) >= 23 && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) <= 26) return Event.CHRISTMAS;
|
||||||
|
return Event.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Event {
|
||||||
|
NONE, EASTER, HALLOWEEN, FABRIC, CHRISTMAS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import eu.midnightdust.hats.web.HatLoader;
|
|||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.model.TexturedModelData;
|
import net.minecraft.client.model.TexturedModelData;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
@@ -19,7 +18,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
@@ -42,32 +40,24 @@ public class BunnyEarsFeatureRenderer<T extends LivingEntity, M extends EntityMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
||||||
{
|
UUID uuid = livingEntity.getUuid();
|
||||||
AbstractClientPlayerEntity abstractClientPlayerEntity = (AbstractClientPlayerEntity)livingEntity;
|
Identifier hat_type = getHat(uuid);
|
||||||
Identifier hat_type;
|
|
||||||
if (livingEntity != null) {
|
|
||||||
|
|
||||||
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.APRIL && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) <= 4) {
|
if (!(hat_type == DEACTIVATED) && !HatLoader.PLAYER_HATS.containsKey(uuid) && !uuid.equals(MOTSCHEN)) {
|
||||||
if (MidnightLibConfig.event_hats) {
|
matrixStack.push();
|
||||||
hat_type = RABBIT;
|
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
||||||
}
|
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
||||||
else hat_type = DEACTIVATED;
|
this.bunnyEars.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}else {
|
matrixStack.pop();
|
||||||
hat_type = DEACTIVATED;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hat_type = DEACTIVATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(hat_type == DEACTIVATED) && !HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && !abstractClientPlayerEntity.getUuid().equals(MOTSCHEN)) {
|
|
||||||
matrixStack.push();
|
|
||||||
|
|
||||||
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
|
||||||
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
|
||||||
this.bunnyEars.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
|
|
||||||
matrixStack.pop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private Identifier getHat(UUID uuid) {
|
||||||
|
if (MidnightLibConfig.event_hats && MidnightLibClient.EVENT.equals(MidnightLibClient.Event.EASTER))
|
||||||
|
return RABBIT;
|
||||||
|
else if (HatLoader.PLAYER_HATS.containsKey(uuid) && HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("bunny"))
|
||||||
|
return RABBIT;
|
||||||
|
|
||||||
|
return DEACTIVATED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import eu.midnightdust.hats.web.HatLoader;
|
|||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.model.TexturedModelData;
|
import net.minecraft.client.model.TexturedModelData;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
@@ -22,7 +21,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
@@ -45,31 +43,22 @@ public class ChristmasHatFeatureRenderer<T extends LivingEntity, M extends Entit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
||||||
{
|
UUID uuid = livingEntity.getUuid();
|
||||||
AbstractClientPlayerEntity abstractClientPlayerEntity = (AbstractClientPlayerEntity)livingEntity;
|
Identifier hat_type = getHat();
|
||||||
Identifier hat_type;
|
|
||||||
if (livingEntity != null) {
|
|
||||||
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.DECEMBER && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) >= 23 && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) <= 26) {
|
|
||||||
if (MidnightLibConfig.event_hats) {
|
|
||||||
hat_type = CHRISTMAS;
|
|
||||||
}
|
|
||||||
else hat_type = DEACTIVATED;
|
|
||||||
}else {
|
|
||||||
hat_type = DEACTIVATED;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hat_type = DEACTIVATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(hat_type == DEACTIVATED) && !HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && !abstractClientPlayerEntity.getUuid().equals(MOTSCHEN)) {
|
if (!(hat_type == DEACTIVATED) && !HatLoader.PLAYER_HATS.containsKey(uuid) && !uuid.equals(MOTSCHEN)) {
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
||||||
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
||||||
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
||||||
this.christmasHat.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
this.christmasHat.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private Identifier getHat() {
|
||||||
|
if (MidnightLibConfig.event_hats && MidnightLibClient.EVENT.equals(MidnightLibClient.Event.CHRISTMAS))
|
||||||
|
return CHRISTMAS;
|
||||||
|
return DEACTIVATED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import eu.midnightdust.hats.web.HatLoader;
|
|||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.model.TexturedModelData;
|
import net.minecraft.client.model.TexturedModelData;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
@@ -22,7 +21,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
@@ -45,31 +43,24 @@ public class TinyPotatoFeatureRenderer<T extends LivingEntity, M extends EntityM
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
||||||
{
|
UUID uuid = livingEntity.getUuid();
|
||||||
AbstractClientPlayerEntity abstractClientPlayerEntity = (AbstractClientPlayerEntity)livingEntity;
|
Identifier hat_type = getHat(uuid);
|
||||||
Identifier hat_type;
|
|
||||||
if (livingEntity != null) {
|
|
||||||
if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.DECEMBER && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) == 10) {
|
|
||||||
if (MidnightLibConfig.event_hats) {
|
|
||||||
hat_type = TATER;
|
|
||||||
}
|
|
||||||
else hat_type = DEACTIVATED;
|
|
||||||
}else {
|
|
||||||
hat_type = DEACTIVATED;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hat_type = DEACTIVATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(hat_type == DEACTIVATED) && !HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && !abstractClientPlayerEntity.getUuid().equals(MOTSCHEN)) {
|
if (!(hat_type == DEACTIVATED) && !HatLoader.PLAYER_HATS.containsKey(uuid) && !uuid.equals(MOTSCHEN)) {
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
||||||
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
||||||
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
||||||
this.tinyPotato.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
this.tinyPotato.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
matrixStack.pop();
|
matrixStack.pop();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private Identifier getHat(UUID uuid) {
|
||||||
|
if (MidnightLibConfig.event_hats && MidnightLibClient.EVENT.equals(MidnightLibClient.Event.FABRIC))
|
||||||
|
return TATER;
|
||||||
|
else if (HatLoader.PLAYER_HATS.containsKey(uuid) && HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("tater"))
|
||||||
|
return TATER;
|
||||||
|
return DEACTIVATED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package eu.midnightdust.hats.web;
|
package eu.midnightdust.hats.web;
|
||||||
|
|
||||||
import com.google.common.reflect.TypeToken;
|
import com.google.common.reflect.TypeToken;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
@@ -15,13 +17,13 @@ import java.net.URL;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import static net.minecraft.datafixer.fix.BlockEntitySignTextStrictJsonFix.GSON;
|
|
||||||
|
|
||||||
public class HatLoader {
|
public class HatLoader {
|
||||||
public static final Logger logger = LogManager.getLogger("MidnightLib");
|
public static final Logger logger = LogManager.getLogger("MidnightLib");
|
||||||
private final static String HATS_URL = "https://raw.githubusercontent.com/TeamMidnightDust/MidnightHats/master/hats.json";
|
private final static String HATS_URL = "https://raw.githubusercontent.com/TeamMidnightDust/MidnightHats/master/hats.json";
|
||||||
public static final Type HAT_TYPE = new TypeToken<Map<UUID, PlayerHatData>>(){}.getType();
|
public static final Type HAT_TYPE = new TypeToken<Map<UUID, PlayerHatData>>(){}.getType();
|
||||||
public static Map<UUID, PlayerHatData> PLAYER_HATS;
|
public static Map<UUID, PlayerHatData> PLAYER_HATS;
|
||||||
|
private static final Gson GSON = new GsonBuilder().create();
|
||||||
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
CompletableFuture.supplyAsync(() -> {
|
CompletableFuture.supplyAsync(() -> {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import eu.midnightdust.hats.web.HatLoader;
|
|||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.model.TexturedModelData;
|
import net.minecraft.client.model.TexturedModelData;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
@@ -22,7 +21,6 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
@@ -51,38 +49,32 @@ public class WitchHatFeatureRenderer<T extends LivingEntity, M extends EntityMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
||||||
{
|
Identifier hat_type = getHat(livingEntity.getUuid());
|
||||||
Identifier hat_type = DEACTIVATED;
|
|
||||||
if (livingEntity instanceof AbstractClientPlayerEntity abstractClientPlayerEntity) {
|
|
||||||
|
|
||||||
if (abstractClientPlayerEntity.getUuid().equals(MOTSCHEN)) {
|
if (!(hat_type == DEACTIVATED)) {
|
||||||
hat_type = MOTSCHEN_SKIN;
|
matrixStack.push();
|
||||||
} else if (HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && HatLoader.PLAYER_HATS.get(abstractClientPlayerEntity.getUuid()).getHatType().contains("contributer")) {
|
|
||||||
hat_type = CONTRIBUTER_SKIN;
|
|
||||||
} else if (HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && HatLoader.PLAYER_HATS.get(abstractClientPlayerEntity.getUuid()).getHatType().contains("friend")) {
|
|
||||||
hat_type = FRIEND_SKIN;
|
|
||||||
} else if (HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && HatLoader.PLAYER_HATS.get(abstractClientPlayerEntity.getUuid()).getHatType().contains("donator")) {
|
|
||||||
hat_type = DONATOR_SKIN;
|
|
||||||
} else if (HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && HatLoader.PLAYER_HATS.get(abstractClientPlayerEntity.getUuid()).getHatType().contains("social")) {
|
|
||||||
hat_type = SOCIAL_SKIN;
|
|
||||||
} else if (HatLoader.PLAYER_HATS.containsKey(abstractClientPlayerEntity.getUuid()) && HatLoader.PLAYER_HATS.get(abstractClientPlayerEntity.getUuid()).getHatType().contains("pride")) {
|
|
||||||
hat_type = PRIDE_SKIN;
|
|
||||||
} else if (Calendar.getInstance().get(Calendar.MONTH) == Calendar.OCTOBER && Calendar.getInstance().get(Calendar.DAY_OF_MONTH) >= 30) {
|
|
||||||
if (MidnightLibConfig.event_hats) {
|
|
||||||
hat_type = WITCH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(hat_type == DEACTIVATED)) {
|
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
||||||
matrixStack.push();
|
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
||||||
|
this.witchHat.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
((ModelWithHead) this.getContextModel()).getHead().rotate(matrixStack);
|
matrixStack.pop();
|
||||||
VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumerProvider, RenderLayer.getEntityCutoutNoCull(hat_type), false, false);
|
|
||||||
this.witchHat.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
|
|
||||||
matrixStack.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private Identifier getHat(UUID uuid) {
|
||||||
|
if (uuid.equals(MOTSCHEN)) {
|
||||||
|
return MOTSCHEN_SKIN;
|
||||||
|
} else if (HatLoader.PLAYER_HATS.containsKey(uuid)) {
|
||||||
|
if (HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("contributer")) return CONTRIBUTER_SKIN;
|
||||||
|
else if (HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("friend")) return FRIEND_SKIN;
|
||||||
|
else if (HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("donator")) return DONATOR_SKIN;
|
||||||
|
else if (HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("social")) return SOCIAL_SKIN;
|
||||||
|
else if (HatLoader.PLAYER_HATS.get(uuid).getHatType().contains("pride")) return PRIDE_SKIN;
|
||||||
|
} else if (MidnightLibClient.EVENT.equals(MidnightLibClient.Event.HALLOWEEN)) {
|
||||||
|
if (MidnightLibConfig.event_hats) {
|
||||||
|
return WITCH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DEACTIVATED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,23 +8,20 @@ import net.minecraft.entity.LivingEntity;
|
|||||||
|
|
||||||
public class WitchHatModel<T extends LivingEntity> extends SinglePartEntityModel<T> {
|
public class WitchHatModel<T extends LivingEntity> extends SinglePartEntityModel<T> {
|
||||||
private final ModelPart headwear;
|
private final ModelPart headwear;
|
||||||
private final ModelPart bone;
|
|
||||||
private final ModelPart bone2;
|
|
||||||
private final ModelPart bone3;
|
|
||||||
|
|
||||||
public WitchHatModel(ModelPart root) {
|
public WitchHatModel(ModelPart root) {
|
||||||
headwear = root;
|
headwear = root;
|
||||||
root.setPivot(5.0F, -9.0F, -5.0F);
|
root.setPivot(5.0F, -9.0F, -5.0F);
|
||||||
|
|
||||||
bone = headwear.getChild("bone");
|
ModelPart bone = headwear.getChild("bone");
|
||||||
bone.setPivot(-8.5F, -0.1F, 1.5F);
|
bone.setPivot(-8.5F, -0.1F, 1.5F);
|
||||||
setRotationAngle(bone, -0.0524F, 0.0F, 0.0349F);
|
setRotationAngle(bone, -0.0524F, 0.0F, 0.0349F);
|
||||||
|
|
||||||
bone2 = bone.getChild("bone2");
|
ModelPart bone2 = bone.getChild("bone2");
|
||||||
bone2.setPivot(1.5F, -4.0F, 1.5F);
|
bone2.setPivot(1.5F, -4.0F, 1.5F);
|
||||||
setRotationAngle(bone2, -0.1222F, 0.0F, 0.0698F);
|
setRotationAngle(bone2, -0.1222F, 0.0F, 0.0698F);
|
||||||
|
|
||||||
bone3 = bone2.getChild("bone3");
|
ModelPart bone3 = bone2.getChild("bone3");
|
||||||
bone3.setPivot(1.5F, -4.0F, 1.5F);
|
bone3.setPivot(1.5F, -4.0F, 1.5F);
|
||||||
setRotationAngle(bone3, -0.2618F, 0.0F, 0.1047F);
|
setRotationAngle(bone3, -0.2618F, 0.0F, 0.1047F);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package eu.midnightdust.lib.config;
|
package eu.midnightdust.lib.config;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||||
import eu.midnightdust.core.config.MidnightLibConfig;
|
import eu.midnightdust.core.config.MidnightLibConfig;
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ import java.util.function.Function;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/* MidnightConfig v1.0.5
|
/* MidnightConfig v1.0.6
|
||||||
Single class config library - feel free to copy!
|
Single class config library - feel free to copy!
|
||||||
Changelog:
|
Changelog:
|
||||||
|
- 1.0.6:
|
||||||
|
- Abstract & Allow super ticks
|
||||||
- 1.0.5:
|
- 1.0.5:
|
||||||
- Custom lang keys
|
- Custom lang keys
|
||||||
- Transparent list background when in game
|
- Transparent list background when in game
|
||||||
@@ -66,7 +68,7 @@ import java.util.regex.Pattern;
|
|||||||
* Credits to Minenash */
|
* Credits to Minenash */
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class MidnightConfig {
|
public abstract class MidnightConfig {
|
||||||
public static boolean useTooltipForTitle = true; // Render title as tooltip or as simple text
|
public static boolean useTooltipForTitle = true; // Render title as tooltip or as simple text
|
||||||
|
|
||||||
private static final Pattern INTEGER_ONLY = Pattern.compile("(-?[0-9]*)");
|
private static final Pattern INTEGER_ONLY = Pattern.compile("(-?[0-9]*)");
|
||||||
@@ -213,6 +215,7 @@ public class MidnightConfig {
|
|||||||
// Real Time config update //
|
// Real Time config update //
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
for (EntryInfo info : entries)
|
for (EntryInfo info : entries)
|
||||||
try { info.field.set(null, info.value); }
|
try { info.field.set(null, info.value); }
|
||||||
catch (IllegalAccessException ignored) {}
|
catch (IllegalAccessException ignored) {}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 619 B |
|
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 497 B |
|
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 378 B |
@@ -40,7 +40,7 @@
|
|||||||
"custom": {
|
"custom": {
|
||||||
"modmenu": {
|
"modmenu": {
|
||||||
"links": {
|
"links": {
|
||||||
"modmenu.discord": "https://discord.gg/jAGnWYHm3r",
|
"modmenu.discord": "https://discord.midnightdust.eu/",
|
||||||
"modmenu.website": "https://www.midnightdust.eu/"
|
"modmenu.website": "https://www.midnightdust.eu/"
|
||||||
},
|
},
|
||||||
"badges": [ "library" ]
|
"badges": [ "library" ]
|
||||||
|
|||||||