This commit is contained in:
embeddedt 2024-05-22 12:02:51 -04:00
parent d8b207ff10
commit 2ef7d5fc85
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
10 changed files with 13 additions and 12 deletions

View File

@ -25,7 +25,7 @@ public final class ModelHelpers {
* @return a list of all blockstates related to the model
*/
public static ImmutableList<BlockState> getBlockStateForLocation(ModelResourceLocation location) {
Optional<Block> blockOpt = BuiltInRegistries.BLOCK.getOptional(new ResourceLocation(location.getNamespace(), location.getPath()));
Optional<Block> blockOpt = BuiltInRegistries.BLOCK.getOptional(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), location.getPath()));
if(blockOpt.isPresent())
return ModelBakeryHelpers.getBlockStatesForMRL(blockOpt.get().getStateDefinition(), location);
else

View File

@ -39,7 +39,7 @@ public class ModernFixCommands {
Matcher matcher = pathPattern.matcher(found.getPath());
if(!matcher.matches())
continue;
ResourceLocation structureLocation = new ResourceLocation(found.getNamespace(), matcher.group(1));
ResourceLocation structureLocation = ResourceLocation.fromNamespaceAndPath(found.getNamespace(), matcher.group(1));
try(InputStream resource = entry.getValue().open()) {
CachingStructureManager.readStructureTag(structureLocation, level.getServer().getFixerUpper(), resource);
Component msg = Component.literal("checked " + structureLocation + " (" + upgradedNum + "/" + structures.size() + ")");

View File

@ -33,7 +33,7 @@ public class StructureManagerMixin {
*/
@Overwrite
private Optional<StructureTemplate> loadFromResource(ResourceLocation id) {
ResourceLocation arg = new ResourceLocation(id.getNamespace(), "structures/" + id.getPath() + ".nbt");
ResourceLocation arg = ResourceLocation.fromNamespaceAndPath(id.getNamespace(), "structures/" + id.getPath() + ".nbt");
try(InputStream stream = this.resourceManager.open(arg)) {
return Optional.of(CachingStructureManager.readStructure(id, this.fixerUpper, stream, this.blockLookup));
} catch(FileNotFoundException e) {

View File

@ -33,7 +33,7 @@ public abstract class ItemModelShaperMixin {
super();
}
private static final ModelResourceLocation SENTINEL_VANILLA = new ModelResourceLocation(new ResourceLocation("modernfix", "sentinel"), "sentinel");
private static final ModelResourceLocation SENTINEL_VANILLA = new ModelResourceLocation(ResourceLocation.fromNamespaceAndPath("modernfix", "sentinel"), "sentinel");
private final DynamicModelCache<Item> mfix$itemModelCache = new DynamicModelCache<>(k -> this.mfix$getModelForItem((Item)k), true);

View File

@ -34,7 +34,7 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
* in the baked registry ahead of time.
*/
private static final ImmutableSet<ResourceLocation> BAKE_SKIPPED_TOPLEVEL = ImmutableSet.<ResourceLocation>builder()
.add(new ResourceLocation("custommachinery", "block/custom_machine_block"))
.add(ResourceLocation.fromNamespaceAndPath("custommachinery", "block/custom_machine_block"))
.build();
public static DynamicBakedModelProvider currentInstance = null;
private final ModelBakery bakery;
@ -118,7 +118,7 @@ public class DynamicBakedModelProvider implements Map<ResourceLocation, BakedMod
if(location instanceof ModelResourceLocation) {
try {
ModelResourceLocation mrl = (ModelResourceLocation)location;
ResourceLocation registryKey = new ResourceLocation(mrl.getNamespace(), mrl.getPath());
ResourceLocation registryKey = ResourceLocation.fromNamespaceAndPath(mrl.getNamespace(), mrl.getPath());
// check for standard inventory model
if(mrl.getVariant().equals("inventory") && BuiltInRegistries.ITEM.containsKey(registryKey))
return true;

View File

@ -158,7 +158,7 @@ public class PackResourcesCacheEngine {
if(!fullTestPath.startsWith(testPath)) {
continue;
}
ResourceLocation foundResource = new ResourceLocation(resourceNamespace, fullPath);
ResourceLocation foundResource = ResourceLocation.fromNamespaceAndPath(resourceNamespace, fullPath);
if(!filter.test(foundResource))
continue;
resources.add(foundResource);

View File

@ -1,5 +1,6 @@
package org.embeddedt.modernfix.resources;
import net.minecraft.ReportType;
import net.minecraft.ReportedException;
import net.minecraft.server.Bootstrap;
import org.embeddedt.modernfix.ModernFix;
@ -39,7 +40,7 @@ public class ReloadExecutor {
}
if (throwable instanceof ReportedException) {
Bootstrap.realStdoutPrintln(((ReportedException)throwable).getReport().getFriendlyReport());
Bootstrap.realStdoutPrintln(((ReportedException)throwable).getReport().getFriendlyReport(ReportType.CRASH));
System.exit(-1);
}

View File

@ -19,7 +19,7 @@ public class JEIRuntimeCapturer implements IModPlugin {
@Override
public ResourceLocation getPluginUid() {
return new ResourceLocation(ModernFix.MODID, "capturer");
return ResourceLocation.fromNamespaceAndPath(ModernFix.MODID, "capturer");
}
@Override

View File

@ -75,7 +75,7 @@ public abstract class ModelBakerImplMixin implements IExtendedModelBaker {
// synchronized because we use topLevelModels
synchronized (this.field_40571) {
/* to emulate vanilla model loading, treat as top-level */
Optional<Block> blockOpt = Objects.equals(((ModelResourceLocation)arg).getVariant(), "inventory") ? Optional.empty() : BuiltInRegistries.BLOCK.getOptional(new ResourceLocation(arg.getNamespace(), arg.getPath()));
Optional<Block> blockOpt = Objects.equals(((ModelResourceLocation)arg).getVariant(), "inventory") ? Optional.empty() : BuiltInRegistries.BLOCK.getOptional(ResourceLocation.fromNamespaceAndPath(arg.getNamespace(), arg.getPath()));
boolean invalidMRL = false;
if(blockOpt.isPresent()) {
/* load via lambda for mods that expect blockstate to get loaded */

View File

@ -5,7 +5,7 @@ junit_version=5.10.0-M1
mixinextras_version=0.3.2
mod_id=modernfix
minecraft_version=24w20a
minecraft_version=24w21a
enabled_platforms=fabric
forge_version=20.6.42-beta
# parchment_version=2023.07.09
@ -15,7 +15,7 @@ rei_version=13.0.678
ctm_version=1.20.1-1.1.8+4
kubejs_version=1902.6.0-build.142
rhino_version=1902.2.2-build.268
supported_minecraft_versions=24w20a
supported_minecraft_versions=24w21a
fabric_loader_version=0.15.11
fabric_api_version=0.98.2+1.21