Skip to content

Commit

Permalink
Merge branch 'architectury-1.17.1' into architectury-1.18.1
Browse files Browse the repository at this point in the history
  • Loading branch information
UnlikePaladin committed Nov 12, 2023
2 parents aa48162 + 6204118 commit 65d9d50
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ public Optional<Text> getUpdateMessageServer() {
if (textParts.length > 1) {
MutableText component1 = new LiteralText(textParts[0]);
MutableText component2 = new LiteralText(textParts[1]);
MutableText link = new LiteralText(info.modHost).styled(arg -> arg.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, info.modDownload)).withUnderline(true));
MutableText link = new LiteralText(info.modHost).styled(arg -> arg.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, info.modDownload)));
return Optional.of(component1.append(link).append(component2));
} else {
MutableText link = new LiteralText(info.modHost).styled(arg -> arg.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, info.modDownload)).withUnderline(true));
MutableText link = new LiteralText(info.modHost).styled(arg -> arg.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, info.modDownload)));
return Optional.of(new LiteralText(textParts[0]).append(link));
}
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.unlikepaladin.pfm.client;

import com.unlikepaladin.pfm.runtime.PFMRuntimeResources;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;
import net.minecraft.resource.metadata.PackResourceMetadata;
Expand All @@ -26,25 +27,31 @@ public PathPackRPWrapper(Supplier<ResourcePack> delegate, PackResourceMetadata p
@Nullable
@Override
public InputStream openRoot(String fileName) throws IOException {
if (fileName.equals("pack.png")) {
if (PFMRuntimeResources.ready && fileName.equals("pack.png")) {
return delegate.get().openRoot(fileName);
}
return null;
}

@Override
public InputStream open(ResourceType type, Identifier id) throws IOException {
return delegate.get().open(type, id);
if (PFMRuntimeResources.ready)
return delegate.get().open(type, id);
return null;
}

@Override
public Collection<Identifier> findResources(ResourceType type, String namespace, String prefix, int maxDepth, Predicate<String> pathFilter) {
return delegate.get().findResources(type, namespace, prefix, maxDepth, pathFilter);
if (PFMRuntimeResources.ready)
return delegate.get().findResources(type, namespace, prefix, maxDepth, pathFilter);
return null;
}

@Override
public boolean contains(ResourceType type, Identifier id) {
return delegate.get().contains(type, id);
if (PFMRuntimeResources.ready)
return delegate.get().contains(type, id);
return false;
}

@Override
Expand All @@ -68,6 +75,7 @@ public String getName() {

@Override
public void close() {
delegate.get().close();
if (PFMRuntimeResources.ready)
delegate.get().close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public void onInitialize() {
BlockItemRegistryFabric.registerItems();
BlockItemRegistryFabric.registerBlocks();
//PFMRuntimeResources.prepareAsyncResourceGen(); No async gen because Forge won't behave, blame it.
PFMRuntimeResources.ready = true;
StatisticsRegistryFabric.registerStatistics();
SoundRegistryFabric.registerSounds();
NetworkRegistryFabric.registerPackets();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ private List<ResourcePack> createReload(List<ResourcePack> packs) {
List<ResourcePack> resourcePacks = new ArrayList<>(packs);
resourcePacks.removeIf(pack -> pack instanceof PathPackRPWrapper);
PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks;
PFMRuntimeResources.ready = true;
return packs;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ private List<ResourcePack> createReload(List<ResourcePack> packs) {
List<ResourcePack> resourcePacks = new ArrayList<>(packs);
resourcePacks.removeIf(pack -> pack instanceof PathPackRPWrapper);
PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks;
PFMRuntimeResources.ready = true;
return packs;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public static void registerRecipeSerializers(RegistryEvent.Register<RecipeSerial
);
//Can't run resource gen until the recipe serializer has been registered or it dies because it needs the ID
//PFMRuntimeResources.prepareAsyncResourceGen(); Had to disable async gen because Forge dies and I can't be bothered to figure out why, this is cursed enough as it is
PFMRuntimeResources.ready = true;
if (PaladinFurnitureMod.getModList().contains("cookingforblockheads"))
PFMCookingForBlockHeadsCompat.initBlockConnectors();
}
Expand Down

0 comments on commit 65d9d50

Please sign in to comment.