aboutsummaryrefslogtreecommitdiffstats
path: root/NeoForge/src/main/java/com/aizistral
diff options
context:
space:
mode:
Diffstat (limited to 'NeoForge/src/main/java/com/aizistral')
-rw-r--r--NeoForge/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java41
-rw-r--r--NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java8
-rw-r--r--NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java79
3 files changed, 128 insertions, 0 deletions
diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java
new file mode 100644
index 0000000..687444f
--- /dev/null
+++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/NoChatRestrictions.java
@@ -0,0 +1,41 @@
+package com.aizistral.nochatrestrictions;
+
+import com.aizistral.nochatrestrictions.core.NCRCore;
+import com.mojang.logging.LogUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.core.registries.Registries;
+import net.minecraft.world.food.FoodProperties;
+import net.minecraft.world.item.BlockItem;
+import net.minecraft.world.item.CreativeModeTab;
+import net.minecraft.world.item.CreativeModeTabs;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.state.BlockBehaviour;
+import net.minecraft.world.level.material.MapColor;
+import net.neoforged.api.distmarker.Dist;
+import net.neoforged.bus.api.IEventBus;
+import net.neoforged.bus.api.SubscribeEvent;
+import net.neoforged.fml.ModLoadingContext;
+import net.neoforged.fml.common.Mod;
+import net.neoforged.fml.config.ModConfig;
+import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
+import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
+import net.neoforged.neoforge.common.NeoForge;
+import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
+import net.neoforged.neoforge.event.server.ServerStartingEvent;
+import net.neoforged.neoforge.registries.DeferredBlock;
+import net.neoforged.neoforge.registries.DeferredHolder;
+import net.neoforged.neoforge.registries.DeferredItem;
+import net.neoforged.neoforge.registries.DeferredRegister;
+import org.slf4j.Logger;
+
+@Mod("nochatrestrictions")
+public class NoChatRestrictions {
+
+ public NoChatRestrictions() {
+ NCRCore.LOGGER.info("NoChatRestrictions NeoForge mod initialized!");
+ }
+
+}
diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java
new file mode 100644
index 0000000..40521d3
--- /dev/null
+++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java
@@ -0,0 +1,8 @@
+package com.aizistral.nochatrestrictions.core;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class NCRCore {
+ public static final Logger LOGGER = LogManager.getLogger("NoChatRestrictions");
+}
diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java
new file mode 100644
index 0000000..73ae2c1
--- /dev/null
+++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java
@@ -0,0 +1,79 @@
+package com.aizistral.nochatrestrictions.core;
+
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.Executor;
+
+import com.google.common.collect.ImmutableSet;
+import com.mojang.authlib.minecraft.TelemetrySession;
+import com.mojang.authlib.minecraft.UserApiService;
+import com.mojang.authlib.minecraft.report.AbuseReportLimits;
+import com.mojang.authlib.yggdrasil.request.AbuseReportRequest;
+import com.mojang.authlib.yggdrasil.response.KeyPairResponse;
+
+public class WrappedUserApiService implements UserApiService {
+ private static final UserProperties FORCED_PROPERTIES;
+
+ static {
+ ImmutableSet.Builder<UserFlag> flags = ImmutableSet.builder();
+
+ flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat
+ flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu
+ flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu
+ // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons
+ // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks
+ // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either
+
+ FORCED_PROPERTIES = new UserProperties(flags.build(), Map.of());
+ }
+
+ private final UserApiService service;
+
+ public WrappedUserApiService(UserApiService service) {
+ this.service = service;
+ }
+
+ @Override
+ public UserProperties properties() {
+ return FORCED_PROPERTIES;
+ }
+
+ @Override
+ public boolean isBlockedPlayer(UUID playerID) {
+ return this.service.isBlockedPlayer(playerID);
+ }
+
+ @Override
+ public void refreshBlockList() {
+ this.service.refreshBlockList();
+ }
+
+ @Override
+ public TelemetrySession newTelemetrySession(Executor executor) {
+ return TelemetrySession.DISABLED;
+ }
+
+ // Methods below primarily concern chat reporting. Not doing anything with them
+ // here as that's out of scope for this mod, it's more of a No Chat Reports thing
+
+ @Override
+ public KeyPairResponse getKeyPair() {
+ return this.service.getKeyPair();
+ }
+
+ @Override
+ public void reportAbuse(AbuseReportRequest request) {
+ this.service.reportAbuse(request);
+ }
+
+ @Override
+ public boolean canSendReports() {
+ return this.service.canSendReports();
+ }
+
+ @Override
+ public AbuseReportLimits getAbuseReportLimits() {
+ return this.service.getAbuseReportLimits();
+ }
+
+}