Skip to content

Commit

Permalink
update TerraConstants.VERSION based on mcmod.info
Browse files Browse the repository at this point in the history
  • Loading branch information
DaMatrix committed Feb 20, 2021
1 parent 93c5d89 commit b716bdd
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod.EventBusSubscriber(modid = TerraMod.MODID)
@Config(modid = TerraMod.MODID)
@Mod.EventBusSubscriber(modid = TerraConstants.MODID)
@Config(modid = TerraConstants.MODID)
public class TerraConfig {
@Name("reduced_console_messages")
@Comment({ "Removes all of TerraPlusPlus' messages which contain various links in the server console",
Expand All @@ -36,8 +36,8 @@ public class TerraConfig {

@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if (TerraMod.MODID.equals(event.getModID())) {
ConfigManager.sync(TerraMod.MODID, Config.Type.INSTANCE);
if (TerraConstants.MODID.equals(event.getModID())) {
ConfigManager.sync(TerraConstants.MODID, Config.Type.INSTANCE);
Http.configChanged();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import net.minecraft.block.state.IBlockState;

public class TerraConstants {
public static final String CHAT_PREFIX = "&2&lT++ &8&l> ";
public static final String MOD_ID = "terraplusplus";
public static final String VERSION = "1.0";
public static final String MODID = "terraplusplus";
public static String VERSION = "(development snapshot)";

public static final String defaultCommandNode = MOD_ID + ".command.";
public static final String controlCommandNode = MOD_ID + ".commands.";
public static final String CHAT_PREFIX = "&2&lT++ &8&l> ";
public static final String defaultCommandNode = MODID + ".command.";
public static final String controlCommandNode = MODID + ".commands.";
public static final String othersCommandNode = controlCommandNode + "others";

public static final Gson GSON = new GsonBuilder()
Expand Down
29 changes: 10 additions & 19 deletions src/main/java/net/buildtheearth/terraplusplus/TerraMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import net.buildtheearth.terraplusplus.control.TerraCommand;
import net.buildtheearth.terraplusplus.control.TerraTeleport;
import net.buildtheearth.terraplusplus.provider.EarthWorldProvider;
import net.buildtheearth.terraplusplus.provider.GenerationEventDenier;
import net.buildtheearth.terraplusplus.provider.WaterDenier;
import net.minecraft.world.DimensionType;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Expand All @@ -22,24 +22,19 @@
import org.apache.logging.log4j.simple.SimpleLogger;
import org.apache.logging.log4j.util.PropertiesUtil;

@Mod(modid = TerraMod.MODID,
@Mod(modid = TerraConstants.MODID,
dependencies = "required-after:cubicchunks; required-after:cubicgen",
acceptableRemoteVersions = "*",
useMetadata = true)
public class TerraMod {
public static final String MODID = TerraConstants.MOD_ID;
public static final String VERSION = "0.1";
public static final String USERAGENT = TerraMod.MODID + '/' + TerraMod.VERSION;
public static final boolean CUSTOM_PROVIDER = false; //could potentially interfere with other mods and is relatively untested, leaving off for now

public static Logger LOGGER = new SimpleLogger("[terra++ bootstrap]", Level.INFO, true, false, true, false, "[yyyy/MM/dd HH:mm:ss:SSS]", null, new PropertiesUtil("log4j2.simplelog.properties"), System.out);

//set custom provider
private static void setupProvider() {
DimensionType type = DimensionType.register("earth", "_earth", 0, EarthWorldProvider.class, true);
DimensionManager.init();
DimensionManager.unregisterDimension(0);
DimensionManager.registerDimension(0, type);
@EventHandler
public void construction(FMLConstructionEvent event) {
ModContainer terra = Loader.instance().getIndexedModList().get(TerraConstants.MODID);
if (!"${version}".equals(terra.getVersion())) {
TerraConstants.VERSION = terra.getVersion();
}
}

@EventHandler
Expand All @@ -52,10 +47,6 @@ public void preInit(FMLPreInitializationEvent event) {
if (Side.CLIENT == event.getSide()) {
BTEWorldType.create();
}

if (CUSTOM_PROVIDER) {
setupProvider();
}
}

@EventHandler
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/net/buildtheearth/terraplusplus/control/EarthGui.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.buildtheearth.terraplusplus.control;

import io.github.opencubicchunks.cubicchunks.cubicgen.customcubic.CustomCubicWorldType;
import net.buildtheearth.terraplusplus.TerraMod;
import net.buildtheearth.terraplusplus.TerraConstants;
import net.buildtheearth.terraplusplus.config.GlobalParseRegistries;
import net.buildtheearth.terraplusplus.generator.EarthGeneratorSettings;
import net.buildtheearth.terraplusplus.projection.GeographicProjection;
Expand Down Expand Up @@ -202,7 +202,7 @@ protected GuiTextField addTextField(int x, int y, int width, int height) {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, I18n.format(TerraMod.MODID + ".gui.header"), this.width >> 1, VERTICAL_PADDING >> 1, 0xFFFFFFFF);
this.drawCenteredString(this.fontRenderer, I18n.format(TerraConstants.MODID + ".gui.header"), this.width >> 1, VERTICAL_PADDING >> 1, 0xFFFFFFFF);

//render map texture
GlStateManager.bindTexture(this.texture.getGlTextureId());
Expand Down Expand Up @@ -285,7 +285,7 @@ protected static class ProjectionEntry implements Entry {
protected int height = 30;

public ProjectionEntry(EarthGeneratorSettings settings, EarthGui gui, int x, int y, int width) {
gui.addButton(new GuiButton(0, x + (width >> 1), y, width >> 1, 20, I18n.format(TerraMod.MODID + ".gui.transformation.add")) {
gui.addButton(new GuiButton(0, x + (width >> 1), y, width >> 1, 20, I18n.format(TerraConstants.MODID + ".gui.transformation.add")) {
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if (super.mousePressed(mc, mouseX, mouseY)) {
Expand Down Expand Up @@ -315,7 +315,7 @@ public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {

@Override
public void render(EarthGui gui, int x, int y, int width) {
gui.fontRenderer.drawString(I18n.format(TerraMod.MODID + ".gui.projection"), x, y + (20 - 8) / 2, 0xFFFFFFFF, true);
gui.fontRenderer.drawString(I18n.format(TerraConstants.MODID + ".gui.projection"), x, y + (20 - 8) / 2, 0xFFFFFFFF, true);

y += 30;

Expand All @@ -341,7 +341,7 @@ protected enum Transformation {
offset {
@Override
protected TransformEntry newSubEntry(ProjectionEntry entry, EarthGui gui, int x, int y, int width) {
return new ParameterizedTransformEntry(this, entry, gui, x, y, width, TerraMod.MODID + ".gui.transformation.offset", "dx", "dy") {
return new ParameterizedTransformEntry(this, entry, gui, x, y, width, TerraConstants.MODID + ".gui.transformation.offset", "dx", "dy") {
@Override
public void initFrom(ProjectionTransform in) {
if (in instanceof OffsetProjectionTransform) {
Expand All @@ -364,7 +364,7 @@ protected void appendValue(StringBuilder out, int i) {
scale {
@Override
protected TransformEntry newSubEntry(ProjectionEntry entry, EarthGui gui, int x, int y, int width) {
return new ParameterizedTransformEntry(this, entry, gui, x, y, width, TerraMod.MODID + ".gui.transformation.scale", "x", "y") {
return new ParameterizedTransformEntry(this, entry, gui, x, y, width, TerraConstants.MODID + ".gui.transformation.scale", "x", "y") {
@Override
public void initFrom(ProjectionTransform in) {
if (in instanceof ScaleProjectionTransform) {
Expand Down Expand Up @@ -447,7 +447,7 @@ public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
}
});

gui.addButton(new GuiButton(0, x + 60, y, width - 60, 20, I18n.format(TerraMod.MODID + ".gui.transformation." + transformation.name())) {
gui.addButton(new GuiButton(0, x + 60, y, width - 60, 20, I18n.format(TerraConstants.MODID + ".gui.transformation." + transformation.name())) {
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if (super.mousePressed(mc, mouseX, mouseY)) {
Expand Down Expand Up @@ -545,7 +545,7 @@ public RootEntry(GeographicProjection projection, EarthGui gui, int x, int y, in
String projectionName = GlobalParseRegistries.PROJECTIONS.inverse().get(projection.getClass());
this.initialIndex = this.index = PArrays.indexOf(PROJECTION_NAMES, projectionName);

gui.addButton(new GuiButton(0, x, y, width, 20, I18n.format(this.fieldName = TerraMod.MODID + ".gui.projection." + projectionName)) {
gui.addButton(new GuiButton(0, x, y, width, 20, I18n.format(this.fieldName = TerraConstants.MODID + ".gui.projection." + projectionName)) {
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if (super.mousePressed(mc, mouseX, mouseY)) {
Expand Down Expand Up @@ -622,7 +622,7 @@ public ToggleEntry(EarthGui gui, int x, int y, int width, boolean value, String
this.touch = touch;
this.value = value;

gui.addButton(new GuiButton(0, x, y, width, 20, I18n.format(TerraMod.MODID + ".gui." + name) + ": " + I18n.format("options." + (value ? "on" : "off"))) {
gui.addButton(new GuiButton(0, x, y, width, 20, I18n.format(TerraConstants.MODID + ".gui." + name) + ": " + I18n.format("options." + (value ? "on" : "off"))) {
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
if (super.mousePressed(mc, mouseX, mouseY)) {
Expand Down Expand Up @@ -655,7 +655,7 @@ protected static class CWGEntry implements Entry {
protected String text;

public CWGEntry(EarthGeneratorSettings settings, EarthGui gui, int x, int y, int width) {
int text = gui.fontRenderer.getStringWidth(I18n.format(TerraMod.MODID + ".gui.cwg")) + 5;
int text = gui.fontRenderer.getStringWidth(I18n.format(TerraConstants.MODID + ".gui.cwg")) + 5;
x += text;
width -= text;

Expand Down Expand Up @@ -698,7 +698,7 @@ public int height() {

@Override
public void render(EarthGui gui, int x, int y, int width) {
gui.fontRenderer.drawString(I18n.format(TerraMod.MODID + ".gui.cwg"), x, y + (20 - 8) / 2, 0xFFFFFFFF, true);
gui.fontRenderer.drawString(I18n.format(TerraConstants.MODID + ".gui.cwg"), x, y + (20 - 8) / 2, 0xFFFFFFFF, true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;

import javax.annotation.Nullable;
Expand All @@ -23,15 +21,13 @@
import net.buildtheearth.terraplusplus.util.geo.LatLng;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.server.permission.PermissionAPI;

public class TerraTeleport extends Command {

Expand Down Expand Up @@ -66,13 +62,13 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
IChunkProvider cp = world.getChunkProvider();

if (!(cp instanceof CubeProviderServer)) {
throw new CommandException(TerraConstants.MOD_ID + ".error.notcc");
throw new CommandException(TerraConstants.MODID + ".error.notcc");
}

ICubeGenerator gen = ((CubeProviderServer) cp).getCubeGenerator();

if (!(gen instanceof EarthGenerator)) {
throw new CommandException(TerraConstants.MOD_ID + ".error.notterra");
throw new CommandException(TerraConstants.MODID + ".error.notterra");
}

EarthGenerator terrain = (EarthGenerator) gen;
Expand Down Expand Up @@ -135,7 +131,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
try {
proj = terrain.projection.fromGeo(defaultCoords.getLng(), defaultCoords.getLat());
} catch (Exception e) {
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".error.numbers")));
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".error.numbers")));
return;
}

Expand All @@ -147,7 +143,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
.getAsync(defaultCoords.getLng(), defaultCoords.getLat())
.thenApply(a -> a + 1.0d);
} catch (OutOfProjectionBoundsException e) { //out of bounds, notify user
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".error.numbers")));
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".error.numbers")));
return;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
x = Double.parseDouble(args[0]);
y = Double.parseDouble(args[1]);
} catch (Exception e) {
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".error.numbers")));
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".error.numbers")));
return;
}

Expand Down Expand Up @@ -80,7 +80,7 @@ public String[] getName() {

@Override
public String getPurpose() {
return TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.convert.purpose").getUnformattedComponentText();
return TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.convert.purpose").getUnformattedComponentText();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
}

if(c == null || Double.isNaN(c[0])) {
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.where.notproj")));
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.where.notproj")));
return;
}
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.GRAY, "Distortion:"));
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.format(TerraConstants.MOD_ID + ".commands.terra.tissot", Math.sqrt(Math.abs(c[0])), c[1] * 180.0 / Math.PI)));
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.format(TerraConstants.MODID + ".commands.terra.tissot", Math.sqrt(Math.abs(c[0])), c[1] * 180.0 / Math.PI)));
}

@Override
Expand All @@ -59,7 +59,7 @@ public String[] getName() {

@Override
public String getPurpose() {
return TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.distortion.purpose").getUnformattedComponentText();
return TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.distortion.purpose").getUnformattedComponentText();
}

@Override
Expand All @@ -69,6 +69,6 @@ public String[] getArguments() {

@Override
public String getPermission() {
return TerraConstants.MOD_ID + ".commands.terra";
return TerraConstants.MODID + ".commands.terra";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public String[] getName() {

@Override
public String getPurpose() {
return TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.info.purpose").getUnformattedComponentText();
return TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.info.purpose").getUnformattedComponentText();
}

@Override
Expand All @@ -34,6 +34,6 @@ public String[] getArguments() {

@Override
public String getPermission() {
return TerraConstants.MOD_ID + ".commands.terra";
return TerraConstants.MODID + ".commands.terra";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
if (args.length > 0) {
if(hasPermission(sender, TerraConstants.othersCommandNode)) e = sender.getEntityWorld().getPlayerEntityByName(args[0]);
if (e == null) {
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".error.unknownplayer")));
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".error.unknownplayer")));
return;
}

Expand All @@ -77,11 +77,11 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args
}
sender.sendMessage(ChatUtil.titleAndCombine(TextFormatting.GRAY, "Location of ", TextFormatting.BLUE, senderName));
if (result == null || Double.isNaN(result[0])) {
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.where.notproj")));
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.where.notproj")));
return;
}
if (!Float.isFinite(azimuth)) {
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.where.notproj")));
sender.sendMessage(ChatUtil.combine(TextFormatting.RED, TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.where.notproj")));
return;

}
Expand All @@ -103,7 +103,7 @@ public String[] getName() {

@Override
public String getPurpose() {
return TranslateUtil.translate(TerraConstants.MOD_ID + ".fragment.terra.where.purpose").getUnformattedComponentText();
return TranslateUtil.translate(TerraConstants.MODID + ".fragment.terra.where.purpose").getUnformattedComponentText();
}

@Override
Expand All @@ -113,6 +113,6 @@ public String[] getArguments() {

@Override
public String getPermission() {
return TerraConstants.MOD_ID + ".commands.terra";
return TerraConstants.MODID + ".commands.terra";
}
}
Loading

0 comments on commit b716bdd

Please sign in to comment.