Skip to content

Commit

Permalink
Change MODID to MOD_ID
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Oct 8, 2024
1 parent e864862 commit 03ca05a
Show file tree
Hide file tree
Showing 38 changed files with 66 additions and 59 deletions.
10 changes: 5 additions & 5 deletions common/src/main/java/com/railwayteam/railways/Railways.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@
import java.util.function.Function;

public class Railways {
public static final String MODID = "railways";
public static final String MOD_ID = "railways";
public static final String ID_NAME = "Railways";
public static final String NAME = "Steam 'n' Rails";
public static final Logger LOGGER = LoggerFactory.getLogger(ID_NAME);
// Only used for datafixers, bump whenever a block changes id etc. (should not be bumped multiple times within a release)
public static final int DATA_FIXER_VERSION = 2;

private static final CreateRegistrate REGISTRATE = CreateRegistrate.create(MODID);
private static final CreateRegistrate REGISTRATE = CreateRegistrate.create(MOD_ID);

static {
REGISTRATE.setTooltipModifierFactory(item -> new ItemDescription.Modifier(item, TooltipHelper.Palette.STANDARD_CREATE)
Expand Down Expand Up @@ -95,10 +95,10 @@ public static void init() {
RailwaysUpdateCheck.execute();

Path configDir = Utils.configDir();
Path clientConfigDir = configDir.resolve(MODID + "-client.toml");
Path clientConfigDir = configDir.resolve(MOD_ID + "-client.toml");
migrateConfig(clientConfigDir, CRConfigs::migrateClient);

Path commonConfigDir = configDir.resolve(MODID + "-common.toml");
Path commonConfigDir = configDir.resolve(MOD_ID + "-common.toml");
migrateConfig(commonConfigDir, CRConfigs::migrateCommon);

ModSetup.register();
Expand All @@ -112,7 +112,7 @@ public static void init() {
}

public static ResourceLocation asResource(String name) {
return new ResourceLocation(MODID, name);
return new ResourceLocation(MOD_ID, name);
}

public static void gatherData(DataGenerator.PackGenerator gen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public RailwaysSequencedAssemblyRecipeBuilder(ResourceLocation id) {
*/
public RailwaysSequencedAssemblyRecipeBuilder conditionalMaterial(TrackMaterial trackMaterial) {
String namespace = trackMaterial.id.getNamespace();
if (!Railways.MODID.equals(namespace)) {
if (!Railways.MOD_ID.equals(namespace)) {
recipeConditions.add(DefaultResourceConditions.allModsLoaded(namespace));
}
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected GeneratedRecipe create(String name, Function<RailwaysSequencedAssembly
));
}

List<TrackMaterial> trackMaterials = new ArrayList<>(TrackMaterial.allFromMod(Railways.MODID));
List<TrackMaterial> trackMaterials = new ArrayList<>(TrackMaterial.allFromMod(Railways.MOD_ID));

// Add all mod compat tracks
for (String mod : TRACK_COMPAT_MODS)
Expand All @@ -90,7 +90,7 @@ protected GeneratedRecipe create(String name, Function<RailwaysSequencedAssembly
}
if (sleeperIngredient.isEmpty()) continue;
TRACKS.put(material, create(
"track_" + (material.id.getNamespace().equals(Railways.MODID)
"track_" + (material.id.getNamespace().equals(Railways.MOD_ID)
? "" : material.id.getNamespace()+"_") + material.resourceName(),
b -> b.conditionalMaterial(material).require(baseMaterial.getBlock())
.transitionTo(CRItems.ITEM_INCOMPLETE_TRACK.get(material).get())
Expand Down Expand Up @@ -128,7 +128,7 @@ protected GeneratedRecipe create(String name, Function<RailwaysSequencedAssembly

Ingredient finalRailsIngredient = railsIngredient;
TRACKS.put(material, create(
"track_" + (material.id.getNamespace().equals(Railways.MODID)
"track_" + (material.id.getNamespace().equals(Railways.MOD_ID)
? "" : material.id.getNamespace()+"_") + material.resourceName(),
b -> b.conditionalMaterial(material).require(sleeperIngredient)
.transitionTo(CRItems.ITEM_INCOMPLETE_TRACK.get(material).get())
Expand Down Expand Up @@ -158,7 +158,7 @@ protected GeneratedRecipe create(String name, Function<RailwaysSequencedAssembly
Ingredient finalRailsIngredient = railsIngredient;

TRACKS.put(material, create(
"track_" + (material.id.getNamespace().equals(Railways.MODID)
"track_" + (material.id.getNamespace().equals(Railways.MOD_ID)
? "" : material.id.getNamespace()+"_") + material.resourceName(),
b -> b.conditionalMaterial(material).require(material.sleeperIngredient)
.transitionTo(CRItems.ITEM_INCOMPLETE_TRACK.get(material).get())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void initialize(@NotNull IClientAPI api) {

@Override
public String getModId() {
return Railways.MODID;
return Railways.MOD_ID;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void addOrUpdateTrain(UUID uuid) {
marker.setDimension(dimension);
marker.setPoint(blockPos);
} else {
marker = new MarkerOverlay(Railways.MODID, "train_marker_" + uuid.toString(), blockPos, TRAIN_IMAGE);
marker = new MarkerOverlay(Railways.MOD_ID, "train_marker_" + uuid.toString(), blockPos, TRAIN_IMAGE);
marker.setDimension(dimension);
markers.put(uuid, marker);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static boolean anyLoaded() {

@ApiStatus.Internal
public static boolean mixinSkipLootLoading(ResourceLocation resourceLocation) {
if (resourceLocation.getNamespace().equals(Railways.MODID)) {
if (resourceLocation.getNamespace().equals(Railways.MOD_ID)) {
for (String compatMod : TRACK_COMPAT_MODS) {
if (resourceLocation.getPath().startsWith("blocks/track_"+compatMod)) {
return !GenericTrackCompat.get(compatMod).shouldRegisterMissing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public static String migrate(String contents, Map<String, String> pathMap) {

private static void preloadValues() {
Path configDir = Utils.configDir();
Path commonConfig = configDir.resolve(Railways.MODID+"-common.toml");
Path commonConfig = configDir.resolve(Railways.MOD_ID +"-common.toml");
try (Reader reader = new FileReader(commonConfig.toFile())) {
CommentedConfig config = new TomlParser().parse(reader);
cachedDisableDatafixer = config.<Boolean>getRaw("disableDatafixer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks;
Expand All @@ -49,7 +52,7 @@

public class ConductorCapModel<T extends LivingEntity> extends Model implements HeadedModel {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(Railways.MODID, "conductor_cap"), "main");
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(Railways.asResource("conductor_cap"), "main");

private final ModelPart cap;
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.HumanoidArm;
import org.jetbrains.annotations.NotNull;

public class ConductorEntityModel<T extends ConductorEntity> extends HumanoidModel<T> implements ArmedModel, HeadedModel {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(Railways.MODID, "conductor"), "main");
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(Railways.asResource("conductor"), "main");

public ConductorEntityModel (ModelPart root) {
super(root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.jetbrains.annotations.NotNull;

public class ConductorRenderer extends MobRenderer<ConductorEntity, ConductorEntityModel<ConductorEntity>> {
public static final ResourceLocation TEXTURE = new ResourceLocation(Railways.MODID, "textures/entity/conductor.png");
public static final ResourceLocation TEXTURE = Railways.asResource("textures/entity/conductor.png");

public ConductorRenderer(EntityRendererProvider.Context ctx) {
super (ctx, new ConductorEntityModel<>(ctx.bakeLayer(ConductorEntityModel.LAYER_LOCATION)), 0.2f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ public CompoundTag write() {
}

private static LangBuilder b() {
return Lang.builder(Railways.MODID);
return Lang.builder(Railways.MOD_ID);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static boolean isVisible() {
}

public static boolean register(SpriteContents sprite) {
if (sprite.name().getNamespace().equals(Railways.MODID) && sprite.name().getPath().startsWith("block/track/phantom/")) {
if (sprite.name().getNamespace().equals(Railways.MOD_ID) && sprite.name().getPath().startsWith("block/track/phantom/")) {
map.put(sprite.name(), new WeakReference<>(sprite));
firstRun = true;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ protected void write(CompoundTag tag, boolean clientPacket) {
@Override
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
if (color != null)
Lang.builder(Railways.MODID)
Lang.builder(Railways.MOD_ID)
.translate("smokestack.goggle.tooltip.color", ColorUtils.coloredName(color.getName()))
.forGoggles(tooltip);

if (isSoul || color == null) {
Lang.builder(Railways.MODID)
Lang.builder(Railways.MOD_ID)
.translate("smokestack.goggle.tooltip",
isSoul ? "Soul" : ColorUtils.coloredName(DyeColor.BLACK.toString())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void calculateExits(TrackSwitch sw) {
}

private static LangBuilder b() {
return Lang.builder(Railways.MODID);
return Lang.builder(Railways.MOD_ID);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public class MixinConfigHelper {
"hasAnyForgeConfig"
}, at = @At("HEAD"), cancellable = true)
private static void markSNRConfig(String modID, CallbackInfoReturnable<Boolean> cir) {
if (modID.equals(Railways.MODID))
if (modID.equals(Railways.MOD_ID))
cir.setReturnValue(true);
}

@Inject(method = "findConfigSpecFor", at = @At("HEAD"), cancellable = true)
private static void returnSNRConfig(ModConfig.Type type, String modID, CallbackInfoReturnable<IConfigSpec<?>> cir) {
if (modID.equals(Railways.MODID)) {
if (modID.equals(Railways.MOD_ID)) {
cir.setReturnValue(CRConfigs.byType(type).specification);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public static AllBogeyStyles.BogeyStyleBuilder create(ResourceLocation name, Res
}

public static CategoryEntry registerCategory(String name) {
return registerCategory(Railways.MODID, name);
return registerCategory(Railways.MOD_ID, name);
}

public static CategoryEntry registerCategory(String modid, String name) {
Expand All @@ -378,7 +378,7 @@ private static void setScalesForSizes(BogeyStyle style, BogeySizes.BogeySize siz
}

public static void register() {
Railways.LOGGER.info("Registered bogey styles from " + Railways.MODID);
Railways.LOGGER.info("Registered bogey styles from " + Railways.MOD_ID);

map(AllBogeyStyles.STANDARD, CRTrackType.WIDE_GAUGE, WIDE_DEFAULT);
map(AllBogeyStyles.STANDARD, CRTrackType.NARROW_GAUGE, NARROW_DEFAULT);
Expand Down Expand Up @@ -436,7 +436,7 @@ public static void register() {
addToCategory(SEXTUPLEAXLE_CATEGORY, LARGE_CREATE_STYLED_0_12_0, 13);

if (Utils.isDevEnv()) {
CategoryEntry ALL_TEST_CATEGORY = registerCategory(Railways.MODID, "all_test");
CategoryEntry ALL_TEST_CATEGORY = registerCategory(Railways.MOD_ID, "all_test");
for (BogeyStyle style : AllBogeyStyles.BOGEY_STYLES.values()) {
if (hideInSelectionMenu(style)) continue;
addToCategory(ALL_TEST_CATEGORY, style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.railwayteam.railways.Railways;
import com.railwayteam.railways.registry.commands.ConductorDemoCommand;
import com.railwayteam.railways.registry.commands.PalettesDemoCommand;
import com.railwayteam.railways.registry.commands.ReloadCasingCollisionCommand;
Expand All @@ -39,7 +40,7 @@
public class CRCommands {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher, boolean dedicated) {

var railwaysCommand = literal("railways")
var railwaysCommand = literal(Railways.MOD_ID)
.requires(cs -> cs.hasPermission(0))
//.then(ClearCasingCacheCommand.register())
.then(SplitTrainCommand.register())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public enum CRGuiTextures implements ScreenElement {
}

CRGuiTextures(String location, int startX, int startY, int width, int height) {
this(Railways.MODID, location, startX, startY, width, height);
this(Railways.MOD_ID, location, startX, startY, width, height);
}

private CRGuiTextures(String namespace, String location, int startX, int startY, int width, int height) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public static Item woolByColor(DyeColor color) {
.requires(CONDUCTOR_CAPS)
.requires(Ingredients.dye(color))
.unlockedBy("hasitem", RegistrateRecipeProvider.has(CONDUCTOR_CAPS))
.save(prov, new ResourceLocation(Railways.MODID, "dying_existing_cap_" + colorReg)))
.save(prov, Railways.asResource("dying_existing_cap_" + colorReg)))
.register());
}

for (TrackMaterial material : TrackMaterial.allFromMod(Railways.MODID)) {
for (TrackMaterial material : TrackMaterial.allFromMod(Railways.MOD_ID)) {
ITEM_INCOMPLETE_TRACK.put(material, REGISTRATE.item("track_incomplete_" + material.resourceName(), SequencedAssemblyItem::new)
.model((c, p) -> p.generated(c, Railways.asResource("item/track_incomplete/" + c.getName())))
.lang("Incomplete " + material.langName + " Track")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum CRKeys {
public static final Set<KeyMapping> NON_CONFLICTING_KEYMAPPINGS = new HashSet<>();

CRKeys(String description, int defaultKey) {
this.description = Railways.MODID + ".keyinfo." + description;
this.description = Railways.MOD_ID + ".keyinfo." + description;
this.key = defaultKey;
this.modifiable = !description.isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.railwayteam.railways.util.packet.*;

public class CRPackets {
public static final PacketSet PACKETS = PacketSet.builder(Railways.MODID, 12) // increment version on changes
public static final PacketSet PACKETS = PacketSet.builder(Railways.MOD_ID, 12) // increment version on changes

.c2s(MountedToolboxDisposeAllPacket.class, MountedToolboxDisposeAllPacket::new)
.c2s(MountedToolboxEquipPacket.class, MountedToolboxEquipPacket::new)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


public class CRPonderIndex {
private static final PonderRegistrationHelper HELPER = new PonderRegistrationHelper(Railways.MODID);
private static final PonderRegistrationHelper HELPER = new PonderRegistrationHelper(Railways.MOD_ID);

public static void register() {
HELPER.forComponents(CRBlocks.SEMAPHORE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

public class CRTags {
public enum NameSpace {
MOD(Railways.MODID, false, true);
MOD(Railways.MOD_ID, false, true);

public final String id;
public final boolean optionalDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public class CRTrackMaterials {
static {
WIDE_GAUGE.put(TrackMaterial.ANDESITE, WIDE_GAUGE_ANDESITE);
WIDE_GAUGE_REVERSE.put(WIDE_GAUGE_ANDESITE, TrackMaterial.ANDESITE);
for (TrackMaterial baseMaterial : TrackMaterial.allFromMod(Railways.MODID)) {
for (TrackMaterial baseMaterial : TrackMaterial.allFromMod(Railways.MOD_ID)) {
if (baseMaterial.trackType != TrackType.STANDARD)
continue;

Expand All @@ -199,7 +199,7 @@ public class CRTrackMaterials {

NARROW_GAUGE.put(TrackMaterial.ANDESITE, NARROW_GAUGE_ANDESITE);
NARROW_GAUGE_REVERSE.put(NARROW_GAUGE_ANDESITE, TrackMaterial.ANDESITE);
for (TrackMaterial baseMaterial : TrackMaterial.allFromMod(Railways.MODID)) {
for (TrackMaterial baseMaterial : TrackMaterial.allFromMod(Railways.MOD_ID)) {
if (baseMaterial.trackType != TrackType.STANDARD)
continue;

Expand All @@ -222,7 +222,7 @@ public static TrackMaterial getBaseFromWide(TrackMaterial material) {

private static TrackMaterial wideVariant(TrackMaterial material) {
String path = "";
if (!material.id.getNamespace().equals(Railways.MODID))
if (!material.id.getNamespace().equals(Railways.MOD_ID))
path = material.id.getNamespace() + "_";
path += material.id.getPath() + "_wide";
return make(Railways.asResource(path))
Expand All @@ -248,7 +248,7 @@ public static TrackMaterial getBaseFromNarrow(TrackMaterial material) {

private static TrackMaterial narrowVariant(TrackMaterial material) {
String path = "";
if (!material.id.getNamespace().equals(Railways.MODID))
if (!material.id.getNamespace().equals(Railways.MOD_ID))
path = material.id.getNamespace() + "_";
path += material.id.getPath() + "_narrow";
return make(Railways.asResource(path))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void execute() {
Util.ioPool().submit(() -> {
String uri = String.format(
"https://update.api.ithundxr.dev/update-check?mod_id=%s&mod_version=%s&mc_version=%s&loader=%s&dev=%s",
Railways.MODID,
Railways.MOD_ID,
RailwaysBuildInfo.VERSION,
SharedConstants.getCurrentVersion().getName(),
Loader.getActual(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public static void register() {
CRConfigs.registerCommon();

for (Map.Entry<ModConfig.Type, ConfigBase> pair : CRConfigs.CONFIGS.entrySet())
ForgeConfigRegistry.INSTANCE.register(Railways.MODID, pair.getKey(), pair.getValue().specification);
ForgeConfigRegistry.INSTANCE.register(Railways.MOD_ID, pair.getKey(), pair.getValue().specification);

ModConfigEvents.loading(Railways.MODID).register(CRConfigs::onLoad);
ModConfigEvents.reloading(Railways.MODID).register(CRConfigs::onReload);
ModConfigEvents.loading(Railways.MOD_ID).register(CRConfigs::onLoad);
ModConfigEvents.reloading(Railways.MOD_ID).register(CRConfigs::onReload);
}
}
Loading

0 comments on commit 03ca05a

Please sign in to comment.