2018-12-20 00:39:10 +00:00
|
|
|
package net.shadowfacts.simplemultipart.client;
|
|
|
|
|
2018-12-24 16:29:06 +00:00
|
|
|
import net.minecraft.block.BlockState;
|
|
|
|
import net.minecraft.client.render.model.BakedModel;
|
2018-12-20 00:39:10 +00:00
|
|
|
import net.minecraft.client.render.model.BakedQuad;
|
|
|
|
import net.minecraft.util.math.Direction;
|
2018-12-28 02:55:51 +00:00
|
|
|
import net.shadowfacts.simplemultipart.multipart.MultipartView;
|
2018-12-20 00:39:10 +00:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
/**
|
2018-12-28 18:10:59 +00:00
|
|
|
* An extension of the {@link BakedModel} interface for custom code-based multipart models.
|
|
|
|
*
|
|
|
|
* Note: Currently there is no proper way to register these. They can be registered by mixing in to the {@link net.minecraft.client.render.model.ModelLoader}
|
|
|
|
* constructor and injecting them into the {@code bakedModels} map.
|
|
|
|
*
|
2018-12-20 00:39:10 +00:00
|
|
|
* @author shadowfacts
|
2018-12-28 18:10:59 +00:00
|
|
|
* @since 0.1.0
|
2018-12-20 00:39:10 +00:00
|
|
|
*/
|
2018-12-24 16:29:06 +00:00
|
|
|
public interface MultipartBakedModel extends BakedModel {
|
2018-12-20 00:39:10 +00:00
|
|
|
|
2018-12-28 18:10:59 +00:00
|
|
|
/**
|
|
|
|
* Retrieves the quads for a given side of the multipart.
|
|
|
|
*
|
|
|
|
* @param view The view of the multipart in the world.
|
|
|
|
* {@code null} if the default {@link MultipartBakedModel#getQuads(BlockState, Direction, Random)} implementation
|
|
|
|
* is invoked.
|
|
|
|
* @param side The side that quads are being requested for.
|
|
|
|
* @param random The position-specific random.
|
|
|
|
* @return The quads for the given side. The returned quads will be culled whenever the {@code side} is obscured.
|
|
|
|
*/
|
|
|
|
List<BakedQuad> getMultipartQuads(/*@Nullable*/ MultipartView view, Direction side, Random random);
|
2018-12-24 16:29:06 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
default List<BakedQuad> getQuads(BlockState state, Direction side, Random random) {
|
|
|
|
return getMultipartQuads(null, side, random);
|
|
|
|
}
|
2018-12-20 00:39:10 +00:00
|
|
|
|
|
|
|
}
|