Skip to content

Commit

Permalink
Merge pull request #38 from DebuggyTeam/formatting_cleanup_round_2
Browse files Browse the repository at this point in the history
Formatting cleanup round 2
  • Loading branch information
falkreon authored Jul 13, 2023
2 parents 4a1e3c5 + 6de0c9d commit a0d6857
Show file tree
Hide file tree
Showing 64 changed files with 2,499 additions and 2,521 deletions.
26 changes: 0 additions & 26 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,5 @@ root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = false

[*.gradle]
indent_style = tab

[*.java]
indent_style = tab

[*.json]
indent_style = space
indent_size = 2

[quilt.mod.json]
indent_style = tab
tab_width = 2

[*.toml]
indent_style = tab
tab_width = 2

[*.properties]
indent_style = space
indent_size = 2

[.editorconfig]
indent_style = space
indent_size = 4
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
# The latest versions are available at https://lambdaurora.dev/tools/import_quilt.html
minecraft = "1.20.1"
quilt_mappings = "1.20.1+build.1"
quilt_loader = "0.19.0-beta.18"
quilted_fabric_api = "7.0.2+0.83.0-1.20.1"
quilt_mappings = "1.20.1+build.7"
quilt_loader = "0.19.2-beta.2"
quilted_fabric_api = "7.0.4+0.84.0-1.20.1"

