use of crazypants.enderio.base.render.property.IOMode in project EnderIO by SleepyTrousers.
the class OverlayHolder method collectOverlayQuads.
public static void collectOverlayQuads(@Nonnull ModelBakeEvent event) {
final Block block = ModObject.block_machine_io.getBlockNN();
Map<IBlockState, ModelResourceLocation> locations = event.getModelManager().getBlockModelShapes().getBlockStateMapper().getVariants(block);
NNIterator<IOMode> modes = crazypants.enderio.base.render.property.IOMode.MODES.iterator();
while (modes.hasNext()) {
IOMode mode = modes.next();
IBlockState state = block.getDefaultState().withProperty(IOMode.IO, mode);
ModelResourceLocation mrl = locations.get(state);
if (mrl == null) {
throw new RuntimeException("Model for state " + state + " failed to load from " + mrl + ". ");
}
IBakedModel model = event.getModelRegistry().getObject(mrl);
if (model == null) {
Log.warn("Model for state " + state + " failed to load from " + mrl + ".");
continue;
}
QuadCollector quads = new QuadCollector();
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
BlockRenderLayer layer = block.getBlockLayer();
ForgeHooksClient.setRenderLayer(layer);
List<BakedQuad> generalQuads = model.getQuads(state, null, 0);
if (!generalQuads.isEmpty()) {
quads.addQuads(null, layer, generalQuads);
}
for (EnumFacing face1 : EnumFacing.values()) {
List<BakedQuad> faceQuads = model.getQuads(state, mode.getDirection(), 0);
if (!faceQuads.isEmpty()) {
quads.addQuads(face1, layer, faceQuads);
}
}
ForgeHooksClient.setRenderLayer(oldRenderLayer);
data[mode.getDirection().ordinal()][mode.getIomode().ordinal()] = quads;
}
}
Aggregations