mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 15:03:04 +00:00
Rendering patches (#5262)
This commit is contained in:
1 parent
0bfa76251d
commit
b3b8c78527
122 files changed
+2354
-2888
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
|
||||
public interface IForgeBakedModel
|
||||
{
|
||||
default IBakedModel getBakedModel()
|
||||
{
|
||||
return (IBakedModel) this;
|
||||
}
|
||||
|
||||
default boolean isAmbientOcclusion(IBlockState state) { return getBakedModel().isAmbientOcclusion(); }
|
||||
|
||||
/*
|
||||
* Returns the pair of the model for the given perspective, and the matrix that
|
||||
* should be applied to the GL state before rendering it (matrix may be null).
|
||||
*/
|
||||
default org.apache.commons.lang3.tuple.Pair<? extends IBakedModel, javax.vecmath.Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
|
||||
{
|
||||
return net.minecraftforge.client.ForgeHooksClient.handlePerspective(getBakedModel(), cameraTransformType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IForgeRenderChunk
|
||||
{
|
||||
/**
|
||||
* Creates a new RegionRenderCache instance.<br>
|
||||
* Extending classes can change the behavior of the cache, allowing to visually change
|
||||
* blocks (schematics etc).
|
||||
*
|
||||
* @see RegionRenderCache
|
||||
* @param world The world to cache.
|
||||
* @param from The starting position of the chunk minus one on each axis.
|
||||
* @param to The ending position of the chunk plus one on each axis.
|
||||
* @param subtract Padding used internally by the RegionRenderCache constructor to make
|
||||
* the cache a 20x20x20 cube, for a total of 8000 states in the cache.
|
||||
* @return new RegionRenderCache instance
|
||||
*/
|
||||
default ChunkCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract)
|
||||
{
|
||||
return new ChunkCache(world, from, to, subtract);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public interface IForgeTextureAtlasSprite
|
||||
{
|
||||
/**
|
||||
* The result of this function determines is the below 'load' function is called, and the
|
||||
* default vanilla loading code is bypassed completely.
|
||||
* @param manager Main resource manager
|
||||
* @param location File resource location
|
||||
* @return True to use your own custom load code and bypass vanilla loading.
|
||||
*/
|
||||
default boolean hasCustomLoader(IResourceManager manager, ResourceLocation location)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the specified resource as this sprite's data.
|
||||
* Returning false from this function will prevent this icon from being stitched onto the master texture.
|
||||
* @param manager Main resource manager
|
||||
* @param location File resource location
|
||||
* @param textureGetter accessor for dependencies. All of them will be loaded before this one
|
||||
* @return False to prevent this Icon from being stitched
|
||||
*/
|
||||
default boolean load(IResourceManager manager, ResourceLocation location, Function<ResourceLocation, TextureAtlasSprite> textureGetter)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return all textures that should be loaded before this texture.
|
||||
*/
|
||||
default Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user