mirror of
https://github.com/Aizistral-Studios/No-Chat-Restrictions.git
synced 2026-05-14 21:03:32 +08:00
Setup NeoForge project
This commit is contained in:
@@ -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!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
26
NeoForge/src/main/resources/META-INF/mods.toml
Normal file
26
NeoForge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,26 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[1,)"
|
||||
license="WTFPL"
|
||||
issueTrackerURL="https://github.com/Aizistral-Studios/No-Chat-Restrictions/issues"
|
||||
logoFile="ncr_logo.png"
|
||||
|
||||
[[mods]]
|
||||
modId="nochatrestrictions"
|
||||
version="${mod_version}"
|
||||
displayName="No Chat Restrictions"
|
||||
displayURL="https://modrinth.com/project/no-chat-restrictions"
|
||||
authors="Aizistral"
|
||||
description="A mod dedicated to removing restrictions around the use of multiplayer features, including in-game chat."
|
||||
|
||||
[[dependencies.nochatrestrictions]]
|
||||
modId="neoforge"
|
||||
mandatory=true
|
||||
versionRange="[20.2,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.nochatrestrictions]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="1.20.2"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
8
NeoForge/src/main/resources/pack.mcmeta
Normal file
8
NeoForge/src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": {
|
||||
"text": "No Chat Restrictions Resources"
|
||||
},
|
||||
"pack_format": 18
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user