Compiles again.

This commit is contained in:
Sebastian Hartte
2020-06-04 19:58:58 +02:00
parent 237463dd94
commit c402390282
89 changed files with 1353 additions and 1772 deletions
@@ -39,6 +39,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
class BlockRendering implements IBlockRendering
@@ -56,6 +57,9 @@ class BlockRendering implements IBlockRendering
@OnlyIn( Dist.CLIENT )
private RenderType renderType;
@OnlyIn( Dist.CLIENT )
private Predicate<RenderType> renderTypes;
@Override
@OnlyIn( Dist.CLIENT )
public IBlockRendering modelCustomizer( BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer )
@@ -85,13 +89,11 @@ class BlockRendering implements IBlockRendering
return this;
}
// FIXME @OnlyIn( Dist.CLIENT )
// FIXME @Override
// FIXME public IBlockRendering stateMapper( IStateMapper mapper )
// FIXME {
// FIXME this.stateMapper = mapper;
// FIXME return this;
// FIXME }
@Override
public IBlockRendering renderType(Predicate<RenderType> typePredicate) {
this.renderTypes = typePredicate;
return this;
}
void apply( FeatureFactory factory, Block block )
{
@@ -114,13 +116,8 @@ class BlockRendering implements IBlockRendering
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
}
if (this.renderType != null) {
factory.addBootstrapComponent( new RenderTypeComponent( block, this.renderType));
if (this.renderType != null || this.renderTypes != null) {
factory.addBootstrapComponent( new RenderTypeComponent( block, this.renderType, this.renderTypes));
}
// FIXME if( this.stateMapper != null )
// FIXME {
// FIXME factory.addBootstrapComponent( new StateMapperComponent( block, this.stateMapper ) );
// FIXME }
}
}
@@ -4,6 +4,8 @@ import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import java.util.function.Predicate;
/**
* Sets the rendering type for a block.
*/
@@ -13,14 +15,23 @@ public class RenderTypeComponent implements IClientSetupComponent {
private final RenderType renderType;
public RenderTypeComponent(Block block, RenderType renderType) {
private final Predicate<RenderType> renderTypes;
public RenderTypeComponent(Block block, RenderType renderType, Predicate<RenderType> renderTypes) {
this.block = block;
this.renderType = renderType;
this.renderTypes = renderTypes;
}
@Override
public void setup() {
RenderTypeLookup.setRenderLayer(block, renderType);
if (renderType != null) {
RenderTypeLookup.setRenderLayer(block, renderType);
}
if (renderTypes != null) {
RenderTypeLookup.setRenderLayer(block, renderTypes);
}
}
}