Skip to content

Commit

Permalink
update mafglib version
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed May 28, 2024
1 parent f3addd2 commit 21f7350
Show file tree
Hide file tree
Showing 11 changed files with 530 additions and 63 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ group = project.maven_group
loom {
forge {
mixinConfigs = [
"forgematica.mixins.json"
"forgematica.mixins.json", "forgematica.forge.mixins.json"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ loom.platform=forge
yarn_mappings=1.20.1+build.3

# Mod Properties
mod_version=0.1.4
mod_version=0.1.5
maven_group=org.thinkingstudio.forgematica
archives_base_name=Forgematica
mod_id=forgematica
mod_author=ThinkingStudio

# Dependencies
malilib_version=0.1.9-mc1.20.1
malilib_version=0.1.11-mc1.20.1

# Publish Properties
modrinth_id=dCKRaeBC
Expand Down
19 changes: 1 addition & 18 deletions src/main/java/fi/dy/masa/litematica/Litematica.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
package fi.dy.masa.litematica;

import fi.dy.masa.malilib.compat.forge.ForgePlatformUtils;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.loading.FMLLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import fi.dy.masa.litematica.gui.GuiConfigs;
import fi.dy.masa.malilib.event.InitializationHandler;
import fi.dy.masa.litematica.config.Configs;

@Mod(Reference.MOD_ID)

public class Litematica {
public static final Logger logger = LogManager.getLogger(Reference.MOD_ID);

public Litematica() {
if (FMLLoader.getDist().isClient()) {
ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());
ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
return gui;
});
}
}

public static void debugLog(String msg, Object... args) {
if (Configs.Generic.DEBUG_LOGGING.getBooleanValue()) {
Litematica.logger.info(msg, args);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fi/dy/masa/litematica/gui/GuiConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GuiConfigs extends GuiConfigsBase
{
public GuiConfigs()
{
super(10, 50, Reference.MOD_ID, null, "litematica.gui.title.configs");
super(10, 50, Reference.MOD_ID, null, "litematica.gui.title.configs", Reference.MOD_NAME, Reference.MOD_VERSION);
}

@Override
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/thinkingstudio/forgematica/Forgematica.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package org.thinkingstudio.forgematica;

import fi.dy.masa.litematica.InitHandler;
import fi.dy.masa.litematica.Reference;
import fi.dy.masa.litematica.gui.GuiConfigs;
import fi.dy.masa.malilib.event.InitializationHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.loading.FMLLoader;
import org.thinkingstudio.mafglib.util.ForgePlatformUtils;

@Mod(Reference.MOD_ID)
public class Forgematica {
public Forgematica() {
if (FMLLoader.getDist().isClient()) {
ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());
ForgePlatformUtils.getInstance().registerModConfigScreen(Reference.MOD_ID, (screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
return gui;
});
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package fi.dy.masa.litematica.mixin.compat;
package org.thinkingstudio.forgematica.mixin;

import fi.dy.masa.litematica.world.WorldSchematic;
import net.minecraft.block.entity.BlockEntity;
import net.minecraftforge.client.model.data.ModelDataManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import fi.dy.masa.litematica.world.WorldSchematic;

@Mixin(ModelDataManager.class)
public abstract class MixinModelDataManager {

/**
* if we don't catch this Forge does stupid things
* it calls requestModelData on any client world when adding a BlockEntity
* but if it's not mc.world it crashes because model data may only
* it calls {@code requestModelData} on any client world when adding a BlockEntity
* but if it's not {@code mc.world} it crashes because model data may only
* be used on the current client world
*
* @author ZacSharp
Expand All @@ -23,10 +23,6 @@ public abstract class MixinModelDataManager {
*/
@Inject(method = "requestRefresh", at = @At("HEAD"), cancellable = true, remap = false)
public void requestRefresh(BlockEntity blockEntity, CallbackInfo cir) {
// if we don't catch this Forge does stupid things
// it calls requestModelData on any client world when adding a te
// but if it's not mc.world it crashes because model data may only
// be used on the current client world
if (blockEntity.getWorld() instanceof WorldSchematic) {
cir.cancel();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/forgematica/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"litematica.gui.title.area_selection_manager": "Area Selection Manager",
"litematica.gui.title.configure_schematic_placement": "Configure Schematic placement",
"litematica.gui.title.configure_schematic_sub_region": "Configure Placement Sub-Region",
"litematica.gui.title.configs": "Litematica Configs",
"litematica.gui.title.configs": "%s Configs - %s",
"litematica.gui.title.confirm_file_deletion": "Confirm file deletion",
"litematica.gui.title.copy_area_selection": "Copy Area Selection '%s'",
"litematica.gui.title.create_area_selection": "Create a new Area Selection",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/forgematica/lang/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
"litematica.gui.title.area_selection_manager": "Менеджер областей выделения",
"litematica.gui.title.configure_schematic_placement": "Настройка размещения схемы",
"litematica.gui.title.configure_schematic_sub_region": "Настройка размещения подрегиона",
"litematica.gui.title.configs": "Настройки Litematica",
"litematica.gui.title.configs": "Настройки %s - %s",
"litematica.gui.title.confirm_file_deletion": "Подтвердите удаление файла",
"litematica.gui.title.copy_area_selection": "Копировать область выделения \"%s\"",
"litematica.gui.title.create_area_selection": "Создать новую область выделения",
Expand Down
Loading

0 comments on commit 21f7350

Please sign in to comment.