mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Minor code and documentation cleanup. (#4664)
This commit is contained in:
52 files changed
+227
-249
No files matched your search
@@ -19,14 +19,18 @@
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
/**
|
||||
* @deprecated TODO remove in 1.13. This has never been used
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IRenderContextHandler
|
||||
{
|
||||
/** Run before the specified rendering context.
|
||||
*/
|
||||
public void beforeRenderContext();
|
||||
void beforeRenderContext();
|
||||
|
||||
/** Run after the specified rendering context.
|
||||
*/
|
||||
public void afterRenderContext();
|
||||
void afterRenderContext();
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ public interface ICustomModelLoader extends IResourceManagerReloadListener
|
||||
* Checks if given model should be loaded by this loader.
|
||||
* Reading file contents is inadvisable, if possible decision should be made based on the location alone.
|
||||
*/
|
||||
public boolean accepts(ResourceLocation modelLocation);
|
||||
boolean accepts(ResourceLocation modelLocation);
|
||||
|
||||
/*
|
||||
* loads (or reloads) specified model
|
||||
*/
|
||||
public IModel loadModel(ResourceLocation modelLocation) throws Exception;
|
||||
IModel loadModel(ResourceLocation modelLocation) throws Exception;
|
||||
}
|
||||
@@ -106,6 +106,9 @@ import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
@@ -208,8 +211,10 @@ public final class ModelLoader extends ModelBakery
|
||||
@Override
|
||||
protected void loadBlocks()
|
||||
{
|
||||
List<Block> blocks = Lists.newArrayList(Iterables.filter(Block.REGISTRY, block -> block.getRegistryName() != null));
|
||||
blocks.sort(Comparator.comparing(b -> b.getRegistryName().toString()));
|
||||
List<Block> blocks = StreamSupport.stream(Block.REGISTRY.spliterator(), false)
|
||||
.filter(block -> block.getRegistryName() != null)
|
||||
.sorted(Comparator.comparing(b -> b.getRegistryName().toString()))
|
||||
.collect(Collectors.toList());
|
||||
ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", blocks.size());
|
||||
|
||||
BlockStateMapper mapper = this.blockModelShapes.getBlockStateMapper();
|
||||
@@ -280,8 +285,10 @@ public final class ModelLoader extends ModelBakery
|
||||
|
||||
registerVariantNames();
|
||||
|
||||
List<Item> items = Lists.newArrayList(Iterables.filter(Item.REGISTRY, item -> item.getRegistryName() != null));
|
||||
Collections.sort(items, (i1, i2) -> i1.getRegistryName().toString().compareTo(i2.getRegistryName().toString()));
|
||||
List<Item> items = StreamSupport.stream(Item.REGISTRY.spliterator(), false)
|
||||
.filter(item -> item.getRegistryName() != null)
|
||||
.sorted(Comparator.comparing(i -> i.getRegistryName().toString()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
ProgressBar itemBar = ProgressManager.push("ModelLoader: items", items.size());
|
||||
for(Item item : items)
|
||||
|
||||
+4
-22
@@ -34,36 +34,18 @@ import net.minecraftforge.common.ForgeModContainer;
|
||||
|
||||
public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
{
|
||||
private final ThreadLocal<VertexLighterFlat> lighterFlat = new ThreadLocal<VertexLighterFlat>()
|
||||
{
|
||||
@Override
|
||||
protected VertexLighterFlat initialValue()
|
||||
{
|
||||
return new VertexLighterFlat(colors);
|
||||
}
|
||||
};
|
||||
|
||||
private final ThreadLocal<VertexLighterSmoothAo> lighterSmooth = new ThreadLocal<VertexLighterSmoothAo>()
|
||||
{
|
||||
@Override
|
||||
protected VertexLighterSmoothAo initialValue()
|
||||
{
|
||||
return new VertexLighterSmoothAo(colors);
|
||||
}
|
||||
};
|
||||
|
||||
private final ThreadLocal<VertexLighterFlat> lighterFlat;
|
||||
private final ThreadLocal<VertexLighterSmoothAo> lighterSmooth;
|
||||
private final ThreadLocal<VertexBufferConsumer> wrFlat = new ThreadLocal<>();
|
||||
private final ThreadLocal<VertexBufferConsumer> wrSmooth = new ThreadLocal<>();
|
||||
private final ThreadLocal<BufferBuilder> lastRendererFlat = new ThreadLocal<>();
|
||||
private final ThreadLocal<BufferBuilder> lastRendererSmooth = new ThreadLocal<>();
|
||||
|
||||
private final BlockColors colors;
|
||||
|
||||
public ForgeBlockModelRenderer(BlockColors colors)
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
super(colors);
|
||||
this.colors = colors;
|
||||
lighterFlat = ThreadLocal.withInitial(() -> new VertexLighterFlat(colors));
|
||||
lighterSmooth = ThreadLocal.withInitial(() -> new VertexLighterSmoothAo(colors));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user