Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 7 additions & 41 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ buildscript {
}
}

plugins { // for essential partner mod
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
}

apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
Expand Down Expand Up @@ -133,7 +129,11 @@ repositories {
}
}
maven {
url = "https://repo.essential.gg/public"
// Simple Voice Chat API, for the optional voice bridge
url = "https://maven.maxhenkel.de/repository/public"
content {
includeGroup "de.maxhenkel.voicechat"
}
}
mavenCentral()
}
Expand All @@ -147,6 +147,7 @@ dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.9.2'

minecraft 'net.minecraftforge:forge:1.20.1-47.4.0'
compileOnly 'de.maxhenkel.voicechat:voicechat-api:2.5.0'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}

Expand All @@ -158,8 +159,7 @@ mixin {
jar {
manifest {
attributes([
// Declared below due to Essential Partner Mod
// "MixinConfigs": "reignofnether.mixins.json",
"MixinConfigs": "reignofnether.mixins.json",
"Specification-Title": "reignofnether",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
Expand Down Expand Up @@ -195,37 +195,3 @@ tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
options.compilerArgs += ["-Xmaxerrs", "500000"]
}



// ESSENTIAL PARTNER MOD STUFF

var essentialPartnerModPackage = 'com.solegendary.reignofnether.essentialpartnermod'

tasks.jar {
manifest.attributes(
// The main entry point of the Essential Partner mod are its mixins.
// Note that you may have to re-declare your own mixin configs here too depending on your build system.
'MixinConfigs': "${essentialPartnerModPackage.replace('.', '/')}/mixins.json,reignofnether.mixins.json",
)
}

var essentialPartnerModDep = 'gg.essential:partner-mod-integration-1.20.1-forge:1.0.2'

tasks.register('relocatedEssentialPartnerModJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
destinationDirectory.set(layout.buildDirectory.dir('devlibs'))
archiveFileName.set('essentialpartner.jar')
inputs.property('essentialPartnerModPackage', essentialPartnerModPackage)
var configuration = project.configurations.detachedConfiguration(project.dependencies.create(essentialPartnerModDep))
dependsOn(configuration)
from({ configuration.collect { zipTree(it) } })
exclude('mcmod.info', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml', 'pack.mcmeta', 'gg/essential/partnermod/EssentialPartnerMod.class')
relocate('gg.essential.partnermod', essentialPartnerModPackage)
filesMatching('gg/essential/partnermod/mixins.json') {
filter { it.replace('gg.essential.partnermod', essentialPartnerModPackage) }
}
}

tasks.jar {
from(relocatedEssentialPartnerModJar.archiveFile.map { zipTree(it) })
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ClientModConfigs {
public static void registerClientConfigs(FMLJavaModLoadingContext mlctx) {
mlctx.registerConfig(ModConfig.Type.CLIENT,
ReignOfNetherClientConfigs.SPEC,
"reignofnether-client-" + ReignOfNether.VERSION_STRING + ".toml");
"reignofnether-client.toml");

mlctx.registerExtensionPoint(
ConfigScreenHandler.ConfigScreenFactory.class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.solegendary.reignofnether;

import com.solegendary.reignofnether.blocks.BlockClientEvents;
import com.solegendary.reignofnether.blocks.InvisibleBlockRenderer;
import com.solegendary.reignofnether.config.ReignOfNetherClientConfigs;
import com.solegendary.reignofnether.orthoview.OrthoviewClientEvents;
import com.solegendary.reignofnether.blocks.SkullTypes;
import com.solegendary.reignofnether.building.BuildingPlacement;
import com.solegendary.reignofnether.building.BuildingUtils;
Expand Down Expand Up @@ -181,9 +184,12 @@
@SubscribeEvent
@OnlyIn(Dist.CLIENT)
public static void onClientSetupEvent(FMLClientSetupEvent evt) {
// read on hot render paths, so kept in statics; the toggles write them back
OrthoviewClientEvents.hideLeavesMethod = ReignOfNetherClientConfigs.HIDE_LEAVES.get();
BlockClientEvents.nightCircleMode = ReignOfNetherClientConfigs.NIGHT_CIRCLES.get();
evt.enqueueWork(() -> {
MenuScreens.register(ContainerRegistrar.TOPDOWNGUI_CONTAINER.get(), TopdownGui::new);
ItemBlockRenderTypes.setRenderLayer(

Check warning on line 192 in src/main/java/com/solegendary/reignofnether/ClientModEvents.java

View workflow job for this annotation

GitHub Actions / build (17, ubuntu-latest)

[removal] setRenderLayer(Block,RenderType) in ItemBlockRenderTypes has been deprecated and marked for removal
BlockRegistrar.UNEXTINGUISHABLE_SOUL_FIRE.get(),
RenderType.cutout()
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.solegendary.reignofnether.ability;

import com.solegendary.reignofnether.player.PlayerRoles;
import com.solegendary.reignofnether.ReignOfNether;
import com.solegendary.reignofnether.registrars.PacketHandler;
import com.solegendary.reignofnether.unit.UnitAction;
Expand Down Expand Up @@ -55,7 +56,7 @@ public boolean handle(Supplier<NetworkEvent.Context> ctx) {
for (LivingEntity entity : UnitServerEvents.getAllUnits()) {
if (entity.getId() == this.unitId && entity instanceof Unit unit) {

if (!player.getName().getString().equals(unit.getOwnerName())) {
if (!PlayerRoles.ownerOf(player.getName().getString()).equals(unit.getOwnerName())) {
ReignOfNether.LOGGER.warn("AbilityServerboundPacket: Tried to process packet from " + player.getName() + " for: " + unit.getOwnerName());
success.set(false);
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.solegendary.reignofnether.ability;

import com.solegendary.reignofnether.player.PlayerRoles;
import com.solegendary.reignofnether.ReignOfNether;
import com.solegendary.reignofnether.building.BuildingClientEvents;
import com.solegendary.reignofnether.building.BuildingPlacement;
Expand Down Expand Up @@ -67,7 +68,7 @@ public boolean handle(Supplier<NetworkEvent.Context> ctx) {
}
BuildingPlacement building = BuildingUtils.findBuilding(false, buildingPos);
if (building != null) {
if (!player.getName().getString().equals(building.ownerName)) {
if (!PlayerRoles.ownerOf(player.getName().getString()).equals(building.ownerName)) {
ReignOfNether.LOGGER.warn("BuildingAbilityServerboundPacket: Tried to process packet from " + player.getName() + " for: " + building.ownerName);
success.set(false);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,28 @@

import com.solegendary.reignofnether.gamerules.GameruleClient;
import com.solegendary.reignofnether.player.PlayerClientEvents;
import com.solegendary.reignofnether.player.PlayerRolesClient;
import com.solegendary.reignofnether.unit.interfaces.Unit;
import com.solegendary.reignofnether.util.WorldState;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.LivingEntity;

import java.util.*;

public class AlliancesClient {

static {
WorldState.onClientReset(AlliancesClient::resetAllAlliances);
}
private static final Minecraft MC = Minecraft.getInstance();

private static final Map<String, Set<String>> alliances = new HashMap<>();
public static final Set<String> inboundPendingAlliances = new HashSet<>();
public static final Set<String> outboundPendingAlliances = new HashSet<>();
public static final Set<String> inboundPendingAlliances = WorldState.client(new HashSet<>());
public static final Set<String> outboundPendingAlliances = WorldState.client(new HashSet<>());
public static final HashSet<String> playersWithAlliedControl = new HashSet<>();

public static boolean sharingAllyControl() {
return MC.player != null && AlliancesClient.playersWithAlliedControl.contains(MC.player.getName().getString());
}
public static boolean canControlAlly(LivingEntity entity) {
return entity instanceof Unit unit && canControlAlly(unit.getOwnerName());
}
public static boolean canControlAlly(Unit unit) {
return canControlAlly(unit.getOwnerName());
}
public static boolean canControlAlly(String ownerName) {
return MC.player != null &&
(AlliancesClient.isAllied(MC.player.getName().getString(), ownerName) &&
AlliancesClient.playersWithAlliedControl.contains(ownerName));
return MC.player != null && playersWithAlliedControl.contains(PlayerRolesClient.myOwner());
}

public static void addAlliance(String owner1, String owner2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,18 @@
import com.solegendary.reignofnether.scenario.ScenarioServerEvents;
import com.solegendary.reignofnether.scenario.ScenarioUtils;
import com.solegendary.reignofnether.unit.interfaces.Unit;
import com.solegendary.reignofnether.util.WorldState;
import net.minecraft.world.entity.LivingEntity;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.server.ServerStoppedEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

import java.util.*;

public class AlliancesServerEvents {
private static final Map<String, Set<String>> alliances = new HashMap<>();
public static final Map<String, Set<String>> pendingAlliances = new HashMap<>();
public static final HashSet<String> playersWithAlliedControl = new HashSet<>();
private static final Map<String, Set<String>> alliances = WorldState.server(new HashMap<>());
public static final Map<String, Set<String>> pendingAlliances = WorldState.server(new HashMap<>());
public static final HashSet<String> playersWithAlliedControl = WorldState.server(new HashSet<>());

public static boolean canControlAlly(String player, LivingEntity entity) {
return entity instanceof Unit unit && canControlAlly(player, unit.getOwnerName());
}
public static boolean canControlAlly(String player, Unit unit) {
return canControlAlly(player, unit.getOwnerName());
}
public static boolean canControlAlly(String player, String ownerName) {
return (AlliancesServerEvents.isAllied(player, ownerName) &&
AlliancesServerEvents.playersWithAlliedControl.contains(ownerName));
}

public static void addAlliance(String owner1, String owner2) {
if (!owner1.equals(owner2)) {
Expand Down Expand Up @@ -144,12 +134,6 @@ public static void syncAlliances() {
}

// statics outlive the world: clear them so the next world opened in this game starts clean
@SubscribeEvent
public static void onServerStopped(ServerStoppedEvent evt) {
alliances.clear();
pendingAlliances.clear();
playersWithAlliedControl.clear();
}

@SubscribeEvent
public static void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent evt) {
Expand Down
Loading
Loading