Skip to content

Commit

Permalink
Merge branch 'master' into unlimited
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulldog83 committed Jul 7, 2020
2 parents ad8b880 + 09c1aa0 commit ce7e06d
Show file tree
Hide file tree
Showing 16 changed files with 386 additions and 147 deletions.
72 changes: 72 additions & 0 deletions curseforge.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<p style="font-size: 14px;">Here's a minimap/informational mod for Minecraft 1.15.2+ with Fabric.</p>
<p><a href="https://www.curseforge.com/minecraft/mc-mods/fabric-api"><img src="https://i.imgur.com/Ol1Tcf8.png" alt="" width="128" height="43" /></a></p>
<p>&nbsp;</p>
<p style="text-decoration: underline; font-size: 14px;"><strong>Features:</strong></p>
<div class="spoiler">
<table>
<tbody>
<tr>
<td>
<p><strong>Advanced Info:</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/300/31/310/172/2020-06-29_11.png" alt="" width="306" height="172" /></p>
</td>
<td>&nbsp;</td>
<td>
<p><strong>Round map:</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/301/297/310/172/2020-07-06_15.png" /></p>
</td>
</tr>
<tr>
<td>
<p><strong>Caves and Nether render:</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/279/269/310/172/caves_render.png" alt="" width="153" height="172" /><img src="https://media.forgecdn.net/attachments/thumbnails/279/270/310/172/render_nether.png" alt="" width="152" height="172" /></p>
</td>
<td>&nbsp;</td>
<td>
<p><strong>Map scaling:</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/279/271/310/172/map_scaling_1.png" alt="" width="155" height="172" /><img src="https://media.forgecdn.net/attachments/thumbnails/279/272/310/172/map_scaling_2.png" alt="" width="151" height="172" /></p>
</td>
</tr>
<tr>
<td>
<p><strong>3D entities radar (reduces FPS, disabled by default):</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/279/274/310/172/3d_models.png" alt="" width="153" height="172" /></p>
</td>
<td>&nbsp;</td>
<td>
<p><strong>Waypoints with ingame rendering:</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/279/273/310/172/2020-02-20_09.png" alt="" width="288" height="172" /></p>
</td>
</tr>
<tr>
<td>
<p><strong>Moved status effects icons with timers:</strong></p>
<p><img src="https://media.forgecdn.net/attachments/thumbnails/279/277/310/172/2020-02-20_14.png" alt="" width="289" height="172" /></p>
</td>
<td>&nbsp;</td>
<td>
<p><strong>Map orientation by the player's view direction:</strong></p>
<p><strong><img src="https://media.forgecdn.net/attachments/thumbnails/281/354/310/172/2020-03-11_12.png" alt="" width="142" height="172" /></strong></p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p style="font-size: 14px;">All features are configurable and can be disabled. Mod supports <strong><a style="font-size: 14px; font-weight: bold;" href="https://www.curseforge.com/minecraft/mc-mods/modmenu">Mod Menu</a></strong> ingame config.</p>
<p style="font-size: 14px;">Map has changable skins (special thanks <strong><a style="font-size: 14px; font-weight: bold;" href="https://www.curseforge.com/members/paulevs">paulevs</a></strong> for several of these).</p>
<p>&nbsp;</p>
<p style="font-size: 14px;">
<strong>Now avaliable map version with all features (entities radar and caves mapping) unlocked.</strong><br />
<strong>Looks for "<a style="font-size: 14px; font-weight: bold;" href="https://www.curseforge.com/minecraft/mc-mods/just-map-unlimited">Just Map Unlimited</a>" for the 'unlimited' version.</strong>
</p>
<p>&nbsp;</p>
<p style="font-size: 14px;">By default on the dedicated servers disabled Caves maps and Entities radar.</p>
<p style="font-size: 14px;">It can be enabled via send to players a system (from the server) message with color codes (accepts '&sect;', '&amp;' or '$' symbols):</p>
<p style="font-size: 14px;">* &sect;0&sect;0: prefix<br /> * &sect;f&sect;f: suffix<br /> *<br /> * &sect;a: cave mapping<br /> * &sect;b: entities radar (all)<br /> * &sect;c: entities radar (player)<br /> * &sect;d: entities radar (animal)<br /> * &sect;e: entities radar (mob)<br /> * &sect;s: slime chunks<br /> * &sect;t: teleportation<br /> *<br /> * &sect;1: enable<br /> * &sect;0: disable</p>
<p style="text-decoration: underline; font-size: 14px;">Example:</p>
<p>&sect;0&sect;0&sect;a&sect;1&sect;b&sect;1&sect;f&sect;f //Enable Cave mapping and entities radar</p>
<p>&nbsp;</p>
<p style="font-size: 14px;">Translated to:&nbsp;Chinese Simplified,&nbsp;Chinese Traditional,&nbsp;Czech,&nbsp;Belarusian,&nbsp;Estonian,&nbsp;Italian.</p>
<p>&nbsp;</p>
<p style="font-size: 14px;"><strong>You can help to translate the mod with Crowdin:&nbsp;<a style="font-size: 14px; font-weight: bold;" href="https://crowdin.com/project/justmap">https://crowdin.com/project/justmap</a></strong></p>
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import ru.bulldog.justmap.client.JustMapClient;
import ru.bulldog.justmap.config.ConfigKeeper.EnumEntry;
import ru.bulldog.justmap.map.DirectionArrow;
import ru.bulldog.justmap.map.minimap.MapSkin;
import ru.bulldog.justmap.map.minimap.Minimap;
import ru.bulldog.justmap.map.minimap.skin.MapSkin;
import ru.bulldog.justmap.util.ScreenPosition;

