/** always returns true for convenience */ private VertexLighterFlat setupFlat(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer) { VertexLighterFlat lighter = this.lighterFlat.get(); if(buffer != this.lastRendererFlat.get()) { this.lastRendererFlat.set(buffer); VertexBufferConsumer newCons = new VertexBufferConsumer(buffer); this.wrFlat.set(newCons); lighter.setParent(newCons); } this.wrFlat.get().setOffset(pos); lighter.setWorld(world); lighter.setState(state); lighter.setBlockPos(pos); lighter.updateBlockInfo(); return lighter; }
/** always returns true for convenience */ private VertexLighterFlat setupSmooth(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer) { VertexLighterFlat lighter = this.lighterSmooth.get(); if(buffer != this.lastRendererSmooth.get()) { this.lastRendererSmooth.set(buffer); VertexBufferConsumer newCons = new VertexBufferConsumer(buffer); this.wrSmooth.set(newCons); lighter.setParent(newCons); } this.wrSmooth.get().setOffset(pos); lighter.setWorld(world); lighter.setState(state); lighter.setBlockPos(pos); lighter.updateBlockInfo(); return lighter; }
public static VertexLighterFlat setupLighter(VertexBuffer buffer, final IBlockState state, final IBlockAccess access, final BlockPos pos, final IBakedModel model) { final boolean renderAO = Minecraft.isAmbientOcclusionEnabled() && state.getLightValue(access, pos) == 0 && (model == null ? false : model.isAmbientOcclusion()); final VertexLighterFlat lighter = renderAO ? lighterSmooth.get() : lighterFlat.get(); VertexBufferConsumer consumer = new VertexBufferConsumer(buffer); lighter.setParent(consumer); consumer.setOffset(pos); return lighter; }
public static boolean renderBlockQuads(final VertexLighterFlat lighter, final IBlockAccess access, final IBlockState state, final List<CustomBakedQuad> quads, final BlockPos pos) { if (!quads.isEmpty()) { lighter.setWorld(access); lighter.setState(state); lighter.setBlockPos(pos); for (final CustomBakedQuad quad : quads) { lighter.updateBlockInfo(); quad.pipe(lighter); } return true; } return false; }
public static boolean renderBakedCoverQuads(VertexBuffer buffer, IBlockAccess world, BlockPos pos, IBlockState state, int side, AxisAlignedBB bounds, final CoverCutter.ITransformer[] cutType){ final EnumFacing face = EnumFacing.getFront(side); final IBlockAccess coverAccess = new PipeBlockAccessWrapper(world, pos, face); final BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); try { state = state.getActualState(coverAccess, pos); } catch (Exception ex) {} final IBakedModel model = dispatcher.getModelForState(state); try { state = state.getBlock().getExtendedState(state, coverAccess, pos); } catch (Exception ex2) {} final List<BakedQuad> bakedQuads = new LinkedList<BakedQuad>(); final long posRand = MathHelper.getPositionRandom(pos); bakedQuads.addAll(model.getQuads(state, (EnumFacing)null, posRand)); for (final EnumFacing face2 : EnumFacing.VALUES) { bakedQuads.addAll(model.getQuads(state, face2, posRand)); } List<CustomBakedQuad> quads = CustomBakedQuad.fromArray(bakedQuads); if (cutType != null) { quads = CoverCutter.cut(quads, side, cutType); } quads = sliceQuads(quads, side, bounds); if (!quads.isEmpty()) { final VertexLighterFlat lighter = setupLighter(buffer, state, coverAccess, pos, model); return renderBlockQuads(lighter, coverAccess, state, quads, pos); } return false; }
public AnimationModelBase(ResourceLocation modelLocation, VertexLighterFlat lighter) { this.modelLocation = modelLocation; this.lighter = lighter; }
@Override protected VertexLighterFlat initialValue() { return new VertexLighterFlat(colors); }