This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 29c40b4
Showing
23 changed files
with
673 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.gradle/ | ||
build/ |
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,3 @@ | ||
[submodule "Versionfiles"] | ||
path = Versionfiles | ||
url = https://github.com/gbl/Versionfiles.git |
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,32 @@ | ||
# TL;DR | ||
|
||
- Get a version of gradle that's at least 4.10.2 | ||
- `git clone <repo>` | ||
- `git branch -r` to see available branches | ||
- `git checkout fabric_1_16` to select your branch | ||
- `git submodule init` | ||
- `git submodule update` | ||
- `/path/to/gradle build` | ||
|
||
# How to compile this mod | ||
|
||
Because I created several mods, which have some things in common, the structure of my mods is a bit different from the example mod that Fabric or Forge provide. | ||
|
||
In particular, I don't want the gradle files to be duplicated into every single mod repository, and some common files that contain version info for Fabric, its tools, and some library mods, have been moved to a (common) submodule. | ||
|
||
# Prerequisites | ||
|
||
You need a gradle installation which does not come with the mod. At the time of this writing, the version of gradle used is 4.10.2. Gradle 6.5 has been tested to work too, so versions between those *should* as well. | ||
|
||
You might already have gradle installed, especially when you're running Linux - if so, make sure it's new enough. For example, Ubuntu 18.04 has gradle 4.4.1 which is not. Run `gradle -version` to check. | ||
|
||
If you have the Fabric example mod installed, you can use the gradle installation from there. Else, download a release from https://gradle.org/releases/ (binary only is sufficient) and unpack it somewhere. | ||
|
||
# Versionfiles submodule | ||
|
||
All my mods use the same repository of files that match MineCraft, Fabric, and common libraries versions. This is included in the mod repository as a Versionfiles submodule, and you should get it when cloning the repo. Run `git submodule init`, then `git submodule update` to get the current version of the files. Do this after selecting your branch, see below. | ||
|
||
# Compiling the mod | ||
|
||
There are branches for the various versions of MineCraft that are supported by the mod. Run `git branch -r` to see which branches there are, then `git checkout branchname` without the `origin/` part, for example, `git checkout fabric_1_16`. | ||
|
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Guntram Blohm | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,26 @@ | ||
This mod will enlarge the advancements info UI, so it'll use most of your screen, not just a tiny part of it, especially when your GUI scale is high. | ||
|
||
This means more info visible at the same time, less scrolling, and a better overview. | ||
|
||
Also, it checks out which requirements you've met and which you haven't, and displays a list of those to the right of the UI. This makes it much easier to find what you have done and what you still need to do. | ||
|
||
For example, the "Discover every Biome" Advancement doesn't tell you what's still missing; this mod will help you go for that last biome you haven't visited. | ||
|
||
This works with data pack Advancements as well; here's an example from BlazeAndCave: | ||
|
||
 | ||
