-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the server crash, switched to official mappings because parchme…
…nt stopped working
- Loading branch information
1 parent
9d03f25
commit 9a99c20
Showing
32 changed files
with
177 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
src/main/java/me/andreasmelone/glowingeyes/GlowingEyes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/me/andreasmelone/glowingeyes/client/GlowingEyesClientEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/me/andreasmelone/glowingeyes/client/util/DynamicTextureCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package me.andreasmelone.glowingeyes.client.util; | ||
|
||
import com.mojang.blaze3d.platform.NativeImage; | ||
import me.andreasmelone.glowingeyes.GlowingEyes; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.renderer.texture.DynamicTexture; | ||
import net.minecraft.resources.ResourceLocation; | ||
|
||
import java.awt.*; | ||
import java.awt.image.BufferedImage; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
public class DynamicTextureCache { | ||
private DynamicTextureCache() { | ||
} | ||
|
||
private static final Map<Map<Point, Color>, ResourceLocation> cache = new HashMap<>(); | ||
|
||
public static ResourceLocation getTexture(Map<Point, Color> glowingEyesMap) { | ||
ResourceLocation texture = cache.get(glowingEyesMap); | ||
if (texture != null) { | ||
return texture; | ||
} | ||
|
||
texture = createTexture(glowingEyesMap); | ||
cache.put(glowingEyesMap, texture); | ||
return texture; | ||
} | ||
|
||
public static void clear() { | ||
for(ResourceLocation texture : cache.values()) { | ||
Minecraft.getInstance().getTextureManager().release(texture); | ||
} | ||
cache.clear(); | ||
} | ||
|
||
private static ResourceLocation createTexture(Map<Point, Color> glowingEyesMap) { | ||
BufferedImage image = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB); | ||
for (Map.Entry<Point, Color> entry : glowingEyesMap.entrySet()) { | ||
Point point = entry.getKey(); | ||
Color color = entry.getValue(); | ||
image.setRGB(point.x + 8, point.y + 8, color.getRGB()); | ||
} | ||
|
||
NativeImage nativeImage = GuiUtil.toNativeImage(image); | ||
DynamicTexture dynamicTexture = new DynamicTexture(nativeImage); | ||
return Minecraft.getInstance().getTextureManager().register(GlowingEyes.MOD_ID + "_" + UUID.randomUUID(), dynamicTexture); | ||
} | ||
|
||
private static <K, V> boolean areEqual(Map<K, V> map1, Map<K, V> map2) { | ||
if (map1.size() != map2.size()) { | ||
return false; | ||
} | ||
|
||
for (Map.Entry<K, V> entry : map1.entrySet()) { | ||
K key = entry.getKey(); | ||
V value = entry.getValue(); | ||
if (!map2.containsKey(key) || !map2.get(key).equals(value)) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
src/main/java/me/andreasmelone/glowingeyes/common/capability/eyes/GlowingEyesImpl.java
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...glowingeyes/common/GlowingEyesEvents.java → ...glowingeyes/server/GlowingEyesEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/common/capability/data/IPlayerData.java → ...s/server/capability/data/IPlayerData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...capability/data/PlayerDataCapability.java → ...capability/data/PlayerDataCapability.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...on/capability/data/PlayerDataHandler.java → ...er/capability/data/PlayerDataHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ommon/capability/data/PlayerDataImpl.java → ...erver/capability/data/PlayerDataImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.