Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
95 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/slimeknights/tmechworks/client/ClientProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,48 @@ | ||
package slimeknights.tmechworks.client; | ||
|
||
import net.minecraftforge.fml.ExtensionPoint; | ||
import net.minecraftforge.fml.ModContainer; | ||
import net.minecraftforge.fml.ModList; | ||
import net.minecraftforge.fml.loading.moddiscovery.ModInfo; | ||
import slimeknights.tmechworks.TMechworks; | ||
import slimeknights.tmechworks.common.CommonProxy; | ||
import slimeknights.tmechworks.common.MechworksContent; | ||
import slimeknights.tmechworks.common.event.ModelBakeEventListener; | ||
|
||
import java.util.List; | ||
|
||
public class ClientProxy extends CommonProxy { | ||
@Override | ||
public void preInit() { | ||
super.preInit(); | ||
} | ||
|
||
@Override | ||
public void init() { | ||
super.init(); | ||
|
||
ModelBakeEventListener.registerDisguiseBlock(MechworksContent.Blocks.drawbridge.getRegistryName()); | ||
ModelBakeEventListener.registerDisguiseBlock(MechworksContent.Blocks.firestarter.getRegistryName()); | ||
} | ||
|
||
@Override | ||
public void setupClient() { | ||
// TODO mod config gui | ||
// ModList.get().getModContainerById(TMechworks.modId).ifPresent(c -> c.registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (mc, scr) -> scr)); | ||
} | ||
|
||
static { | ||
List<ModInfo> mods = ModList.get().getMods(); | ||
ModInfo info = mods.stream().filter(x -> x.getModId().equals(TMechworks.modId)).findFirst().orElse(null); | ||
|
||
if (info != null) { | ||
ModInfo newInfo = new ModInfo(info.getOwningFile(), info.getModConfig()) { | ||
public boolean hasConfigUI() { | ||
return true; | ||
} | ||
}; | ||
|
||
mods.set(mods.indexOf(info), newInfo); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,8 @@ public void init() { | |
public void postInit() { | ||
|
||
} | ||
|
||
public void setupClient() { | ||
|
||
} | ||
} |
46 changes: 38 additions & 8 deletions
46
src/main/java/slimeknights/tmechworks/common/MechworksConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,45 @@ | ||
package slimeknights.tmechworks.common; | ||
|
||
import com.electronwill.nightconfig.core.file.CommentedFileConfig; | ||
import net.minecraftforge.common.ForgeConfigSpec; | ||
import slimeknights.tmechworks.TMechworks; | ||
|
||
import java.nio.file.Paths; | ||
|
||
public class MechworksConfig { | ||
private static MechworksConfig instance = new MechworksConfig(); | ||
public static void load() { | ||
SPEC.setConfig(CommentedFileConfig.builder(Paths.get("config", "Tinkers Mechworks.toml")).build()); | ||
} | ||
|
||
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder(); | ||
|
||
// Total extend length designed to be no higher than 64 blocks for advanced drawbridges, therefore going higher than 64 may produce weird results | ||
public int drawbridgeExtendLength = 16; | ||
public int drawbridgeExtendUpgradeValue = 16; | ||
public float drawbridgeSpeed = 0.5F; | ||
public float drawbridgeSpeedUpgradeValue = 0.1F; | ||
public static final Drawbridge DRAWBRIDGE = new Drawbridge(); | ||
public static class Drawbridge { | ||
public ForgeConfigSpec.IntValue extendLength; | ||
public ForgeConfigSpec.IntValue extendUpgradeValue; | ||
public ForgeConfigSpec.DoubleValue delay; | ||
public ForgeConfigSpec.DoubleValue speedUpgradeValue; | ||
|
||
public static MechworksConfig getInstance() { | ||
return instance; | ||
Drawbridge() { | ||
BUILDER.push("drawbridge"); | ||
extendLength = BUILDER | ||
.comment("Total drawbridge distance (with upgrades) going above 66 in an advanced drawbridge may cause slots to overlap with player inventory slots") | ||
.comment("The distance that the base drawbridge can extend") | ||
.defineInRange("extendLength", 16, 1, 64); | ||
extendUpgradeValue = BUILDER | ||
.comment("How much each distance upgrade increases the max distance by") | ||
.defineInRange("extendUpgradeValue", 16, 0, 64); | ||
|
||
delay = BUILDER | ||
.comment("The base delay between each block place/destroy") | ||
.defineInRange("delay", 0.5D, 0F, Integer.MAX_VALUE); | ||
speedUpgradeValue = BUILDER | ||
.comment("The amount by which each speed upgrade decreases the delay") | ||
.defineInRange("speedUpgradeValue", 0.1D, 0F, Integer.MAX_VALUE); | ||
|
||
BUILDER.pop(); | ||
} | ||
} | ||
|
||
private static final ForgeConfigSpec SPEC = BUILDER.build(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters