@Override public ISmartBlockModel handleBlockState(IBlockState state) { FWBlock block = (FWBlock) state.getBlock(); Block blockInstance = block.getBlockInstance(block.lastExtendedWorld, VectorConverter.instance().toNova(block.lastExtendedStatePos)); if (blockInstance.components.has(StaticRenderer.class)) { return new FWSmartBlockModel(blockInstance); } return new FWEmptyModel(); }
@Override public IBakedModel handleBlockState(IBlockState state) { if (state instanceof IExtendedBlockState) { IBlockState renderState = ((IExtendedBlockState) state).getValue(BlockDungeonStone.RENDER_BLOCK); if (renderState != null) { IBakedModel renderModel = mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(renderState); if (renderModel instanceof ISmartBlockModel) { renderModel = ((ISmartBlockModel) renderModel).handleBlockState(renderState); } return renderModel; } } return defaultModel; }
@Override public ISmartBlockModel handleBlockState(IBlockState state) { return this; }
@SubscribeEvent public void onModelBakeEvent(ModelBakeEvent event) { for (Map.Entry<String, Block> entry : GearSwapperBlock.nameToMimicingBlock.entrySet()) { event.modelRegistry.putObject(new ModelResourceLocation(entry.getKey()), new ISmartBlockModel() { private IBakedModel model; @Override public IBakedModel handleBlockState(IBlockState state) { if (model == null) { model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(entry.getValue().getDefaultState()); ; } return model; } @Override public List<BakedQuad> getFaceQuads(EnumFacing f) { return model.getFaceQuads(f); } @Override public List<BakedQuad> getGeneralQuads() { return model.getGeneralQuads(); } @Override public boolean isAmbientOcclusion() { return model.isAmbientOcclusion(); } @Override public boolean isGui3d() { return model.isGui3d(); } @Override public boolean isBuiltInRenderer() { return model.isBuiltInRenderer(); } @Override public TextureAtlasSprite getParticleTexture() { return model.getParticleTexture(); } @Override public ItemCameraTransforms getItemCameraTransforms() { return model.getItemCameraTransforms(); } }); } }