mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
Add method to IResourcePack to hide it entirely from the UI (#5525)
This commit is contained in:
1 parent
d8d30e1f82
commit
2f486f2bdd
9 files changed
+165
-1
No files matched your search
@@ -38,6 +38,7 @@ public class ModFileInfo implements IModFileInfo
|
||||
private final URL issueURL;
|
||||
private final String modLoader;
|
||||
private final VersionRange modLoaderVersion;
|
||||
private final boolean showAsResourcePack;
|
||||
private final List<IModInfo> mods;
|
||||
private final Map<String,Object> properties;
|
||||
|
||||
@@ -50,6 +51,7 @@ public class ModFileInfo implements IModFileInfo
|
||||
this.modLoaderVersion = config.<String>getOptional("loaderVersion").
|
||||
map(MavenVersionAdapter::createFromVersionSpec).
|
||||
orElseThrow(()->new InvalidModFileException("Missing ModLoader version in file", this));
|
||||
this.showAsResourcePack = config.<Boolean>getOrElse("showAsResourcePack", false);
|
||||
this.properties = config.<UnmodifiableConfig>getOptional("properties").
|
||||
map(UnmodifiableConfig::valueMap).orElse(Collections.emptyMap());
|
||||
this.modFile.setFileProperties(this.properties);
|
||||
@@ -101,6 +103,6 @@ public class ModFileInfo implements IModFileInfo
|
||||
|
||||
@Override
|
||||
public boolean showAsResourcePack() {
|
||||
return false; // noop right now
|
||||
return this.showAsResourcePack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
public interface IForgeResourcePack
|
||||
{
|
||||
default boolean isHidden()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -218,4 +218,9 @@ public class ModFileResourcePack extends AbstractResourcePack
|
||||
<T extends ResourcePackInfo> T getPackInfo() {
|
||||
return (T)this.packInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return !modFile.getModFileInfo().showAsResourcePack();
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ net/minecraft/client/renderer/model/ModelBlock.makeBakedQuad(Lnet/minecraft/clie
|
||||
net/minecraft/client/renderer/model/VariantList.bake(Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraftforge/common/model/IModelState;ZLnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_209558_1_,p_209558_2_,p_209558_3_,p_209558_4_,format
|
||||
net/minecraft/client/renderer/model/multipart/Multipart.bake(Ljava/util/function/Function;Ljava/util/function/Function;Lnet/minecraftforge/common/model/IModelState;ZLnet/minecraft/client/renderer/vertex/VertexFormat;)Lnet/minecraft/client/renderer/model/IBakedModel;=|p_209558_1_,p_209558_2_,p_209558_3_,p_209558_4_,format
|
||||
|
||||
net/minecraft/client/resources/ResourcePackInfoClient.<init>(Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/resources/IResourcePack;Lnet/minecraft/resources/data/PackMetadataSection;Lnet/minecraft/resources/ResourcePackInfo$Priority;Z)V=|p_i48113_1_,p_i48113_2_,p_i48113_3_,p_i48113_4_,p_i48113_5_,p_i48113_6_,hidden
|
||||
net/minecraft/client/resources/ResourcePackInfoClient.<init>(Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/resources/PackCompatibility;Lnet/minecraft/resources/ResourcePackInfo$Priority;ZLnet/minecraft/client/renderer/texture/NativeImage;Z)V=|p_i48114_1_,p_i48114_2_,p_i48114_3_,p_i48114_4_,p_i48114_5_,p_i48114_6_,p_i48114_7_,p_i48114_8_,p_i48114_9_,hidden
|
||||
|
||||
net/minecraft/entity/Entity.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
net/minecraft/entity/EnumCreatureType.create(Ljava/lang/String;Ljava/lang/Class;IZZ)Lnet/minecraft/entity/EnumCreatureType;=|name,p_i47849_3_,p_i47849_4_,p_i47849_5_,p_i47849_6_
|
||||
net/minecraft/entity/item/EntityEnderPearl.changeDimension(Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_212321_1_,teleporter
|
||||
@@ -29,6 +32,9 @@ net/minecraft/item/ItemStack.<init>(Lnet/minecraft/util/IItemProvider;ILnet/mine
|
||||
|
||||
net/minecraft/network/PacketBuffer.writeItemStack(Lnet/minecraft/item/ItemStack;Z)Lnet/minecraft/network/PacketBuffer;=|p_150788_1_,limitedTag
|
||||
|
||||
net/minecraft/resources/ResourcePackInfo.<init>(Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/resources/PackCompatibility;Lnet/minecraft/resources/ResourcePackInfo$Priority;ZZ)V=|p_i47907_1_,p_i47907_2_,p_i47907_3_,p_i47907_4_,p_i47907_5_,p_i47907_6_,p_i47907_7_,p_i47907_8_,hidden
|
||||
net/minecraft/resources/ResourcePackInfo.<init>(Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/resources/IResourcePack;Lnet/minecraft/resources/data/PackMetadataSection;Lnet/minecraft/resources/ResourcePackInfo$Priority;Z)V=|p_i47908_1_,p_i47908_2_,p_i47908_3_,p_i47908_4_,p_i47908_5_,p_i47908_6_,hidden
|
||||
|
||||
net/minecraft/server/management/PlayerList.changePlayerDimension(Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraftforge/common/util/ITeleporter;)V=|p_187242_1_,p_187242_2_,teleporter
|
||||
net/minecraft/server/management/PlayerList.transferEntityToWorld(Lnet/minecraft/entity/Entity;Lnet/minecraft/world/dimension/DimensionType;Lnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraftforge/common/util/ITeleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter
|
||||
|
||||
|
||||
Reference in new issue
Block a user