generated from LabyMod/addon-template
-
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.
- Cleaned project and reduced boilerplate code
- Added visual hopper connections - Added Hopper connection mode widget - Added mod counter to "nearby" widget - Fixed a bug. /fahndung now works correctly
- Loading branch information
Showing
83 changed files
with
2,372 additions
and
1,829 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
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 |
---|---|---|
@@ -1,18 +1,10 @@ | ||
version = "0.1.0" | ||
|
||
plugins { | ||
id("java-library") | ||
} | ||
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType | ||
|
||
dependencies { | ||
labyProcessor() | ||
labyApi("api") | ||
} | ||
|
||
labyModProcessor { | ||
referenceType = net.labymod.gradle.core.processor.ReferenceType.INTERFACE | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
labyModAnnotationProcessor { | ||
referenceType = ReferenceType.INTERFACE | ||
} |
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 |
---|---|---|
@@ -1,91 +1,41 @@ | ||
plugins { | ||
id("java-library") | ||
id("net.labymod.gradle") | ||
id("net.labymod.gradle.addon") | ||
id("net.labymod.labygradle") | ||
id("net.labymod.labygradle.addon") | ||
} | ||
|
||
group = "tmb.randy" | ||
version = "1.5.3" | ||
|
||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) | ||
val versions = providers.gradleProperty("net.labymod.minecraft-versions").get().split(";") | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
group = "tmb.randy" | ||
version = providers.environmentVariable("VERSION").getOrElse("1.6.0") | ||
|
||
labyMod { | ||
defaultPackageName = "tmb.randy.tmbgriefergames" | ||
addonInfo { | ||
namespace = "tmbgriefergames" | ||
displayName = "GrieferGames Addon by TMB" | ||
author = "TMB Clan" | ||
description = "Eine Sammlung nützlicher Erweiterungen für das GrieferGames Netzwerk." | ||
minecraftVersion = "1.8.9,1.12.2" | ||
version = System.getenv().getOrDefault("VERSION", "1.1") | ||
} | ||
|
||
minecraft { | ||
registerVersions( | ||
"1.8.9", | ||
"1.12.2" | ||
) { version, provider -> | ||
configureRun(provider, version) | ||
} | ||
|
||
subprojects.forEach { | ||
if (it.name != "game-runner") { | ||
filter(it.name) | ||
registerVersion(versions.toTypedArray()) { | ||
runs { | ||
getByName("client") { | ||
// When the property is set to true, you can log in with a Minecraft account | ||
// devLogin = true | ||
} | ||
} | ||
} | ||
} | ||
|
||
addonDev { | ||
productionRelease() | ||
addonInfo { | ||
namespace = "tmbgriefergames" | ||
displayName = "GrieferGames Addon by TMB" | ||
author = "TMB Clan" | ||
description = "Eine Sammlung nützlicher Erweiterungen für das GrieferGames Netzwerk." | ||
minecraftVersion = "1.8.9,1.12.2" | ||
version = rootProject.version.toString() | ||
} | ||
} | ||
|
||
subprojects { | ||
plugins.apply("java-library") | ||
plugins.apply("net.labymod.gradle") | ||
plugins.apply("net.labymod.gradle.addon") | ||
|
||
repositories { | ||
maven("https://libraries.minecraft.net/") | ||
maven("https://repo.spongepowered.org/repository/maven-public/") | ||
mavenLocal() | ||
} | ||
} | ||
plugins.apply("net.labymod.labygradle") | ||
plugins.apply("net.labymod.labygradle.addon") | ||
|
||
fun configureRun(provider: net.labymod.gradle.core.minecraft.provider.VersionProvider, gameVersion: String) { | ||
provider.runConfiguration { | ||
mainClass = "net.minecraft.launchwrapper.Launch" | ||
jvmArgs("-Dnet.labymod.running-version=${gameVersion}") | ||
jvmArgs("-Dmixin.debug=true") | ||
jvmArgs("-Dnet.labymod.debugging.all=true") | ||
jvmArgs("-Dmixin.env.disableRefMap=true") | ||
|
||
args("--tweakClass", "net.labymod.core.loader.vanilla.launchwrapper.LabyModLaunchWrapperTweaker") | ||
args("--labymod-dev-environment", "true") | ||
args("--addon-dev-environment", "true") | ||
} | ||
|
||
provider.javaVersion = when (gameVersion) { | ||
else -> { | ||
JavaVersion.VERSION_21 | ||
} | ||
} | ||
|
||
provider.mixin { | ||
val mixinMinVersion = when (gameVersion) { | ||
"1.8.9", "1.12.2", "1.16.5" -> { | ||
"0.6.6" | ||
} | ||
|
||
else -> { | ||
"0.8.2" | ||
} | ||
} | ||
|
||
minVersion = mixinMinVersion | ||
} | ||
group = rootProject.group | ||
version = rootProject.version | ||
} |
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 |
---|---|---|
@@ -1,34 +1,13 @@ | ||
version = "0.1.0" | ||
|
||
plugins { | ||
id("java-library") | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
import net.labymod.labygradle.common.extension.LabyModAnnotationProcessorExtension.ReferenceType | ||
|
||
dependencies { | ||
labyProcessor() | ||
api(project(":api")) | ||
|
||
// If you want to use external libraries, you can do that here. | ||
// The dependencies that are specified here are loaded into your project but will also | ||
// automatically be downloaded by labymod, but only if the repository is public. | ||
// If it is private, you have to add and compile the dependency manually. | ||
// You have to specify the repository, there are getters for maven central and sonatype, every | ||
// other repository has to be specified with their url. Example: | ||
// maven(mavenCentral(), "org.apache.httpcomponents:httpclient:4.5.13") | ||
} | ||
|
||
labyModProcessor { | ||
referenceType = net.labymod.gradle.core.processor.ReferenceType.DEFAULT | ||
// An example of how to add an external dependency that is used by the addon. | ||
// addonMavenDependency("org.jeasy:easy-random:5.0.0") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
labyModAnnotationProcessor { | ||
referenceType = ReferenceType.DEFAULT | ||
} |
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
57 changes: 57 additions & 0 deletions
57
core/src/main/java/tmb/randy/tmbgriefergames/core/CBtracker.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,57 @@ | ||
package tmb.randy.tmbgriefergames.core; | ||
|
||
import net.labymod.api.Laby; | ||
import net.labymod.api.client.component.TextComponent; | ||
import net.labymod.api.client.scoreboard.Scoreboard; | ||
import net.labymod.api.client.scoreboard.ScoreboardTeam; | ||
import net.labymod.api.event.Subscribe; | ||
import net.labymod.api.event.client.scoreboard.ScoreboardTeamUpdateEvent; | ||
import tmb.randy.tmbgriefergames.core.enums.CBs; | ||
import tmb.randy.tmbgriefergames.core.events.CbChangedEvent; | ||
import javax.inject.Singleton; | ||
|
||
@Singleton | ||
public class CBtracker { | ||
private static CBs currentCB = CBs.NONE; | ||
|
||
@Subscribe | ||
public void worldEnterEvent(ScoreboardTeamUpdateEvent event) { | ||
if(!Addon.isGG()) return; | ||
Scoreboard scoreboard = Laby.labyAPI().minecraft().getScoreboard(); | ||
for (ScoreboardTeam team : scoreboard.getTeams()) { | ||
if(team.getTeamName().equals("server_value")) { | ||
String CBString = ((TextComponent)team.getPrefix()).getText(); | ||
|
||
CBs newCB = CBs.NONE; | ||
|
||
try { | ||
newCB = CBs.valueOf(CBString.toUpperCase()); | ||
} catch (IllegalArgumentException e) { | ||
Addon.getSharedInstance().logger().warn(e.getMessage()); | ||
} | ||
|
||
if(newCB != currentCB) { | ||
currentCB = newCB; | ||
Addon.getSharedInstance().logger().info("Joined CityBuild " + newCB.getName()); | ||
Laby.fireEvent(new CbChangedEvent(newCB)); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
public static CBs getCurrentCB() {return currentCB;} | ||
public static boolean isNatureWorldCB() {return currentCB == CBs.NATURE || currentCB == CBs.EXTREME;} | ||
public static boolean isPlotworldCB() { | ||
return switch (currentCB) { | ||
case WASSER, LAVA, PORTAL, LOBBY, NONE -> false; | ||
default -> true; | ||
}; | ||
} | ||
public static boolean canSendPayment() { | ||
return switch (currentCB) { | ||
case PORTAL, LOBBY, NONE -> false; | ||
default -> true; | ||
}; | ||
} | ||
} |
Oops, something went wrong.