Most client patches done except the render pipeline.

Someone who has more in depth knowledge of that rendering system will need to do it.
This commit is contained in:
LexManos committed 2018-11-28 22:15:05 -08:00
1 parent b687180e12
commit bf9158172f
109 files changed
+1597 -2275

No files matched your search

@@ -23,8 +23,6 @@ import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.util.function.Predicate;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.VanillaResourceType;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -47,7 +45,9 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.VanillaResourceType;
public class CloudRenderer implements ISelectiveResourceReloadListener
{
@@ -70,6 +70,7 @@ import net.minecraft.client.renderer.block.model.SimpleBakedModel;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.model.ModelBiped;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -122,10 +123,6 @@ import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.client.model.ModelDynBucket;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.animation.Animation;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.ReloadRequirements;
import net.minecraftforge.client.resource.SelectiveReloadStateHandler;
import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.MinecraftForge;
@@ -134,6 +131,10 @@ import net.minecraftforge.common.model.ITransformation;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ReloadRequirements;
import net.minecraftforge.resource.SelectiveReloadStateHandler;
import net.minecraftforge.resource.VanillaResourceType;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
@@ -669,11 +670,6 @@ public class ForgeHooksClient
return from.getItem().shouldCauseReequipAnimation(from, to, changed);
}
public static boolean shouldCauseBlockBreakReset(@Nonnull ItemStack from, @Nonnull ItemStack to)
{
return from.getItem().shouldCauseBlockBreakReset(from, to);
}
public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, EnumFacing originalSide, ITransformation rotation)
{
TRSRTransformation global = new TRSRTransformation(rotation.getMatrixVec());
@@ -729,7 +725,7 @@ public class ForgeHooksClient
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO));
}
public static ScreenshotEvent onScreenshot(BufferedImage image, File screenshotFile)
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile)
{
ScreenshotEvent event = new ScreenshotEvent(image, screenshotFile);
MinecraftForge.EVENT_BUS.post(event);
@@ -757,28 +753,6 @@ public class ForgeHooksClient
return texture;
}
public static boolean shouldUseVanillaReloadableListener(IResourceManagerReloadListener listener)
{
Predicate<IResourceType> predicate = SelectiveReloadStateHandler.INSTANCE.get();
if (listener instanceof ModelManager || listener instanceof ItemRenderer)
return predicate.test(VanillaResourceType.MODELS);
else if (listener instanceof BlockRendererDispatcher || listener instanceof RenderGlobal)
return predicate.test(VanillaResourceType.MODELS);
else if (listener instanceof TextureManager || listener instanceof FontRenderer)
return predicate.test(VanillaResourceType.TEXTURES);
else if (listener instanceof FoliageColorReloadListener || listener instanceof GrassColorReloadListener)
return predicate.test(VanillaResourceType.TEXTURES);
else if (listener instanceof SoundHandler)
return predicate.test(VanillaResourceType.SOUNDS);
else if (listener instanceof EntityRenderer)
return predicate.test(VanillaResourceType.SHADERS);
else if (listener instanceof LanguageManager || listener instanceof SearchTreeManager)
return predicate.test(VanillaResourceType.LANGUAGES);
return true;
}
public static void refreshResources(Minecraft mc, VanillaResourceType... types) {
SelectiveReloadStateHandler.INSTANCE.beginReload(ReloadRequirements.include(types));
mc.refreshResources();
@@ -19,6 +19,7 @@
package net.minecraftforge.client.event;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -37,23 +38,23 @@ import java.io.File;
* {@link #resultMessage} contains the {@link ITextComponent} to be returned. If {@code null}, the default vanilla message will be used instead
*/
@Cancelable
public class ScreenshotEvent extends net.minecraftforge.eventbus.api.Event
public class ScreenshotEvent extends Event
{
public static final ITextComponent DEFAULT_CANCEL_REASON = new TextComponentString("Screenshot canceled");
private BufferedImage image;
private NativeImage image;
private File screenshotFile;
private ITextComponent resultMessage = null;
public ScreenshotEvent(BufferedImage image, File screenshotFile)
public ScreenshotEvent(NativeImage image, File screenshotFile)
{
this.image = image;
this.screenshotFile = screenshotFile;
}
public BufferedImage getImage()
public NativeImage getImage()
{
return image;
}
@@ -21,12 +21,12 @@ package net.minecraftforge.client.model;
import java.util.function.Predicate;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraft.client.renderer.block.model.IUnbakedModel;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.VanillaResourceType;
public interface ICustomModelLoader extends ISelectiveResourceReloadListener
{
@@ -52,4 +52,11 @@ public interface ICustomModelLoader extends ISelectiveResourceReloadListener
* loads (or reloads) specified model
*/
IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception;
@Override
default IResourceType getResourceType()
{
return VanillaResourceType.MODELS;
}
}
@@ -300,161 +300,6 @@ public class ForgeHooks
*/
public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world)
{
/*
boolean flag = this.player.capabilities.isCreativeMode;
TileEntity tileentity = null;
ItemStack itemstack;
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{
BlockPos blockpos = this.objectMouseOver.getBlockPos();
IBlockState iblockstate = this.world.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (iblockstate.getMaterial() == Material.AIR)
{
return;
}
itemstack = block.getItem(this.world, blockpos, iblockstate);
if (itemstack.isEmpty())
{
return;
}
if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
{
tileentity = this.world.getTileEntity(blockpos);
}
}
else
{
if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag)
{
return;
}
if (this.objectMouseOver.entityHit instanceof EntityPainting)
{
itemstack = new ItemStack(Items.PAINTING);
}
else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
{
itemstack = new ItemStack(Items.LEAD);
}
else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
{
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
ItemStack itemstack1 = entityitemframe.getDisplayedItem();
if (itemstack1.isEmpty())
{
itemstack = new ItemStack(Items.ITEM_FRAME);
}
else
{
itemstack = itemstack1.copy();
}
}
else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
{
EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
Item item;
switch (entityminecart.getType())
{
case FURNACE:
item = Items.FURNACE_MINECART;
break;
case CHEST:
item = Items.CHEST_MINECART;
break;
case TNT:
item = Items.TNT_MINECART;
break;
case HOPPER:
item = Items.HOPPER_MINECART;
break;
case COMMAND_BLOCK:
item = Items.COMMAND_BLOCK_MINECART;
break;
default:
item = Items.MINECART;
}
itemstack = new ItemStack(item);
}
else if (this.objectMouseOver.entityHit instanceof EntityBoat)
{
itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).getItemBoat());
}
else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
{
itemstack = new ItemStack(Items.ARMOR_STAND);
}
else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal)
{
itemstack = new ItemStack(Items.END_CRYSTAL);
}
else
{
ResourceLocation resourcelocation = EntityList.func_191301_a(this.objectMouseOver.entityHit);
if (resourcelocation == null || !EntityList.ENTITY_EGGS.containsKey(resourcelocation))
{
return;
}
itemstack = new ItemStack(Items.SPAWN_EGG);
ItemMonsterPlacer.applyEntityIdToItemStack(itemstack, resourcelocation);
}
}
if (itemstack.isEmpty())
{
String s = "";
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{
s = ((ResourceLocation)Block.REGISTRY.getNameForObject(this.world.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
}
else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
{
s = EntityList.func_191301_a(this.objectMouseOver.entityHit).toString();
}
LOGGER.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s});
}
else
{
InventoryPlayer inventoryplayer = this.player.inventory;
if (tileentity != null)
{
this.storeTEInStack(itemstack, tileentity);
}
int i = inventoryplayer.getSlotFor(itemstack);
if (flag)
{
inventoryplayer.setPickedItemStack(itemstack);
this.playerController.sendSlotPacket(this.player.getHeldItem(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
}
else if (i != -1)
{
if (InventoryPlayer.isHotbar(i))
{
inventoryplayer.currentItem = i;
}
else
{
this.playerController.pickItem(i);
}
}
}
*/
ItemStack result;
boolean isCreative = player.abilities.isCreativeMode;
TileEntity te = null;
@@ -463,12 +308,10 @@ public class ForgeHooks
{
IBlockState state = world.getBlockState(target.getBlockPos());
if (state.getBlock().isAir(state, world, target.getBlockPos()))
{
if (state.isAir(world, target.getBlockPos()))
return false;
}
if (isCreative && GuiScreen.isCtrlKeyDown() && state.getBlock().hasTileEntity(state))
if (isCreative && GuiScreen.isCtrlKeyDown() && state.hasTileEntity())
te = world.getTileEntity(target.getBlockPos());
result = state.getBlock().getPickBlock(state, target, world, target.getBlockPos(), player);
@@ -754,7 +597,7 @@ public class ForgeHooks
boolean preCancelEvent = false;
ItemStack itemstack = entityPlayer.getHeldItemMainhand();
if (gameType.isCreative() && !itemstack.isEmpty()
&& !itemstack.getItem().canDestroyBlockInCreative(world, pos, itemstack, entityPlayer))
&& !itemstack.getItem().canPlayerBreakBlockWhileHolding(world.getBlockState(pos), world, pos, entityPlayer))
preCancelEvent = true;
if (gameType.hasLimitedInteractions())
@@ -37,6 +37,7 @@ import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityWitherSkull;
import net.minecraft.fluid.IFluidState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
@@ -65,6 +66,7 @@ import net.minecraft.world.dimension.EndDimension;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.ToolType;
@@ -216,7 +218,7 @@ public interface IForgeBlock
*/
default public boolean canHarvestBlock(IBlockState state, IBlockReader world, BlockPos pos, EntityPlayer player)
{
return net.minecraftforge.common.ForgeHooks.canHarvestBlock(state, player, world, pos);
return ForgeHooks.canHarvestBlock(state, player, world, pos);
}
/**
@@ -236,12 +238,13 @@ public interface IForgeBlock
* @param pos Block position in world
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
* Can be useful to delay the destruction of tile entities till after harvestBlock
* @param fluid The current fluid state at current position
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
default boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest, IFluidState fluid)
{
getBlock().onBlockHarvested(world, pos, state, player);
return world.setBlockState(pos, net.minecraft.init.Blocks.AIR.getDefaultState(), world.isRemote ? 11 : 3);
return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3);
}
/**
@@ -508,6 +511,24 @@ public interface IForgeBlock
return false;
}
/**
* Spawn a digging particle effect in the world, this is a wrapper
* around EffectRenderer.addBlockHitEffects to allow the block more
* control over the particles. Useful when you have entirely different
* texture sheets for different sides/locations in the world.
*
* @param state The current state
* @param world The current world
* @param target The target the player is looking at {x/y/z/side/sub}
* @param manager A reference to the current particle manager.
* @return True to prevent vanilla digging particles form spawning.
*/
@OnlyIn(Dist.CLIENT)
default boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager)
{
return false;
}
/**
* Spawn particles for when the block is destroyed. Due to the nature
* of how this is invoked, the x/y/z locations are not always guaranteed
@@ -30,6 +30,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntitySpawnPlacementRegistry.SpawnPlacementType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -199,11 +200,12 @@ public interface IForgeBlockState
* @param pos Block position in world
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
* Can be useful to delay the destruction of tile entities till after harvestBlock
* @param fluid The current fluid and block state for the position in the world.
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
default boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest, IFluidState fluid)
{
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest);
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid);
}
/**
@@ -449,6 +451,23 @@ public interface IForgeBlockState
return getBlockState().getBlock().addRunningEffects(getBlockState(), world, pos, entity);
}
/**
* Spawn a digging particle effect in the world, this is a wrapper
* around EffectRenderer.addBlockHitEffects to allow the block more
* control over the particles. Useful when you have entirely different
* texture sheets for different sides/locations in the world.
*
* @param world The current world
* @param target The target the player is looking at {x/y/z/side/sub}
* @param manager A reference to the current particle manager.
* @return True to prevent vanilla digging particles form spawning.
*/
@OnlyIn(Dist.CLIENT)
default boolean addHitEffects(World world, RayTraceResult target, ParticleManager manager)
{
return getBlockState().getBlock().addHitEffects(getBlockState(), world, target, manager);
}
/**
* Spawn particles for when the block is destroyed. Due to the nature
* of how this is invoked, the x/y/z locations are not always guaranteed
@@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.world.World;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.NetherDimension;
@@ -44,7 +45,7 @@ public interface IForgeDimension
* and VillageCollection are initialized. On client, called when world is
* constructed, just before world load event is called. Note that this method is
* always called before the world load event.
*
*
* @return initial holder for capabilities on the world
*/
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
@@ -58,7 +59,7 @@ public interface IForgeDimension
* worldA.provider.getMovementFactor() / worldB.provider.getMovementFactor()
* Example: Overworld factor is 1, nether factor is 8. Traveling from overworld
* to nether multiplies coordinates by 1/8.
*
*
* @return The movement factor
*/
default double getMovementFactor()
@@ -103,7 +104,7 @@ public interface IForgeDimension
void setWeatherRenderer(IRenderHandler renderer);
void resetRainAndThunder();
default boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk)
{
return true;
@@ -113,4 +114,16 @@ public interface IForgeDimension
{
return true;
}
/**
* Called on the client to get the music type to play when in this world type.
* At the time of calling, the client player and world are guaranteed to be non-null
* @return null to use vanilla logic, otherwise a MusicType to play in this world
*/
@Nullable
@OnlyIn(Dist.CLIENT)
default MusicTicker.MusicType getMusicType()
{
return null;
}
}
@@ -532,22 +532,6 @@ public interface IForgeItem
stack.getOrCreateTag().setInt("Damage", Math.max(0, damage));
}
/**
* Checked from
* {@link net.minecraft.client.multiplayer.PlayerControllerMP#onPlayerDestroyBlock(BlockPos pos)
* PlayerControllerMP.onPlayerDestroyBlock()} when a creative player left-clicks
* a block with this item. Also checked from
* {@link net.minecraftforge.common.ForgeHooks#onBlockBreakEvent(World, GameType, EntityPlayerMP, BlockPos)
* ForgeHooks.onBlockBreakEvent()} to prevent sending an event.
*
* @return true if the given player can destroy specified block in creative mode
* with this item
*/
default boolean canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, EntityPlayer player)
{
return !(this instanceof ItemSword);
}
/**
* ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)}
*
@@ -123,5 +123,30 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
getStack().write(ret);
return ret;
}
/**
* Called before a block is broken. Return true to prevent default block
* harvesting.
*
* Note: In SMP, this is called on both client and server sides!
*
* @param pos Block's position in world
* @param player The Player that is wielding the item
* @return True to prevent harvesting, false to continue as normal
*/
default boolean onBlockStartBreak(BlockPos pos, EntityPlayer player)
{
return getStack().isEmpty() || getStack().getItem().onBlockStartBreak(getStack(), pos, player);
}
/**
* Called when the player is mining a block and the item in his hand changes.
* Allows to not reset blockbreaking if only NBT or similar changes.
*
* @param newStack The new stack
* @return True to reset block break progress
*/
default boolean shouldCauseBlockBreakReset(ItemStack newStack)
{
return getStack().getItem().shouldCauseBlockBreakReset(getStack(), newStack);
}
}
@@ -26,7 +26,7 @@ import net.minecraftforge.common.capabilities.ICapabilitySerializable;
public interface IForgeTileEntity extends ICapabilitySerializable<NBTTagCompound>
{
default TileEntity getTileEntity() { return (TileEntity) this; }
@Override
default void deserializeNBT(NBTTagCompound nbt)
{
@@ -40,4 +40,35 @@ public interface IForgeTileEntity extends ICapabilitySerializable<NBTTagCompound
getTileEntity().write(ret);
return ret;
}
/**
* Called when you receive a TileEntityData packet for the location this
* TileEntity is currently in. On the client, the NetworkManager will always
* be the remote server. On the server, it will be whomever is responsible for
* sending the packet.
*
* @param net The NetworkManager the packet originated from
* @param pkt The data packet
*/
default void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt){ }
/**
* Called when the chunk's TE update tag, gotten from {@link #getUpdateTag()}, is received on the client.
* <p>
* Used to handle this tag in a special way. By default this simply calls {@link #readFromNBT(NBTTagCompound)}.
*
* @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()}
*/
default void handleUpdateTag(NBTTagCompound tag)
{
getTileEntity().read(tag);
}
/**
* Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity.
* It will be written, and read from disc, so it persists over world saves.
*
* @return A compound tag for custom data
*/
NBTTagCompound getTileData();
}
@@ -129,7 +129,7 @@ public class ServerLifecycleHooks
}
public void handleExit(int retVal)
public static void handleExit(int retVal)
{
/*
CountDownLatch latch = exitLatch;
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.resource;
package net.minecraftforge.resource;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.resource;
package net.minecraftforge.resource;
import java.util.function.Predicate;
@@ -34,7 +34,7 @@ public interface ISelectiveResourceReloadListener extends IResourceManagerReload
}
/**
* A version of onResourceManager that selectively chooses {@link net.minecraftforge.client.resource.IResourceType}s
* A version of onResourceManager that selectively chooses {@link net.minecraftforge.resource.IResourceType}s
* to reload.
* When using this, the given predicate should be called to ensure the relevant resources should
* be reloaded at this time.
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.resource;
package net.minecraftforge.resource;
import java.util.Set;
import java.util.function.Predicate;
@@ -17,11 +17,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.resource;
package net.minecraftforge.resource;
import javax.annotation.Nullable;
import java.util.function.Predicate;
import net.minecraft.resources.IResourceManagerReloadListener;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeModContainer;
@@ -74,4 +75,12 @@ public enum SelectiveReloadStateHandler
{
this.currentPredicate = null;
}
//Helpder function for testing if vanilla listeners should reload.
@SuppressWarnings("deprecation")
public boolean test(IResourceManagerReloadListener listener)
{
IResourceType type = listener.getResourceType();
return type == null || get() == null || get().test(type);
}
}
@@ -17,16 +17,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.client.resource;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
package net.minecraftforge.resource;
/**
* An enum of all {@link IResourceType}s used by the Vanilla game. These should be used if handling vanilla-related
* resources.
*/
@OnlyIn(Dist.CLIENT)
public enum VanillaResourceType implements IResourceType
{
/**
@@ -19,7 +19,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package net.minecraftforge.client.resource;
package net.minecraftforge.resource;
import javax.annotation.ParametersAreNonnullByDefault;