Skip to content

Commit

Permalink
First translation
Browse files Browse the repository at this point in the history
  • Loading branch information
LIUKRAST committed Sep 5, 2024
1 parent 4b0ebca commit a270409
Show file tree
Hide file tree
Showing 470 changed files with 35,060 additions and 150 deletions.
17 changes: 16 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ version = mod_version
group = mod_group_id

repositories {
maven {
setUrl("https://maven.shedaniel.me/")
}
maven { url = 'https://maven.minecraftforge.net/' }
mavenLocal()
mavenCentral()
}

base {
Expand All @@ -37,7 +42,7 @@ neoForge {
}

// This line is optional. Access Transformers are automatically detected
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
Expand Down Expand Up @@ -133,6 +138,16 @@ dependencies {
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
compileOnly(annotationProcessor("org.projectlombok:lombok:1.18.30"))
implementation(additionalRuntimeClasspath("blue.endless:jankson:$jankson_version"))
implementation("com.moandjiezana.toml:toml4j:$toml4j_version")
implementation("org.exjson:xjs-data:$xjs_data_version")
implementation("org.exjson:xjs-compat:$xjs_compat_version")
implementation("com.personthecat:fresult:$fresult_version")
implementation("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}")

//implementation("com.github.glitchfiend:TerraBlender-neoforge:${terrablender_version}")

}

// This block of code expands all declared replace properties in the specified resource targets.
Expand Down
9 changes: 9 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ mod_version=1.0.0
mod_group_id=net.frozenblock.frozenlib
mod_authors=LiukRast, Lunade, Treetrain1
mod_description=NeoForge port of FrozenLib

toml4j_version=0.7.2
jankson_version=1.2.3
xjs_data_version=0.6
xjs_compat_version=0.8
fresult_version=3.1

cloth_config_version=15.0.130
terrablender_version=1.21-4.0.0.2
63 changes: 0 additions & 63 deletions src/main/java/net/frozenblock/lib/Config.java

This file was deleted.

13 changes: 12 additions & 1 deletion src/main/java/net/frozenblock/lib/FrozenBools.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package net.frozenblock.lib;

import net.neoforged.fml.ModList;
import net.neoforged.fml.loading.LoadingModList;
import net.neoforged.neoforgespi.language.IModInfo;

public class FrozenBools {

Expand All @@ -22,6 +24,15 @@ public class FrozenBools {
public static final boolean HAS_TERRALITH = hasMod("terralith");

public static boolean hasMod(String id) {
return ModList.get().getModFileById(id) != null;
if(ModList.get() == null) {
for(IModInfo info : LoadingModList.get().getMods()) {
if (info.getModId().equals(id)) return true;
}
} else {
for (IModInfo info : ModList.get().getMods()) {
if (info.getModId().equals(id)) return true;
}
}
return false;
}
}
63 changes: 51 additions & 12 deletions src/main/java/net/frozenblock/lib/FrozenClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,81 @@
*/
package net.frozenblock.lib;

import net.frozenblock.lib.entrypoint.api.FrozenClientEntrypoint;
import net.frozenblock.lib.event.api.ClientEvent;
import net.frozenblock.lib.integration.api.ModIntegrations;
import net.frozenblock.lib.menu.api.Panoramas;
import net.frozenblock.lib.networking.FrozenClientNetworking;
import net.frozenblock.lib.screenshake.api.client.ScreenShaker;
import net.frozenblock.lib.sound.api.FlyBySoundHub;
import net.frozenblock.lib.sound.impl.block_sound_group.BlockSoundGroupManager;
import net.frozenblock.lib.wind.api.ClientWindManager;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
import net.neoforged.neoforge.common.NeoForge;
import org.quiltmc.qsl.frozenblock.core.registry.impl.sync.client.ClientRegistrySync;
import org.quiltmc.qsl.frozenblock.misc.datafixerupper.impl.QuiltDataFixesInternals;

@OnlyIn(Dist.CLIENT)
@EventBusSubscriber(modid = FrozenSharedConstants.MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class FrozenClient {

@SubscribeEvent
public static void onInitializeClient(FMLClientSetupEvent event) {
/*ModIntegrations.initializePreFreeze(); // Mod integrations must run after normal mod initialization
ModIntegrations.initializePreFreeze(); // Mod integrations must run after normal mod initialization

// QUILT INIT
ClientFreezer.onInitializeClient();
ClientRegistrySync.registerHandlers();

// CONTINUE FROZENLIB INIT
registerClientEvents();
FrozenClientNetworking.registerClientReceivers();

// PARTICLES
ParticleFactoryRegistry particleRegistry = ParticleFactoryRegistry.getInstance();
// PARTICLES TODO: ADD PARTICLE FACTORY!
//ParticleFactoryRegistry particleRegistry = ParticleFactoryRegistry.getInstance();

particleRegistry.register(FrozenParticleTypes.DEBUG_POS, DebugPosParticle.Provider::new);
//particleRegistry.register(FrozenParticleTypes.DEBUG_POS, DebugPosParticle.Provider::new);

Panoramas.addPanorama(ResourceLocation.withDefaultNamespace("textures/gui/title/background/panorama"));

var resourceLoader = ResourceManagerHelper.get(PackType.CLIENT_RESOURCES);
resourceLoader.registerReloadListener(BlockSoundGroupManager.INSTANCE);
NeoForge.EVENT_BUS.post(new FrozenClientEntrypoint());

FrozenClientEntrypoint.EVENT.invoker().init(); // also includes dev init*/
}

private static void registerClientEvents() {
@SubscribeEvent
public static void registerClientResourceManager(RegisterClientReloadListenersEvent event) {
event.registerReloadListener(BlockSoundGroupManager.INSTANCE);
}

@SubscribeEvent
public static void clientFreezer(ClientEvent.Started event) {
FrozenLogUtils.log("[Quilt DFU API] Clientside DataFixer Registry is about to freeze", true);
QuiltDataFixesInternals.get().freeze();
FrozenLogUtils.log("[Quilt DFU API] Clientside DataFixer Registry was frozen", true);
}

@SubscribeEvent
public static void startWorldTick(ClientEvent.LevelStart event) {
ClientWindManager.tick(event.source);
ScreenShaker.tick(event.source);
FlyBySoundHub.update(Minecraft.getInstance(), Minecraft.getInstance().cameraEntity, true);
}

@SubscribeEvent
public static void clientTickStart(ClientEvent.Started event) {
ClientWindManager.clearAndSwitchWindDisturbances();
}

public static void disconnect() {
ScreenShaker.clear();
ClientWindManager.clearAllWindDisturbances();
}



}
98 changes: 98 additions & 0 deletions src/main/java/net/frozenblock/lib/FrozenEventListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package net.frozenblock.lib;

import net.frozenblock.lib.config.api.instance.Config;
import net.frozenblock.lib.config.api.registry.ConfigRegistry;
import net.frozenblock.lib.config.frozenlib_config.FrozenLibConfig;
import net.frozenblock.lib.config.impl.ConfigCommand;
import net.frozenblock.lib.entity.api.EntityUtils;
import net.frozenblock.lib.entity.api.command.ScaleEntityCommand;
import net.frozenblock.lib.event.api.PlayerJoinEvent;
import net.frozenblock.lib.event.api.RegistryFreezeEvent;
import net.frozenblock.lib.integration.api.ModIntegrations;
import net.frozenblock.lib.screenshake.api.ScreenShakeManager;
import net.frozenblock.lib.screenshake.api.command.ScreenShakeCommand;
import net.frozenblock.lib.screenshake.impl.ScreenShakeStorage;
import net.frozenblock.lib.tag.api.TagListCommand;
import net.frozenblock.lib.wind.api.WindManager;
import net.frozenblock.lib.wind.api.command.WindOverrideCommand;
import net.frozenblock.lib.wind.impl.WindStorage;
import net.minecraft.server.commands.WardenSpawnTrackerCommand;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.level.LevelEvent;
import net.neoforged.neoforge.event.tick.LevelTickEvent;

/**
* A basic eventListener class
* This class listens to NEO FORGE EVENT BUS only
* */
public class FrozenEventListener {
@SubscribeEvent
public static void levelLoad(LevelEvent.Load loadEvent) {
if(!loadEvent.getLevel().isClientSide()) {
final ServerLevel level = (ServerLevel) loadEvent.getLevel();
DimensionDataStorage dimensionDataStorage = level.getDataStorage();
WindManager windManager = WindManager.getWindManager(level);
dimensionDataStorage.computeIfAbsent(windManager.createData(), WindStorage.WIND_FILE_ID);
ScreenShakeManager screenShakeManager = ScreenShakeManager.getScreenShakeManager(level);
dimensionDataStorage.computeIfAbsent(screenShakeManager.createData(), ScreenShakeStorage.SCREEN_SHAKE_FILE_ID);
}
}

@SubscribeEvent
public static void levelUnload(LevelEvent.Unload unloadEvent) {
if(!unloadEvent.getLevel().isClientSide()) {
final ServerLevel serverLevel = (ServerLevel) unloadEvent.getLevel();
EntityUtils.clearEntitiesPerLevel(serverLevel);
WindManager.getWindManager(serverLevel).clearAllWindDisturbances();
}
}

@SubscribeEvent
public static void serverStartTick(LevelTickEvent.Pre pre) {
if(!pre.getLevel().isClientSide) {
final ServerLevel serverLevel = (ServerLevel) pre.getLevel();
WindManager.getWindManager(serverLevel).clearAndSwitchWindDisturbances();
WindManager.getWindManager(serverLevel).tick(serverLevel);
ScreenShakeManager.getScreenShakeManager(serverLevel).tick(serverLevel);
EntityUtils.populateEntitiesPerLevel(serverLevel);
}
}

@SubscribeEvent
public static void onPlayerAddedTopLevel(PlayerJoinEvent.Level event) {
WindManager windManager = WindManager.getWindManager(event.level);
windManager.sendSyncToPlayer(windManager.createSyncPacket(), event.player);
}

@SubscribeEvent
public static void startRegistryFreeze(RegistryFreezeEvent.Start event) {
if (!event.allRegistries) return;

ModIntegrations.initialize();
}

@SubscribeEvent
public static void endRegistryFreeze(RegistryFreezeEvent.End event) {
if (!event.allRegistries) return;

for (Config<?> config : ConfigRegistry.getAllConfigs()) {
config.save();
}
}

@SubscribeEvent
public static void registerCommands(RegisterCommandsEvent event) {
final var dispatcher = event.getDispatcher();
WindOverrideCommand.register(dispatcher);
ScreenShakeCommand.register(dispatcher);
ConfigCommand.register(dispatcher);
TagListCommand.register(dispatcher);
ScaleEntityCommand.register(dispatcher);

if(FrozenLibConfig.get().wardenSpawnTrackerCommand)
WardenSpawnTrackerCommand.register(dispatcher);
}
}
Loading

0 comments on commit a270409

Please sign in to comment.