|
||
If the list to the right overflows, you can use your mouse scroll wheel to scroll. | ||
|
||
---------------------------------------------------------------------- | ||
|
||
Advancements, and their objectives, have their very own names, which may or may not correspond to MineCraft items, blocks, or entities. The mod tries its best to map those names to Minecraft objects, but in some cases, especially with Data Packs, that's just not possible. The mod will show the internal name in that case in the hope you're better at deciphering what's needed than the mod itself. | ||
|
||
For example, the objective of "The Parrots and the Bats" is named "bred", this will show as bred in the info box. | ||
|
||
|
||
This is the very first version of the mod, and as such, there are probably still bugs. Please report them! | ||
|
||
To make sure the mod doesn't slow down your minecraft, | ||
it has been optimized using | ||
[](https://www.ej-technologies.com/products/jprofiler/overview.html). |
Submodule Versionfiles
added at
11ab32
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,60 @@ | ||
plugins { | ||
id 'fabric-loom' version '0.4-SNAPSHOT' | ||
} | ||
|
||
repositories { | ||
maven { | ||
url = "https://maven.fabricmc.net/" | ||
} | ||
maven { | ||
url = "https://minecraft.guntram.de/maven/" | ||
} | ||
} | ||
|
||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
ext.Versions = new Properties() | ||
Versions.load(file("Versionfiles/mcversion-1.16.properties").newReader()) | ||
|
||
archivesBaseName = "advancementinfo" | ||
ext.projectVersion = "1.0" | ||
|
||
version = "${Versions['minecraft_version']}-fabric${Versions['fabric_versiononly']}-${project.projectVersion}" | ||
|
||
minecraft { | ||
refmapName = "advancementinfo-refmap.json"; | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
include "fabric.mod.json" | ||
expand "version": project.version | ||
} | ||
from(sourceSets.main.resources.srcDirs) { | ||
exclude "fabric.mod.json" | ||
} | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${Versions['minecraft_version']}" | ||
mappings "net.fabricmc:yarn:${Versions['yarn_mappings']}:v2" | ||
modCompile "net.fabricmc:fabric-loader:${Versions['loader_version']}" | ||
modCompile "net.fabricmc.fabric-api:fabric-api:${Versions['fabric_version']}" | ||
modCompile "io.github.prospector:modmenu:${Versions['modmenu_version']}" | ||
modCompile "de.guntram.mcmod:GBfabrictools:${Versions['gbfabrictools_version']}" | ||
include "de.guntram.mcmod:GBfabrictools:${Versions['gbfabrictools_version']}" | ||
} | ||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task | ||
// if it is present. | ||
// If you remove this task, sources will not be generated. | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
jar { | ||
from "LICENSE" | ||
} |
Binary file not shown.
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,10 @@ | ||
pluginManagement { | ||
repositories { | ||
jcenter() | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
gradlePluginPortal() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/de/guntram/mcmod/advancementinfo/AdvancementCriterion.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,30 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package de.guntram.mcmod.advancementinfo; | ||
|
||
import net.minecraft.text.Text; | ||
|
||
/** | ||
* | ||
* @author gbl | ||
*/ | ||
public class AdvancementCriterion { | ||
private Text name; | ||
private boolean obtained; | ||
|
||
AdvancementCriterion(Text name, boolean obtained) { | ||
this.name = name; | ||
this.obtained = obtained; | ||
} | ||
|
||
public boolean getObtained() { | ||
return obtained; | ||
} | ||
|
||
public Text getName() { | ||
return name; | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/main/java/de/guntram/mcmod/advancementinfo/AdvancementInfo.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,64 @@ | ||
package de.guntram.mcmod.advancementinfo; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.minecraft.client.gui.screen.advancement.AdvancementWidget; | ||
import net.minecraft.client.resource.language.I18n; | ||
import net.minecraft.text.LiteralText; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.text.TranslatableText; | ||
|
||
public class AdvancementInfo implements ClientModInitializer | ||
{ | ||
static final String MODID="advancementinfo"; | ||
static final String VERSION="@VERSION@"; | ||
|
||
static final public int AI_spaceX = 30; | ||
static final public int AI_spaceY = 30; | ||
static final public int AI_infoWidth = 120; | ||
|
||
static public AdvancementWidget mouseOver, mouseClicked; | ||
static public List<AdvancementCriterion> cachedClickList; | ||
|
||
public static List<AdvancementCriterion> getCriteriaList(AdvancementProgressSupplier widget) { | ||
List<AdvancementCriterion> result = new ArrayList<>(); | ||
addCriteria(result, widget.getProgress().getUnobtainedCriteria(), false); | ||
addCriteria(result, widget.getProgress().getObtainedCriteria(), true); | ||
return result; | ||
} | ||
|
||
private static void addCriteria(List<AdvancementCriterion> result, Iterable<String> criteria, boolean obtained) { | ||
final String[] prefixes = new String[] { "item.minecraft", "block.minecraft", "entity.minecraft", "container", "effect.minecraft", "biome.minecraft" }; | ||
// criteria is actually a List<> .. but play nice | ||
ArrayList<String> sorted=new ArrayList<>(); | ||
for (String s:criteria) { | ||
sorted.add(s); | ||
} | ||
Collections.sort(sorted); | ||
for (String s: sorted) { | ||
Text translation = null; | ||
String key = s; | ||
if (key.startsWith("minecraft:")) { | ||
key=key.substring(10); | ||
} | ||
for (String prefix: prefixes) { | ||
if (I18n.hasTranslation(prefix+"."+key)) { | ||
translation = new TranslatableText(prefix+"."+key); | ||
break; | ||
} | ||
} | ||
if (translation == null) { | ||
translation = new LiteralText(key); | ||
} | ||
result.add(new AdvancementCriterion(translation, obtained)); | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public void onInitializeClient() | ||
{ | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/de/guntram/mcmod/advancementinfo/AdvancementProgressSupplier.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,16 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package de.guntram.mcmod.advancementinfo; | ||
|
||
import net.minecraft.advancement.AdvancementProgress; | ||
|
||
/** | ||
* | ||
* @author gbl | ||
*/ | ||
public interface AdvancementProgressSupplier { | ||
public AdvancementProgress getProgress(); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/de/guntram/mcmod/advancementinfo/IteratorReceiver.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,14 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package de.guntram.mcmod.advancementinfo; | ||
|
||
/** | ||
* | ||
* @author gbl | ||
*/ | ||
public interface IteratorReceiver { | ||
public void accept(int pos, int len); | ||
} |
Oops, something went wrong.