public final class ConfigFactory {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
package ru.bulldog.justmap.map.icon;
package ru.bulldog.justmap.client.render;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier;

import ru.bulldog.justmap.util.RenderUtil;

public abstract class AbstractIcon extends Sprite {
public abstract class Image {

protected static TextureManager textureManager = MinecraftClient.getInstance().getTextureManager();

protected AbstractIcon(SpriteAtlasTexture spriteAtlasTexture, Info info, int i, int j, int k, int l, int m, NativeImage nativeImage) {
super(spriteAtlasTexture, info, i, j, k, l, m, nativeImage);
protected final NativeImage image;
protected Identifier textureId;
protected int width;
protected int height;

protected Image(Identifier id, NativeImage image) {
this.width = image.getWidth();
this.height = image.getHeight();
this.textureId = id;
this.image = image;
}

public abstract void draw(double x, double y, int w, int h);
public abstract void draw(MatrixStack matrix, double x, double y, int w, int h);

public void draw(double x, double y) {
MatrixStack matrix = new MatrixStack();
this.draw(matrix, x, y, this.getWidth(), this.getHeight());
public int getWidth() {
return this.width;
}

public int getHeight() {
return this.height;
}

public void draw(MatrixStack matrix, double x, double y) {
public Identifier getId() {
return this.textureId;
}

public void bindTexture() {
textureManager.bindTexture(textureId);
}

public void draw(double x, double y) {
MatrixStack matrix = new MatrixStack();
this.draw(matrix, x, y, this.getWidth(), this.getHeight());
}

Expand All @@ -38,6 +57,6 @@ public void draw(MatrixStack matrix, double x, double y, int size) {
}

protected void draw(MatrixStack matrix, double x, double y, float w, float h) {
RenderUtil.drawSprite(matrix, this, x, y, w, h);
RenderUtil.drawImage(matrix, this, x, y, w, h);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import ru.bulldog.justmap.map.icon.PlayerIcon;
import ru.bulldog.justmap.map.icon.WaypointIcon;
import ru.bulldog.justmap.map.minimap.MapPlayerManager;
import ru.bulldog.justmap.map.minimap.MapSkin;
import ru.bulldog.justmap.map.minimap.Minimap;
import ru.bulldog.justmap.map.minimap.skin.MapSkin;
import ru.bulldog.justmap.util.RenderUtil.TextAlignment;
import ru.bulldog.justmap.util.Colors;
import ru.bulldog.justmap.util.RenderUtil;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/ru/bulldog/justmap/config/ConfigWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import net.fabricmc.loader.api.FabricLoader;
import ru.bulldog.justmap.JustMap;
import ru.bulldog.justmap.util.JsonFactory;
import ru.bulldog.justmap.util.StorageUtil;

public class ConfigWriter extends JsonFactory {

private final static File CONFIG_DIR = FabricLoader.getInstance().getConfigDirectory();
private final static File CONFIG_FILE = new File(CONFIG_DIR, "/" + JustMap.MODID + ".json");
private final static File CONFIG_FILE = new File(StorageUtil.configDir(), JustMap.MODID + ".json");

private static JsonObject configObject;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/ru/bulldog/justmap/map/MapGameRules.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private static GameRules.Key<GameRules.BooleanRule> register(String name, boolea
* §d: entities radar (animal)
* §e: entities radar (hostile)
* §s: slime chunks
* §t: teleportation
*
* §1: enable
* §0: disable
Expand Down
26 changes: 12 additions & 14 deletions src/main/java/ru/bulldog/justmap/map/data/MapCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ public static void setLayerLevel(int level) {

public static MapCache get() {
World world = minecraft.world;
if (minecraft.isIntegratedServerRunning() && world != null) {
world = minecraft.getServer().getWorld(minecraft.world.getRegistryKey());
}
if (currentWorld == null || (world != null &&
world != currentWorld)) {

currentWorld = world;
if (world != null) {
if (minecraft.isIntegratedServerRunning()) {
World serverWorld = minecraft.getServer().getWorld(world.getRegistryKey());
if (serverWorld != null) {
world = serverWorld;
}
}
if (!world.equals(currentWorld)) {
currentWorld = world;
}
}

if (currentWorld == null) return null;

Identifier dimId = currentWorld.getDimensionRegistryKey().getValue();
Expand Down Expand Up @@ -207,17 +209,13 @@ private Map<ChunkPos, MapChunk> getChunks() {
return this.chunks;
}

public MapChunk getCurrentChunk(ChunkPos chunkPos) {
return this.getChunk(currentLayer, currentLevel, chunkPos.x, chunkPos.z);
}

public MapChunk getCurrentChunk(int posX, int posZ) {
return this.getChunk(currentLayer, currentLevel, posX, posZ);
}

public MapChunk getChunk(Layer.Type layer, int level, int posX, int posZ) {
ChunkPos chunkPos = new ChunkPos(posX, posZ);
ChunkPos chunkPos = new ChunkPos(posX, posZ);

MapChunk mapChunk;
if (chunks.containsKey(chunkPos)) {
mapChunk = this.chunks.get(chunkPos);
Expand Down
Loading

0 comments on commit ce7e06d

Please sign in to comment.