[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void onInitialize(ModContainer mod) {
for (EntrypointContainer<ArchExIntegration> entrypoint : QuiltLoader.getEntrypointContainers(ArchExIntegration.ENTRYPOINT_KEY, ArchExIntegration.class)) {
try {
entrypoint.getEntrypoint().integrate(new ArchExIntegrationContextImpl(entrypoint.getEntrypoint(), entrypoint.getProvider().metadata().id()));
} catch (Exception e) {
} catch (Exception ex) {
LOGGER.error("Mod '" + entrypoint.getProvider().metadata().id() + "' threw an exception when trying to integrate with Architecture Extensions");
}
}
Expand All @@ -92,7 +92,7 @@ public void onInitialize(ModContainer mod) {
DeferredRegistration.register(item.getModId(), group, groupedBlock, blockTypes, CALLBACK_ADD_TO_ITEM_GROUP);
}
} catch (IOException ex) {
throw new RuntimeException("There was a problem getting staticdata for mod container '" + item.getModId() + "' with resource id '"+item.getResourceId()+"'.", ex);
throw new RuntimeException("There was a problem getting staticdata for mod container '" + item.getModId() + "' with resource id '" + item.getResourceId() + "'.", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class DeferredRegistration {
* Called by ArchEx to start resolving deferred registrations.
*/
public static void init() {
RegistryEvents.getEntryAddEvent(Registries.BLOCK).register(ctx->{
RegistryEvents.getEntryAddEvent(Registries.BLOCK).register(ctx -> {
Identifier registeredId = ctx.id();
Collection<Entry> safeEntries = deferrals.get(registeredId);
Iterator<Entry> i = safeEntries.iterator();
Expand All @@ -54,10 +54,10 @@ public static void register(String modId, BlockGroup group, BlockGroup.GroupedBl
Entry deferral = new Entry(modId, group, groupedBlock, Set.copyOf(blockTypes), callback);

if (!deferral.register()) {
//ArchitectureExtensions.LOGGER.info("Deferred generation: "+deferral.modId()+" requested "+deferral.getIds()+" and registration was deferred.");
//ArchitectureExtensions.LOGGER.info("Deferred generation: " + deferral.modId() + " requested " + deferral.getIds() + " and registration was deferred.");
deferrals.put(groupedBlock.baseBlockId(), deferral);
} else {
//ArchitectureExtensions.LOGGER.info("Deferred generation: "+deferral.modId()+" requested "+deferral.getIds()+" and registration was completed immediately.");
//ArchitectureExtensions.LOGGER.info("Deferred generation: " + deferral.modId() + " requested " + deferral.getIds() + " and registration was completed immediately.");
}
}

Expand All @@ -67,8 +67,8 @@ public static void register(String modId, BlockGroup group, BlockGroup.GroupedBl
*/
public static void assertFinished() {
for(Entry entry : deferrals.values()) {
String sourceString = (entry.modId().equals("file")) ? "A file in the staticdata folder" : "Mod '"+entry.modId()+"'";
ArchitectureExtensions.LOGGER.warn(sourceString+" requested architecture extensions blocks derived from base block "+entry.groupedBlock.id()+", but this base block was never registered.");
String sourceString = (entry.modId().equals("file")) ? "A file in the staticdata folder" : "Mod '" + entry.modId() + "'";
ArchitectureExtensions.LOGGER.warn(sourceString + " requested architecture extensions blocks derived from base block " + entry.groupedBlock.id() + ", but this base block was never registered.");
}
}

Expand All @@ -87,7 +87,7 @@ public boolean register() {

public Set<String> getIds() {
String modId = this.modId();
if (modId == "file") modId = ArchitectureExtensions.MOD_CONTAINER.metadata().id(); // If it's a staticdata resource, use our own id
if (modId.equals("file")) modId = ArchitectureExtensions.MOD_CONTAINER.metadata().id(); // If it's a staticdata resource, use our own id

HashSet<String> result = new HashSet<>();
for(BlockType bt : blockTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public TypedGroupedBlock register(BlockGroup group, BlockGroup.GroupedBlock grou
var baseBlock = groupedBlock.baseBlock().get();

var blockSettings = QuiltBlockSettings.copyOf(baseBlock).strength(strength);
groupedBlock.mapColor().map(mapColor -> blockSettings.mapColor(mapColor));
groupedBlock.mapColor().map(blockSettings::mapColor);
var block = Registry.register(Registries.BLOCK, id, creator.apply(baseBlock, blockSettings));

Registry.register(Registries.ITEM, id, new BlockItem(block, new QuiltItemSettings()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void refreshCaches(ResourceType resourceType) {
CACHES.replace(key, refreshedCache);
}
});
removing.forEach(resourceName -> CACHES.remove(resourceName));
removing.forEach(CACHES::remove);
}

static String getResourceAsString(ModContainer resourceOwner, ResourceType resourceType, String resourceName) throws Exception {
Expand All @@ -50,7 +50,7 @@ private static Cache loadOrGetCache(ModContainer resourceOwner, ResourceType res
return null;
});
}

private static record CacheKey(ModContainer resourceOwner, ResourceType resourceType, String resourceName) { }

private static record Cache(Path resourcePath, String content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ public BlockGroupSchema() {
private static <T> Optional<T> reflectField(Class<?> originClass, String name) {
try {
return Optional.of((T) originClass.getDeclaredField(name).get(null));
} catch (Exception e) {
} catch (Exception ex) {
return Optional.empty();
}
}

public BlockGroup createBlockGroup() {
Identifier baseBlockId = new Identifier(base_block);
Supplier<Block> getter = () -> {
Block b = Registries.BLOCK.get(baseBlockId);
return (b == Blocks.AIR) ? null : b;
Block block = Registries.BLOCK.get(baseBlockId);
return (block == Blocks.AIR) ? null : block;
};
Identifier baseId = baseBlockId;
if (name != null) baseId = new Identifier(baseBlockId.getNamespace(), name);

TextureConfiguration textureConfig = (textures.contains(":")) ? TextureConfiguration.create(it->textures, it->textures, it->textures, it->textures) :
TextureConfiguration textureConfig = (textures.contains(":")) ? TextureConfiguration.create(it -> textures, it -> textures, it -> textures, it -> textures) :
BlockGroupSchema.<Function<Identifier, TextureConfiguration>>reflectField(TextureConfiguration.class, textures.toUpperCase(Locale.ROOT))
.orElse(TextureConfiguration.TOP).apply(baseId);
RecipeConfigurator recipeConfig = BlockGroupSchema.<RecipeConfigurator>reflectField(RecipeConfigurator.class, recipes.toUpperCase(Locale.ROOT))
Expand All @@ -69,12 +69,12 @@ public BlockGroup createBlockGroup() {
public Set<BlockType> getBlockTypes() {
Set<BlockType> result = new HashSet<>();

for(String s : types_to_generate) {
BlockType blockType = BlockGroupSchema.<BlockType>reflectField(BlockType.class, s.toUpperCase(Locale.ROOT)).orElse(null);
for(String typeToGenerate : types_to_generate) {
BlockType blockType = BlockGroupSchema.<BlockType>reflectField(BlockType.class, typeToGenerate.toUpperCase(Locale.ROOT)).orElse(null);
if (blockType != null) {
result.add(blockType);
} else {
ArchitectureExtensions.LOGGER.warn("A file requested the nonexistant block type '"+s+"'.");
ArchitectureExtensions.LOGGER.warn("A file requested a nonexistent block type '" + typeToGenerate + "'.");
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/architecture_extensions.mixins.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"required": true,
"package": "io.github.debuggyteam.architecture_extensions.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [],
"client": [
"TranslationStorageMixin"
],
"injectors": {
"defaultRequire": 1
}
"required": true,
"package": "io.github.debuggyteam.architecture_extensions.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [],
"client": [
"TranslationStorageMixin"
],
"injectors": {
"defaultRequire": 1
}
}
Loading

0 comments on commit a0d6857

Please sign in to comment.